ccgo_linux_amd64.go 1.0 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156
  1. // Code generated for linux/amd64 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/amd64 -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 && amd64
  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_ILOGB0 = "FP_ILOGBNAN"
  286. const m_FP_INFINITE = 1
  287. const m_FP_NAN = 0
  288. const m_FP_NORMAL = 4
  289. const m_FP_SUBNORMAL = 3
  290. const m_FP_ZERO = 2
  291. const m_F_ADD_SEALS = 1033
  292. const m_F_CANCELLK = 1029
  293. const m_F_DUPFD = 0
  294. const m_F_DUPFD_CLOEXEC = 1030
  295. const m_F_GETFD = 1
  296. const m_F_GETFL = 3
  297. const m_F_GETLEASE = 1025
  298. const m_F_GETLK = 5
  299. const m_F_GETOWN = 9
  300. const m_F_GETOWNER_UIDS = 17
  301. const m_F_GETOWN_EX = 16
  302. const m_F_GETPIPE_SZ = 1032
  303. const m_F_GETSIG = 11
  304. const m_F_GET_FILE_RW_HINT = 1037
  305. const m_F_GET_RW_HINT = 1035
  306. const m_F_GET_SEALS = 1034
  307. const m_F_LOCK = 1
  308. const m_F_NOTIFY = 1026
  309. const m_F_OFD_GETLK = 36
  310. const m_F_OFD_SETLK = 37
  311. const m_F_OFD_SETLKW = 38
  312. const m_F_OK = 0
  313. const m_F_OWNER_GID = 2
  314. const m_F_OWNER_PGRP = 2
  315. const m_F_OWNER_PID = 1
  316. const m_F_OWNER_TID = 0
  317. const m_F_RDLCK = 0
  318. const m_F_SEAL_FUTURE_WRITE = 0x0010
  319. const m_F_SEAL_GROW = 0x0004
  320. const m_F_SEAL_SEAL = 0x0001
  321. const m_F_SEAL_SHRINK = 0x0002
  322. const m_F_SEAL_WRITE = 0x0008
  323. const m_F_SETFD = 2
  324. const m_F_SETFL = 4
  325. const m_F_SETLEASE = 1024
  326. const m_F_SETLK = 6
  327. const m_F_SETLKW = 7
  328. const m_F_SETOWN = 8
  329. const m_F_SETOWN_EX = 15
  330. const m_F_SETPIPE_SZ = 1031
  331. const m_F_SETSIG = 10
  332. const m_F_SET_FILE_RW_HINT = 1038
  333. const m_F_SET_RW_HINT = 1036
  334. const m_F_TEST = 3
  335. const m_F_TLOCK = 2
  336. const m_F_ULOCK = 0
  337. const m_F_UNLCK = 2
  338. const m_F_WRLCK = 1
  339. const m_GRND_INSECURE = 0x0004
  340. const m_GRND_NONBLOCK = 0x0001
  341. const m_GRND_RANDOM = 0x0002
  342. const m_HAVE_ARC4RANDOM_BUF = 1
  343. const m_HAVE_CONFIG_H = 1
  344. const m_HAVE_DLFCN_H = 1
  345. const m_HAVE_FCNTL_H = 1
  346. const m_HAVE_GETPAGESIZE = 1
  347. const m_HAVE_GETRANDOM = 1
  348. const m_HAVE_INTTYPES_H = 1
  349. const m_HAVE_MMAP = 1
  350. const m_HAVE_STDINT_H = 1
  351. const m_HAVE_STDIO_H = 1
  352. const m_HAVE_STDLIB_H = 1
  353. const m_HAVE_STRINGS_H = 1
  354. const m_HAVE_STRING_H = 1
  355. const m_HAVE_SYSCALL_GETRANDOM = 1
  356. const m_HAVE_SYS_PARAM_H = 1
  357. const m_HAVE_SYS_STAT_H = 1
  358. const m_HAVE_SYS_TYPES_H = 1
  359. const m_HAVE_UNISTD_H = 1
  360. const m_HOST_NAME_MAX = 255
  361. const m_HUGE = 3.40282346638528859812e+38
  362. const m_HUGE_VALF = "INFINITY"
  363. const m_INIT_ATTS_SIZE = 16
  364. const m_INIT_ATTS_VERSION = 4294967295
  365. const m_INIT_BLOCK_SIZE = 1024
  366. const m_INIT_BUFFER_SIZE = 1024
  367. const m_INIT_DATA_BUF_SIZE = 1024
  368. const m_INIT_POWER = 6
  369. const m_INIT_SCAFFOLD_ELEMENTS = 32
  370. const m_INIT_TAG_BUF_SIZE = 32
  371. const m_INT16_MAX = 0x7fff
  372. const m_INT32_MAX = 0x7fffffff
  373. const m_INT64_MAX = 0x7fffffffffffffff
  374. const m_INT8_MAX = 0x7f
  375. const m_INTMAX_MAX = "INT64_MAX"
  376. const m_INTMAX_MIN = "INT64_MIN"
  377. const m_INTPTR_MAX = "INT64_MAX"
  378. const m_INTPTR_MIN = "INT64_MIN"
  379. const m_INT_FAST16_MAX = "INT32_MAX"
  380. const m_INT_FAST16_MIN = "INT32_MIN"
  381. const m_INT_FAST32_MAX = "INT32_MAX"
  382. const m_INT_FAST32_MIN = "INT32_MIN"
  383. const m_INT_FAST64_MAX = "INT64_MAX"
  384. const m_INT_FAST64_MIN = "INT64_MIN"
  385. const m_INT_FAST8_MAX = "INT8_MAX"
  386. const m_INT_FAST8_MIN = "INT8_MIN"
  387. const m_INT_LEAST16_MAX = "INT16_MAX"
  388. const m_INT_LEAST16_MIN = "INT16_MIN"
  389. const m_INT_LEAST32_MAX = "INT32_MAX"
  390. const m_INT_LEAST32_MIN = "INT32_MIN"
  391. const m_INT_LEAST64_MAX = "INT64_MAX"
  392. const m_INT_LEAST64_MIN = "INT64_MIN"
  393. const m_INT_LEAST8_MAX = "INT8_MAX"
  394. const m_INT_LEAST8_MIN = "INT8_MIN"
  395. const m_INT_MAX = 2147483647
  396. const m_IOV_MAX = 1024
  397. const m_ITIMER_PROF = 2
  398. const m_ITIMER_REAL = 0
  399. const m_ITIMER_VIRTUAL = 1
  400. const m_LINE_MAX = 4096
  401. const m_LITTLE_ENDIAN = "__LITTLE_ENDIAN"
  402. const m_LLONG_MAX = 0x7fffffffffffffff
  403. const m_LOGIN_NAME_MAX = 256
  404. const m_LONG_BIT = 64
  405. const m_LONG_MAX = "__LONG_MAX"
  406. const m_LT_OBJDIR = ".libs/"
  407. const m_L_INCR = 1
  408. const m_L_SET = 0
  409. const m_L_XTND = 2
  410. const m_L_ctermid = 20
  411. const m_L_cuserid = 20
  412. const m_L_tmpnam = 20
  413. const m_MATH_ERREXCEPT = 2
  414. const m_MATH_ERRNO = 1
  415. const m_MAX_HANDLE_SZ = 128
  416. const m_MB_LEN_MAX = 4
  417. const m_MQ_PRIO_MAX = 32768
  418. const m_M_1_PI = 0.31830988618379067154
  419. const m_M_2_PI = 0.63661977236758134308
  420. const m_M_2_SQRTPI = 1.12837916709551257390
  421. const m_M_E = 2.7182818284590452354
  422. const m_M_LN10 = 2.30258509299404568402
  423. const m_M_LN2 = 0.69314718055994530942
  424. const m_M_LOG10E = 0.43429448190325182765
  425. const m_M_LOG2E = 1.4426950408889634074
  426. const m_M_PI = 3.14159265358979323846
  427. const m_M_PI_2 = 1.57079632679489661923
  428. const m_M_PI_4 = 0.78539816339744830962
  429. const m_M_SQRT1_2 = 0.70710678118654752440
  430. const m_M_SQRT2 = 1.41421356237309504880
  431. const m_NAME_MAX = 255
  432. const m_NDEBUG = 1
  433. const m_NGROUPS_MAX = 32
  434. const m_NL_ARGMAX = 9
  435. const m_NL_LANGMAX = 32
  436. const m_NL_MSGMAX = 32767
  437. const m_NL_NMAX = 16
  438. const m_NL_SETMAX = 255
  439. const m_NL_TEXTMAX = 2048
  440. const m_NZERO = 20
  441. const m_O_APPEND = 02000
  442. const m_O_ASYNC = 020000
  443. const m_O_CLOEXEC = 02000000
  444. const m_O_CREAT = 0100
  445. const m_O_DIRECT = 040000
  446. const m_O_DIRECTORY = 0200000
  447. const m_O_DSYNC = 010000
  448. const m_O_EXCL = 0200
  449. const m_O_EXEC = "O_PATH"
  450. const m_O_LARGEFILE = 0100000
  451. const m_O_NDELAY = "O_NONBLOCK"
  452. const m_O_NOATIME = 01000000
  453. const m_O_NOCTTY = 0400
  454. const m_O_NOFOLLOW = 0400000
  455. const m_O_NONBLOCK = 04000
  456. const m_O_PATH = 010000000
  457. const m_O_RDONLY = 00
  458. const m_O_RDWR = 02
  459. const m_O_RSYNC = 04010000
  460. const m_O_SEARCH = "O_PATH"
  461. const m_O_SYNC = 04010000
  462. const m_O_TMPFILE = 020200000
  463. const m_O_TRUNC = 01000
  464. const m_O_TTY_INIT = 0
  465. const m_O_WRONLY = 01
  466. const m_PACKAGE = "expat"
  467. const m_PACKAGE_BUGREPORT = "expat-bugs@libexpat.org"
  468. const m_PACKAGE_NAME = "expat"
  469. const m_PACKAGE_STRING = "expat 2.5.0"
  470. const m_PACKAGE_TARNAME = "expat"
  471. const m_PACKAGE_URL = ""
  472. const m_PACKAGE_VERSION = "2.5.0"
  473. const m_PAGESIZE = 4096
  474. const m_PAGE_SIZE = "PAGESIZE"
  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___ATOMIC_ACQUIRE = 2
  945. const m___ATOMIC_ACQ_REL = 4
  946. const m___ATOMIC_CONSUME = 1
  947. const m___ATOMIC_HLE_ACQUIRE = 65536
  948. const m___ATOMIC_HLE_RELEASE = 131072
  949. const m___ATOMIC_RELAXED = 0
  950. const m___ATOMIC_RELEASE = 3
  951. const m___ATOMIC_SEQ_CST = 5
  952. const m___BIGGEST_ALIGNMENT__ = 16
  953. const m___BIG_ENDIAN = 4321
  954. const m___BYTE_ORDER = 1234
  955. const m___BYTE_ORDER__ = "__ORDER_LITTLE_ENDIAN__"
  956. const m___CCGO__ = 1
  957. const m___CHAR_BIT__ = 8
  958. const m___DBL_DECIMAL_DIG__ = 17
  959. const m___DBL_DIG__ = 15
  960. const m___DBL_HAS_DENORM__ = 1
  961. const m___DBL_HAS_INFINITY__ = 1
  962. const m___DBL_HAS_QUIET_NAN__ = 1
  963. const m___DBL_IS_IEC_60559__ = 2
  964. const m___DBL_MANT_DIG__ = 53
  965. const m___DBL_MAX_10_EXP__ = 308
  966. const m___DBL_MAX_EXP__ = 1024
  967. const m___DEC128_EPSILON__ = 1e-33
  968. const m___DEC128_MANT_DIG__ = 34
  969. const m___DEC128_MAX_EXP__ = 6145
  970. const m___DEC128_MAX__ = "9.999999999999999999999999999999999E6144"
  971. const m___DEC128_MIN__ = 1e-6143
  972. const m___DEC128_SUBNORMAL_MIN__ = 0.000000000000000000000000000000001e-6143
  973. const m___DEC32_EPSILON__ = 1e-6
  974. const m___DEC32_MANT_DIG__ = 7
  975. const m___DEC32_MAX_EXP__ = 97
  976. const m___DEC32_MAX__ = 9.999999e96
  977. const m___DEC32_MIN__ = 1e-95
  978. const m___DEC32_SUBNORMAL_MIN__ = 0.000001e-95
  979. const m___DEC64_EPSILON__ = 1e-15
  980. const m___DEC64_MANT_DIG__ = 16
  981. const m___DEC64_MAX_EXP__ = 385
  982. const m___DEC64_MAX__ = "9.999999999999999E384"
  983. const m___DEC64_MIN__ = 1e-383
  984. const m___DEC64_SUBNORMAL_MIN__ = 0.000000000000001e-383
  985. const m___DECIMAL_BID_FORMAT__ = 1
  986. const m___DECIMAL_DIG__ = 17
  987. const m___DEC_EVAL_METHOD__ = 2
  988. const m___ELF__ = 1
  989. const m___FINITE_MATH_ONLY__ = 0
  990. const m___FLOAT_WORD_ORDER__ = "__ORDER_LITTLE_ENDIAN__"
  991. const m___FLT128_DECIMAL_DIG__ = 36
  992. const m___FLT128_DENORM_MIN__ = 6.47517511943802511092443895822764655e-4966
  993. const m___FLT128_DIG__ = 33
  994. const m___FLT128_EPSILON__ = 1.92592994438723585305597794258492732e-34
  995. const m___FLT128_HAS_DENORM__ = 1
  996. const m___FLT128_HAS_INFINITY__ = 1
  997. const m___FLT128_HAS_QUIET_NAN__ = 1
  998. const m___FLT128_IS_IEC_60559__ = 2
  999. const m___FLT128_MANT_DIG__ = 113
  1000. const m___FLT128_MAX_10_EXP__ = 4932
  1001. const m___FLT128_MAX_EXP__ = 16384
  1002. const m___FLT128_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1003. const m___FLT128_MIN__ = 3.36210314311209350626267781732175260e-4932
  1004. const m___FLT128_NORM_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1005. const m___FLT16_DECIMAL_DIG__ = 5
  1006. const m___FLT16_DENORM_MIN__ = 5.96046447753906250000000000000000000e-8
  1007. const m___FLT16_DIG__ = 3
  1008. const m___FLT16_EPSILON__ = 9.76562500000000000000000000000000000e-4
  1009. const m___FLT16_HAS_DENORM__ = 1
  1010. const m___FLT16_HAS_INFINITY__ = 1
  1011. const m___FLT16_HAS_QUIET_NAN__ = 1
  1012. const m___FLT16_IS_IEC_60559__ = 2
  1013. const m___FLT16_MANT_DIG__ = 11
  1014. const m___FLT16_MAX_10_EXP__ = 4
  1015. const m___FLT16_MAX_EXP__ = 16
  1016. const m___FLT16_MAX__ = 6.55040000000000000000000000000000000e+4
  1017. const m___FLT16_MIN__ = 6.10351562500000000000000000000000000e-5
  1018. const m___FLT16_NORM_MAX__ = 6.55040000000000000000000000000000000e+4
  1019. const m___FLT32X_DECIMAL_DIG__ = 17
  1020. const m___FLT32X_DENORM_MIN__ = 4.94065645841246544176568792868221372e-324
  1021. const m___FLT32X_DIG__ = 15
  1022. const m___FLT32X_EPSILON__ = 2.22044604925031308084726333618164062e-16
  1023. const m___FLT32X_HAS_DENORM__ = 1
  1024. const m___FLT32X_HAS_INFINITY__ = 1
  1025. const m___FLT32X_HAS_QUIET_NAN__ = 1
  1026. const m___FLT32X_IS_IEC_60559__ = 2
  1027. const m___FLT32X_MANT_DIG__ = 53
  1028. const m___FLT32X_MAX_10_EXP__ = 308
  1029. const m___FLT32X_MAX_EXP__ = 1024
  1030. const m___FLT32X_MAX__ = 1.79769313486231570814527423731704357e+308
  1031. const m___FLT32X_MIN__ = 2.22507385850720138309023271733240406e-308
  1032. const m___FLT32X_NORM_MAX__ = 1.79769313486231570814527423731704357e+308
  1033. const m___FLT32_DECIMAL_DIG__ = 9
  1034. const m___FLT32_DENORM_MIN__ = 1.40129846432481707092372958328991613e-45
  1035. const m___FLT32_DIG__ = 6
  1036. const m___FLT32_EPSILON__ = 1.19209289550781250000000000000000000e-7
  1037. const m___FLT32_HAS_DENORM__ = 1
  1038. const m___FLT32_HAS_INFINITY__ = 1
  1039. const m___FLT32_HAS_QUIET_NAN__ = 1
  1040. const m___FLT32_IS_IEC_60559__ = 2
  1041. const m___FLT32_MANT_DIG__ = 24
  1042. const m___FLT32_MAX_10_EXP__ = 38
  1043. const m___FLT32_MAX_EXP__ = 128
  1044. const m___FLT32_MAX__ = 3.40282346638528859811704183484516925e+38
  1045. const m___FLT32_MIN__ = 1.17549435082228750796873653722224568e-38
  1046. const m___FLT32_NORM_MAX__ = 3.40282346638528859811704183484516925e+38
  1047. const m___FLT64X_DECIMAL_DIG__ = 36
  1048. const m___FLT64X_DENORM_MIN__ = 6.47517511943802511092443895822764655e-4966
  1049. const m___FLT64X_DIG__ = 33
  1050. const m___FLT64X_EPSILON__ = 1.92592994438723585305597794258492732e-34
  1051. const m___FLT64X_HAS_DENORM__ = 1
  1052. const m___FLT64X_HAS_INFINITY__ = 1
  1053. const m___FLT64X_HAS_QUIET_NAN__ = 1
  1054. const m___FLT64X_IS_IEC_60559__ = 2
  1055. const m___FLT64X_MANT_DIG__ = 113
  1056. const m___FLT64X_MAX_10_EXP__ = 4932
  1057. const m___FLT64X_MAX_EXP__ = 16384
  1058. const m___FLT64X_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1059. const m___FLT64X_MIN__ = 3.36210314311209350626267781732175260e-4932
  1060. const m___FLT64X_NORM_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1061. const m___FLT64_DECIMAL_DIG__ = 17
  1062. const m___FLT64_DENORM_MIN__ = 4.94065645841246544176568792868221372e-324
  1063. const m___FLT64_DIG__ = 15
  1064. const m___FLT64_EPSILON__ = 2.22044604925031308084726333618164062e-16
  1065. const m___FLT64_HAS_DENORM__ = 1
  1066. const m___FLT64_HAS_INFINITY__ = 1
  1067. const m___FLT64_HAS_QUIET_NAN__ = 1
  1068. const m___FLT64_IS_IEC_60559__ = 2
  1069. const m___FLT64_MANT_DIG__ = 53
  1070. const m___FLT64_MAX_10_EXP__ = 308
  1071. const m___FLT64_MAX_EXP__ = 1024
  1072. const m___FLT64_MAX__ = 1.79769313486231570814527423731704357e+308
  1073. const m___FLT64_MIN__ = 2.22507385850720138309023271733240406e-308
  1074. const m___FLT64_NORM_MAX__ = 1.79769313486231570814527423731704357e+308
  1075. const m___FLT_DECIMAL_DIG__ = 9
  1076. const m___FLT_DENORM_MIN__ = 1.40129846432481707092372958328991613e-45
  1077. const m___FLT_DIG__ = 6
  1078. const m___FLT_EPSILON__ = 1.19209289550781250000000000000000000e-7
  1079. const m___FLT_EVAL_METHOD_TS_18661_3__ = 0
  1080. const m___FLT_EVAL_METHOD__ = 0
  1081. const m___FLT_HAS_DENORM__ = 1
  1082. const m___FLT_HAS_INFINITY__ = 1
  1083. const m___FLT_HAS_QUIET_NAN__ = 1
  1084. const m___FLT_IS_IEC_60559__ = 2
  1085. const m___FLT_MANT_DIG__ = 24
  1086. const m___FLT_MAX_10_EXP__ = 38
  1087. const m___FLT_MAX_EXP__ = 128
  1088. const m___FLT_MAX__ = 3.40282346638528859811704183484516925e+38
  1089. const m___FLT_MIN__ = 1.17549435082228750796873653722224568e-38
  1090. const m___FLT_NORM_MAX__ = 3.40282346638528859811704183484516925e+38
  1091. const m___FLT_RADIX__ = 2
  1092. const m___FUNCTION__ = "__func__"
  1093. const m___FXSR__ = 1
  1094. const m___GCC_ASM_FLAG_OUTPUTS__ = 1
  1095. const m___GCC_ATOMIC_BOOL_LOCK_FREE = 2
  1096. const m___GCC_ATOMIC_CHAR16_T_LOCK_FREE = 2
  1097. const m___GCC_ATOMIC_CHAR32_T_LOCK_FREE = 2
  1098. const m___GCC_ATOMIC_CHAR_LOCK_FREE = 2
  1099. const m___GCC_ATOMIC_INT_LOCK_FREE = 2
  1100. const m___GCC_ATOMIC_LLONG_LOCK_FREE = 2
  1101. const m___GCC_ATOMIC_LONG_LOCK_FREE = 2
  1102. const m___GCC_ATOMIC_POINTER_LOCK_FREE = 2
  1103. const m___GCC_ATOMIC_SHORT_LOCK_FREE = 2
  1104. const m___GCC_ATOMIC_TEST_AND_SET_TRUEVAL = 1
  1105. const m___GCC_ATOMIC_WCHAR_T_LOCK_FREE = 2
  1106. const m___GCC_CONSTRUCTIVE_SIZE = 64
  1107. const m___GCC_DESTRUCTIVE_SIZE = 64
  1108. const m___GCC_HAVE_DWARF2_CFI_ASM = 1
  1109. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 = 1
  1110. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 = 1
  1111. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 = 1
  1112. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 = 1
  1113. const m___GCC_IEC_559 = 2
  1114. const m___GCC_IEC_559_COMPLEX = 2
  1115. const m___GNUC_EXECUTION_CHARSET_NAME = "UTF-8"
  1116. const m___GNUC_MINOR__ = 2
  1117. const m___GNUC_PATCHLEVEL__ = 0
  1118. const m___GNUC_STDC_INLINE__ = 1
  1119. const m___GNUC_WIDE_EXECUTION_CHARSET_NAME = "UTF-32LE"
  1120. const m___GNUC__ = 12
  1121. const m___GXX_ABI_VERSION = 1017
  1122. const m___HAVE_SPECULATION_SAFE_VALUE = 1
  1123. const m___INT16_MAX__ = 0x7fff
  1124. const m___INT32_MAX__ = 0x7fffffff
  1125. const m___INT32_TYPE__ = "int"
  1126. const m___INT64_MAX__ = 0x7fffffffffffffff
  1127. const m___INT8_MAX__ = 0x7f
  1128. const m___INTMAX_MAX__ = 0x7fffffffffffffff
  1129. const m___INTMAX_WIDTH__ = 64
  1130. const m___INTPTR_MAX__ = 0x7fffffffffffffff
  1131. const m___INTPTR_WIDTH__ = 64
  1132. const m___INT_FAST16_MAX__ = 0x7fffffffffffffff
  1133. const m___INT_FAST16_WIDTH__ = 64
  1134. const m___INT_FAST32_MAX__ = 0x7fffffffffffffff
  1135. const m___INT_FAST32_WIDTH__ = 64
  1136. const m___INT_FAST64_MAX__ = 0x7fffffffffffffff
  1137. const m___INT_FAST64_WIDTH__ = 64
  1138. const m___INT_FAST8_MAX__ = 0x7f
  1139. const m___INT_FAST8_WIDTH__ = 8
  1140. const m___INT_LEAST16_MAX__ = 0x7fff
  1141. const m___INT_LEAST16_WIDTH__ = 16
  1142. const m___INT_LEAST32_MAX__ = 0x7fffffff
  1143. const m___INT_LEAST32_TYPE__ = "int"
  1144. const m___INT_LEAST32_WIDTH__ = 32
  1145. const m___INT_LEAST64_MAX__ = 0x7fffffffffffffff
  1146. const m___INT_LEAST64_WIDTH__ = 64
  1147. const m___INT_LEAST8_MAX__ = 0x7f
  1148. const m___INT_LEAST8_WIDTH__ = 8
  1149. const m___INT_MAX__ = 0x7fffffff
  1150. const m___INT_WIDTH__ = 32
  1151. const m___LDBL_DECIMAL_DIG__ = 17
  1152. const m___LDBL_DENORM_MIN__ = 4.94065645841246544176568792868221372e-324
  1153. const m___LDBL_DIG__ = 15
  1154. const m___LDBL_EPSILON__ = 2.22044604925031308084726333618164062e-16
  1155. const m___LDBL_HAS_DENORM__ = 1
  1156. const m___LDBL_HAS_INFINITY__ = 1
  1157. const m___LDBL_HAS_QUIET_NAN__ = 1
  1158. const m___LDBL_IS_IEC_60559__ = 2
  1159. const m___LDBL_MANT_DIG__ = 53
  1160. const m___LDBL_MAX_10_EXP__ = 308
  1161. const m___LDBL_MAX_EXP__ = 1024
  1162. const m___LDBL_MAX__ = 1.79769313486231570814527423731704357e+308
  1163. const m___LDBL_MIN__ = 2.22507385850720138309023271733240406e-308
  1164. const m___LDBL_NORM_MAX__ = 1.79769313486231570814527423731704357e+308
  1165. const m___LITTLE_ENDIAN = 1234
  1166. const m___LONG_DOUBLE_64__ = 1
  1167. const m___LONG_LONG_MAX__ = 0x7fffffffffffffff
  1168. const m___LONG_LONG_WIDTH__ = 64
  1169. const m___LONG_MAX = 0x7fffffffffffffff
  1170. const m___LONG_MAX__ = 0x7fffffffffffffff
  1171. const m___LONG_WIDTH__ = 64
  1172. const m___LP64__ = 1
  1173. const m___MMX_WITH_SSE__ = 1
  1174. const m___MMX__ = 1
  1175. const m___NO_INLINE__ = 1
  1176. const m___ORDER_BIG_ENDIAN__ = 4321
  1177. const m___ORDER_LITTLE_ENDIAN__ = 1234
  1178. const m___ORDER_PDP_ENDIAN__ = 3412
  1179. const m___PDP_ENDIAN = 3412
  1180. const m___PIC__ = 2
  1181. const m___PIE__ = 2
  1182. const m___PRAGMA_REDEFINE_EXTNAME = 1
  1183. const m___PRETTY_FUNCTION__ = "__func__"
  1184. const m___PTRDIFF_MAX__ = 0x7fffffffffffffff
  1185. const m___PTRDIFF_WIDTH__ = 64
  1186. const m___SCHAR_MAX__ = 0x7f
  1187. const m___SCHAR_WIDTH__ = 8
  1188. const m___SEG_FS = 1
  1189. const m___SEG_GS = 1
  1190. const m___SHRT_MAX__ = 0x7fff
  1191. const m___SHRT_WIDTH__ = 16
  1192. const m___SIG_ATOMIC_MAX__ = 0x7fffffff
  1193. const m___SIG_ATOMIC_TYPE__ = "int"
  1194. const m___SIG_ATOMIC_WIDTH__ = 32
  1195. const m___SIZEOF_DOUBLE__ = 8
  1196. const m___SIZEOF_FLOAT128__ = 16
  1197. const m___SIZEOF_FLOAT80__ = 16
  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___SSE2_MATH__ = 1
  1213. const m___SSE2__ = 1
  1214. const m___SSE_MATH__ = 1
  1215. const m___SSE__ = 1
  1216. const m___STDC_HOSTED__ = 1
  1217. const m___STDC_IEC_559_COMPLEX__ = 1
  1218. const m___STDC_IEC_559__ = 1
  1219. const m___STDC_IEC_60559_BFP__ = 201404
  1220. const m___STDC_IEC_60559_COMPLEX__ = 201404
  1221. const m___STDC_ISO_10646__ = 201706
  1222. const m___STDC_UTF_16__ = 1
  1223. const m___STDC_UTF_32__ = 1
  1224. const m___STDC_VERSION__ = 201710
  1225. const m___STDC__ = 1
  1226. const m___UINT16_MAX__ = 0xffff
  1227. const m___UINT32_MAX__ = 0xffffffff
  1228. const m___UINT64_MAX__ = 0xffffffffffffffff
  1229. const m___UINT8_MAX__ = 0xff
  1230. const m___UINTMAX_MAX__ = 0xffffffffffffffff
  1231. const m___UINTPTR_MAX__ = 0xffffffffffffffff
  1232. const m___UINT_FAST16_MAX__ = 0xffffffffffffffff
  1233. const m___UINT_FAST32_MAX__ = 0xffffffffffffffff
  1234. const m___UINT_FAST64_MAX__ = 0xffffffffffffffff
  1235. const m___UINT_FAST8_MAX__ = 0xff
  1236. const m___UINT_LEAST16_MAX__ = 0xffff
  1237. const m___UINT_LEAST32_MAX__ = 0xffffffff
  1238. const m___UINT_LEAST64_MAX__ = 0xffffffffffffffff
  1239. const m___UINT_LEAST8_MAX__ = 0xff
  1240. const m___USE_TIME_BITS64 = 1
  1241. const m___VERSION__ = "12.2.0"
  1242. const m___WCHAR_MAX__ = 0x7fffffff
  1243. const m___WCHAR_TYPE__ = "int"
  1244. const m___WCHAR_WIDTH__ = 32
  1245. const m___WINT_MAX__ = 0xffffffff
  1246. const m___WINT_MIN__ = 0
  1247. const m___WINT_WIDTH__ = 32
  1248. const m___amd64 = 1
  1249. const m___amd64__ = 1
  1250. const m___code_model_small__ = 1
  1251. const m___gnu_linux__ = 1
  1252. const m___inline = "inline"
  1253. const m___k8 = 1
  1254. const m___k8__ = 1
  1255. const m___linux = 1
  1256. const m___linux__ = 1
  1257. const m___pic__ = 2
  1258. const m___pie__ = 2
  1259. const m___restrict = "restrict"
  1260. const m___restrict_arr = "restrict"
  1261. const m___unix = 1
  1262. const m___unix__ = 1
  1263. const m___x86_64 = 1
  1264. const m___x86_64__ = 1
  1265. const m_alloca = "__builtin_alloca"
  1266. const m_inline = "__inline"
  1267. const m_linux = 1
  1268. const m_loff_t = "off_t"
  1269. const m_math_errhandling = 2
  1270. const m_static_assert = "_Static_assert"
  1271. const m_unix = 1
  1272. type t__builtin_va_list = uintptr
  1273. type t__predefined_size_t = uint64
  1274. type t__predefined_wchar_t = int32
  1275. type t__predefined_ptrdiff_t = int64
  1276. type Twchar_t = int32
  1277. type Tmax_align_t = struct {
  1278. F__ll int64
  1279. F__ld float64
  1280. }
  1281. type Tsize_t = uint64
  1282. type Tptrdiff_t = int64
  1283. type Tlocale_t = uintptr
  1284. type Tssize_t = int64
  1285. type Toff_t = int64
  1286. type Tva_list = uintptr
  1287. type t__isoc_va_list = uintptr
  1288. type Tfpos_t = struct {
  1289. F__lldata [0]int64
  1290. F__align [0]float64
  1291. F__opaque [16]int8
  1292. }
  1293. type T_G_fpos64_t = Tfpos_t
  1294. type Tcookie_io_functions_t = struct {
  1295. Fread uintptr
  1296. Fwrite uintptr
  1297. Fseek uintptr
  1298. Fclose1 uintptr
  1299. }
  1300. type T_IO_cookie_io_functions_t = Tcookie_io_functions_t
  1301. type Tdiv_t = struct {
  1302. Fquot int32
  1303. Frem int32
  1304. }
  1305. type Tldiv_t = struct {
  1306. Fquot int64
  1307. Frem int64
  1308. }
  1309. type Tlldiv_t = struct {
  1310. Fquot int64
  1311. Frem int64
  1312. }
  1313. type Tuintptr_t = uint64
  1314. type Tintptr_t = int64
  1315. type Tint8_t = int8
  1316. type Tint16_t = int16
  1317. type Tint32_t = int32
  1318. type Tint64_t = int64
  1319. type Tintmax_t = int64
  1320. type Tuint8_t = uint8
  1321. type Tuint16_t = uint16
  1322. type Tuint32_t = uint32
  1323. type Tuint64_t = uint64
  1324. type Tuintmax_t = uint64
  1325. type Tint_fast8_t = int8
  1326. type Tint_fast64_t = int64
  1327. type Tint_least8_t = int8
  1328. type Tint_least16_t = int16
  1329. type Tint_least32_t = int32
  1330. type Tint_least64_t = int64
  1331. type Tuint_fast8_t = uint8
  1332. type Tuint_fast64_t = uint64
  1333. type Tuint_least8_t = uint8
  1334. type Tuint_least16_t = uint16
  1335. type Tuint_least32_t = uint32
  1336. type Tuint_least64_t = uint64
  1337. type Tint_fast16_t = int32
  1338. type Tint_fast32_t = int32
  1339. type Tuint_fast16_t = uint32
  1340. type Tuint_fast32_t = uint32
  1341. type Tfloat_t = float32
  1342. type Tdouble_t = float64
  1343. type Ttime_t = int64
  1344. type Tsuseconds_t = int64
  1345. type Ttimeval = struct {
  1346. Ftv_sec Ttime_t
  1347. Ftv_usec Tsuseconds_t
  1348. }
  1349. type Ttimespec = struct {
  1350. Ftv_sec Ttime_t
  1351. Ftv_nsec int64
  1352. }
  1353. type Tsigset_t = struct {
  1354. F__bits [16]uint64
  1355. }
  1356. type t__sigset_t = Tsigset_t
  1357. type Tfd_mask = uint64
  1358. type Tfd_set = struct {
  1359. Ffds_bits [16]uint64
  1360. }
  1361. type Titimerval = struct {
  1362. Fit_interval Ttimeval
  1363. Fit_value Ttimeval
  1364. }
  1365. type Ttimezone = struct {
  1366. Ftz_minuteswest int32
  1367. Ftz_dsttime int32
  1368. }
  1369. type Tregister_t = int64
  1370. type Tu_int64_t = uint64
  1371. type Tmode_t = uint32
  1372. type Tnlink_t = uint64
  1373. type Tino_t = uint64
  1374. type Tdev_t = uint64
  1375. type Tblksize_t = int64
  1376. type Tblkcnt_t = int64
  1377. type Tfsblkcnt_t = uint64
  1378. type Tfsfilcnt_t = uint64
  1379. type Ttimer_t = uintptr
  1380. type Tclockid_t = int32
  1381. type Tclock_t = int64
  1382. type Tpid_t = int32
  1383. type Tid_t = uint32
  1384. type Tuid_t = uint32
  1385. type Tgid_t = uint32
  1386. type Tkey_t = int32
  1387. type Tuseconds_t = uint32
  1388. type Tpthread_t = uintptr
  1389. type Tpthread_once_t = int32
  1390. type Tpthread_key_t = uint32
  1391. type Tpthread_spinlock_t = int32
  1392. type Tpthread_mutexattr_t = struct {
  1393. F__attr uint32
  1394. }
  1395. type Tpthread_condattr_t = struct {
  1396. F__attr uint32
  1397. }
  1398. type Tpthread_barrierattr_t = struct {
  1399. F__attr uint32
  1400. }
  1401. type Tpthread_rwlockattr_t = struct {
  1402. F__attr [2]uint32
  1403. }
  1404. type Tpthread_attr_t = struct {
  1405. F__u struct {
  1406. F__vi [0][14]int32
  1407. F__s [0][7]uint64
  1408. F__i [14]int32
  1409. }
  1410. }
  1411. type Tpthread_mutex_t = struct {
  1412. F__u struct {
  1413. F__vi [0][10]int32
  1414. F__p [0][5]uintptr
  1415. F__i [10]int32
  1416. }
  1417. }
  1418. type Tpthread_cond_t = struct {
  1419. F__u struct {
  1420. F__vi [0][12]int32
  1421. F__p [0][6]uintptr
  1422. F__i [12]int32
  1423. }
  1424. }
  1425. type Tpthread_rwlock_t = struct {
  1426. F__u struct {
  1427. F__vi [0][14]int32
  1428. F__p [0][7]uintptr
  1429. F__i [14]int32
  1430. }
  1431. }
  1432. type Tpthread_barrier_t = struct {
  1433. F__u struct {
  1434. F__vi [0][8]int32
  1435. F__p [0][4]uintptr
  1436. F__i [8]int32
  1437. }
  1438. }
  1439. type Tu_int8_t = uint8
  1440. type Tu_int16_t = uint16
  1441. type Tu_int32_t = uint32
  1442. type Tcaddr_t = uintptr
  1443. type Tu_char = uint8
  1444. type Tu_short = uint16
  1445. type Tushort = uint16
  1446. type Tu_int = uint32
  1447. type Tuint = uint32
  1448. type Tu_long = uint64
  1449. type Tulong = uint64
  1450. type Tquad_t = int64
  1451. type Tu_quad_t = uint64
  1452. type Tiovec = struct {
  1453. Fiov_base uintptr
  1454. Fiov_len Tsize_t
  1455. }
  1456. type Tflock = struct {
  1457. Fl_type int16
  1458. Fl_whence int16
  1459. Fl_start Toff_t
  1460. Fl_len Toff_t
  1461. Fl_pid Tpid_t
  1462. }
  1463. type Tfile_handle = struct {
  1464. Fhandle_bytes uint32
  1465. Fhandle_type int32
  1466. }
  1467. type Tf_owner_ex = struct {
  1468. Ftype1 int32
  1469. Fpid Tpid_t
  1470. }
  1471. type TXML_Char = int8
  1472. type TXML_LChar = int8
  1473. type TXML_Index = int64
  1474. type TXML_Size = uint64
  1475. type TXML_ParserStruct = struct {
  1476. Fm_userData uintptr
  1477. Fm_handlerArg uintptr
  1478. Fm_buffer uintptr
  1479. Fm_mem TXML_Memory_Handling_Suite
  1480. Fm_bufferPtr uintptr
  1481. Fm_bufferEnd uintptr
  1482. Fm_bufferLim uintptr
  1483. Fm_parseEndByteIndex TXML_Index
  1484. Fm_parseEndPtr uintptr
  1485. Fm_dataBuf uintptr
  1486. Fm_dataBufEnd uintptr
  1487. Fm_startElementHandler TXML_StartElementHandler
  1488. Fm_endElementHandler TXML_EndElementHandler
  1489. Fm_characterDataHandler TXML_CharacterDataHandler
  1490. Fm_processingInstructionHandler TXML_ProcessingInstructionHandler
  1491. Fm_commentHandler TXML_CommentHandler
  1492. Fm_startCdataSectionHandler TXML_StartCdataSectionHandler
  1493. Fm_endCdataSectionHandler TXML_EndCdataSectionHandler
  1494. Fm_defaultHandler TXML_DefaultHandler
  1495. Fm_startDoctypeDeclHandler TXML_StartDoctypeDeclHandler
  1496. Fm_endDoctypeDeclHandler TXML_EndDoctypeDeclHandler
  1497. Fm_unparsedEntityDeclHandler TXML_UnparsedEntityDeclHandler
  1498. Fm_notationDeclHandler TXML_NotationDeclHandler
  1499. Fm_startNamespaceDeclHandler TXML_StartNamespaceDeclHandler
  1500. Fm_endNamespaceDeclHandler TXML_EndNamespaceDeclHandler
  1501. Fm_notStandaloneHandler TXML_NotStandaloneHandler
  1502. Fm_externalEntityRefHandler TXML_ExternalEntityRefHandler
  1503. Fm_externalEntityRefHandlerArg TXML_Parser
  1504. Fm_skippedEntityHandler TXML_SkippedEntityHandler
  1505. Fm_unknownEncodingHandler TXML_UnknownEncodingHandler
  1506. Fm_elementDeclHandler TXML_ElementDeclHandler
  1507. Fm_attlistDeclHandler TXML_AttlistDeclHandler
  1508. Fm_entityDeclHandler TXML_EntityDeclHandler
  1509. Fm_xmlDeclHandler TXML_XmlDeclHandler
  1510. Fm_encoding uintptr
  1511. Fm_initEncoding TINIT_ENCODING
  1512. Fm_internalEncoding uintptr
  1513. Fm_protocolEncodingName uintptr
  1514. Fm_ns TXML_Bool
  1515. Fm_ns_triplets TXML_Bool
  1516. Fm_unknownEncodingMem uintptr
  1517. Fm_unknownEncodingData uintptr
  1518. Fm_unknownEncodingHandlerData uintptr
  1519. Fm_unknownEncodingRelease uintptr
  1520. Fm_prologState TPROLOG_STATE
  1521. Fm_processor uintptr
  1522. Fm_errorCode _XML_Error
  1523. Fm_eventPtr uintptr
  1524. Fm_eventEndPtr uintptr
  1525. Fm_positionPtr uintptr
  1526. Fm_openInternalEntities uintptr
  1527. Fm_freeInternalEntities uintptr
  1528. Fm_defaultExpandInternalEntities TXML_Bool
  1529. Fm_tagLevel int32
  1530. Fm_declEntity uintptr
  1531. Fm_doctypeName uintptr
  1532. Fm_doctypeSysid uintptr
  1533. Fm_doctypePubid uintptr
  1534. Fm_declAttributeType uintptr
  1535. Fm_declNotationName uintptr
  1536. Fm_declNotationPublicId uintptr
  1537. Fm_declElementType uintptr
  1538. Fm_declAttributeId uintptr
  1539. Fm_declAttributeIsCdata TXML_Bool
  1540. Fm_declAttributeIsId TXML_Bool
  1541. Fm_dtd uintptr
  1542. Fm_curBase uintptr
  1543. Fm_tagStack uintptr
  1544. Fm_freeTagList uintptr
  1545. Fm_inheritedBindings uintptr
  1546. Fm_freeBindingList uintptr
  1547. Fm_attsSize int32
  1548. Fm_nSpecifiedAtts int32
  1549. Fm_idAttIndex int32
  1550. Fm_atts uintptr
  1551. Fm_nsAtts uintptr
  1552. Fm_nsAttsVersion uint64
  1553. Fm_nsAttsPower uint8
  1554. Fm_position TPOSITION
  1555. Fm_tempPool TSTRING_POOL
  1556. Fm_temp2Pool TSTRING_POOL
  1557. Fm_groupConnector uintptr
  1558. Fm_groupSize uint32
  1559. Fm_namespaceSeparator TXML_Char
  1560. Fm_parentParser TXML_Parser
  1561. Fm_parsingStatus TXML_ParsingStatus
  1562. Fm_isParamEntity TXML_Bool
  1563. Fm_useForeignDTD TXML_Bool
  1564. Fm_paramEntityParsing _XML_ParamEntityParsing
  1565. Fm_hash_secret_salt uint64
  1566. Fm_accounting TACCOUNTING
  1567. Fm_entity_stats TENTITY_STATS
  1568. }
  1569. type _XML_Error = int32
  1570. const _XML_ERROR_NONE = 0
  1571. const _XML_ERROR_NO_MEMORY = 1
  1572. const _XML_ERROR_SYNTAX = 2
  1573. const _XML_ERROR_NO_ELEMENTS = 3
  1574. const _XML_ERROR_INVALID_TOKEN = 4
  1575. const _XML_ERROR_UNCLOSED_TOKEN = 5
  1576. const _XML_ERROR_PARTIAL_CHAR = 6
  1577. const _XML_ERROR_TAG_MISMATCH = 7
  1578. const _XML_ERROR_DUPLICATE_ATTRIBUTE = 8
  1579. const _XML_ERROR_JUNK_AFTER_DOC_ELEMENT = 9
  1580. const _XML_ERROR_PARAM_ENTITY_REF = 10
  1581. const _XML_ERROR_UNDEFINED_ENTITY = 11
  1582. const _XML_ERROR_RECURSIVE_ENTITY_REF = 12
  1583. const _XML_ERROR_ASYNC_ENTITY = 13
  1584. const _XML_ERROR_BAD_CHAR_REF = 14
  1585. const _XML_ERROR_BINARY_ENTITY_REF = 15
  1586. const _XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF = 16
  1587. const _XML_ERROR_MISPLACED_XML_PI = 17
  1588. const _XML_ERROR_UNKNOWN_ENCODING = 18
  1589. const _XML_ERROR_INCORRECT_ENCODING = 19
  1590. const _XML_ERROR_UNCLOSED_CDATA_SECTION = 20
  1591. const _XML_ERROR_EXTERNAL_ENTITY_HANDLING = 21
  1592. const _XML_ERROR_NOT_STANDALONE = 22
  1593. const _XML_ERROR_UNEXPECTED_STATE = 23
  1594. const _XML_ERROR_ENTITY_DECLARED_IN_PE = 24
  1595. const _XML_ERROR_FEATURE_REQUIRES_XML_DTD = 25
  1596. const _XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING = 26
  1597. const _XML_ERROR_UNBOUND_PREFIX = 27
  1598. const _XML_ERROR_UNDECLARING_PREFIX = 28
  1599. const _XML_ERROR_INCOMPLETE_PE = 29
  1600. const _XML_ERROR_XML_DECL = 30
  1601. const _XML_ERROR_TEXT_DECL = 31
  1602. const _XML_ERROR_PUBLICID = 32
  1603. const _XML_ERROR_SUSPENDED = 33
  1604. const _XML_ERROR_NOT_SUSPENDED = 34
  1605. const _XML_ERROR_ABORTED = 35
  1606. const _XML_ERROR_FINISHED = 36
  1607. const _XML_ERROR_SUSPEND_PE = 37
  1608. const _XML_ERROR_RESERVED_PREFIX_XML = 38
  1609. const _XML_ERROR_RESERVED_PREFIX_XMLNS = 39
  1610. const _XML_ERROR_RESERVED_NAMESPACE_URI = 40
  1611. const _XML_ERROR_INVALID_ARGUMENT = 41
  1612. const _XML_ERROR_NO_BUFFER = 42
  1613. const _XML_ERROR_AMPLIFICATION_LIMIT_BREACH = 43
  1614. type _XML_ParamEntityParsing = int32
  1615. const _XML_PARAM_ENTITY_PARSING_NEVER = 0
  1616. const _XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE = 1
  1617. const _XML_PARAM_ENTITY_PARSING_ALWAYS = 2
  1618. type TXML_Parser = uintptr
  1619. type TXML_Bool = uint8
  1620. type _XML_Status = int32
  1621. const _XML_STATUS_ERROR = 0
  1622. const _XML_STATUS_OK = 1
  1623. const _XML_STATUS_SUSPENDED = 2
  1624. type _XML_Content_Type = int32
  1625. const _XML_CTYPE_EMPTY = 1
  1626. const _XML_CTYPE_ANY = 2
  1627. const _XML_CTYPE_MIXED = 3
  1628. const _XML_CTYPE_NAME = 4
  1629. const _XML_CTYPE_CHOICE = 5
  1630. const _XML_CTYPE_SEQ = 6
  1631. type _XML_Content_Quant = int32
  1632. const _XML_CQUANT_NONE = 0
  1633. const _XML_CQUANT_OPT = 1
  1634. const _XML_CQUANT_REP = 2
  1635. const _XML_CQUANT_PLUS = 3
  1636. type TXML_Content = struct {
  1637. Ftype1 _XML_Content_Type
  1638. Fquant _XML_Content_Quant
  1639. Fname uintptr
  1640. Fnumchildren uint32
  1641. Fchildren uintptr
  1642. }
  1643. type TXML_cp = TXML_Content
  1644. type TXML_ElementDeclHandler = uintptr
  1645. type TXML_AttlistDeclHandler = uintptr
  1646. type TXML_XmlDeclHandler = uintptr
  1647. type TXML_Memory_Handling_Suite = struct {
  1648. Fmalloc_fcn uintptr
  1649. Frealloc_fcn uintptr
  1650. Ffree_fcn uintptr
  1651. }
  1652. type TXML_StartElementHandler = uintptr
  1653. type TXML_EndElementHandler = uintptr
  1654. type TXML_CharacterDataHandler = uintptr
  1655. type TXML_ProcessingInstructionHandler = uintptr
  1656. type TXML_CommentHandler = uintptr
  1657. type TXML_StartCdataSectionHandler = uintptr
  1658. type TXML_EndCdataSectionHandler = uintptr
  1659. type TXML_DefaultHandler = uintptr
  1660. type TXML_StartDoctypeDeclHandler = uintptr
  1661. type TXML_EndDoctypeDeclHandler = uintptr
  1662. type TXML_EntityDeclHandler = uintptr
  1663. type TXML_UnparsedEntityDeclHandler = uintptr
  1664. type TXML_NotationDeclHandler = uintptr
  1665. type TXML_StartNamespaceDeclHandler = uintptr
  1666. type TXML_EndNamespaceDeclHandler = uintptr
  1667. type TXML_NotStandaloneHandler = uintptr
  1668. type TXML_ExternalEntityRefHandler = uintptr
  1669. type TXML_SkippedEntityHandler = uintptr
  1670. type TXML_Encoding = struct {
  1671. Fmap1 [256]int32
  1672. Fdata uintptr
  1673. Fconvert uintptr
  1674. Frelease uintptr
  1675. }
  1676. type TXML_UnknownEncodingHandler = uintptr
  1677. type _XML_Parsing = int32
  1678. const _XML_INITIALIZED = 0
  1679. const _XML_PARSING = 1
  1680. const _XML_FINISHED = 2
  1681. const _XML_SUSPENDED = 3
  1682. type TXML_ParsingStatus = struct {
  1683. Fparsing _XML_Parsing
  1684. FfinalBuffer TXML_Bool
  1685. }
  1686. type TXML_Expat_Version = struct {
  1687. Fmajor int32
  1688. Fminor int32
  1689. Fmicro int32
  1690. }
  1691. type _XML_FeatureEnum = int32
  1692. const _XML_FEATURE_END = 0
  1693. const _XML_FEATURE_UNICODE = 1
  1694. const _XML_FEATURE_UNICODE_WCHAR_T = 2
  1695. const _XML_FEATURE_DTD = 3
  1696. const _XML_FEATURE_CONTEXT_BYTES = 4
  1697. const _XML_FEATURE_MIN_SIZE = 5
  1698. const _XML_FEATURE_SIZEOF_XML_CHAR = 6
  1699. const _XML_FEATURE_SIZEOF_XML_LCHAR = 7
  1700. const _XML_FEATURE_NS = 8
  1701. const _XML_FEATURE_LARGE_SIZE = 9
  1702. const _XML_FEATURE_ATTR_INFO = 10
  1703. const _XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT = 11
  1704. const _XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT = 12
  1705. type TXML_Feature = struct {
  1706. Ffeature _XML_FeatureEnum
  1707. Fname uintptr
  1708. Fvalue int64
  1709. }
  1710. type Tsiphash = struct {
  1711. Fv0 Tuint64_t
  1712. Fv1 Tuint64_t
  1713. Fv2 Tuint64_t
  1714. Fv3 Tuint64_t
  1715. Fbuf [8]uint8
  1716. Fp uintptr
  1717. Fc Tuint64_t
  1718. }
  1719. type Tsipkey = struct {
  1720. Fk [2]Tuint64_t
  1721. }
  1722. func _sip_tokey(tls *libc.TLS, key uintptr, src uintptr) (r uintptr) {
  1723. *(*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)
  1724. *(*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)
  1725. return key
  1726. }
  1727. func _sip_round(tls *libc.TLS, H uintptr, rounds int32) {
  1728. var i int32
  1729. _ = i
  1730. i = 0
  1731. for {
  1732. if !(i < rounds) {
  1733. break
  1734. }
  1735. *(*Tuint64_t)(unsafe.Pointer(H)) += (*Tsiphash)(unsafe.Pointer(H)).Fv1
  1736. (*Tsiphash)(unsafe.Pointer(H)).Fv1 = (*Tsiphash)(unsafe.Pointer(H)).Fv1<<libc.Int32FromInt32(13) | (*Tsiphash)(unsafe.Pointer(H)).Fv1>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(13))
  1737. *(*Tuint64_t)(unsafe.Pointer(H + 8)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv0
  1738. (*Tsiphash)(unsafe.Pointer(H)).Fv0 = (*Tsiphash)(unsafe.Pointer(H)).Fv0<<libc.Int32FromInt32(32) | (*Tsiphash)(unsafe.Pointer(H)).Fv0>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(32))
  1739. *(*Tuint64_t)(unsafe.Pointer(H + 16)) += (*Tsiphash)(unsafe.Pointer(H)).Fv3
  1740. (*Tsiphash)(unsafe.Pointer(H)).Fv3 = (*Tsiphash)(unsafe.Pointer(H)).Fv3<<libc.Int32FromInt32(16) | (*Tsiphash)(unsafe.Pointer(H)).Fv3>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(16))
  1741. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv2
  1742. *(*Tuint64_t)(unsafe.Pointer(H)) += (*Tsiphash)(unsafe.Pointer(H)).Fv3
  1743. (*Tsiphash)(unsafe.Pointer(H)).Fv3 = (*Tsiphash)(unsafe.Pointer(H)).Fv3<<libc.Int32FromInt32(21) | (*Tsiphash)(unsafe.Pointer(H)).Fv3>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(21))
  1744. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv0
  1745. *(*Tuint64_t)(unsafe.Pointer(H + 16)) += (*Tsiphash)(unsafe.Pointer(H)).Fv1
  1746. (*Tsiphash)(unsafe.Pointer(H)).Fv1 = (*Tsiphash)(unsafe.Pointer(H)).Fv1<<libc.Int32FromInt32(17) | (*Tsiphash)(unsafe.Pointer(H)).Fv1>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(17))
  1747. *(*Tuint64_t)(unsafe.Pointer(H + 8)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv2
  1748. (*Tsiphash)(unsafe.Pointer(H)).Fv2 = (*Tsiphash)(unsafe.Pointer(H)).Fv2<<libc.Int32FromInt32(32) | (*Tsiphash)(unsafe.Pointer(H)).Fv2>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(32))
  1749. goto _1
  1750. _1:
  1751. ;
  1752. i++
  1753. }
  1754. }
  1755. func _sip24_init(tls *libc.TLS, H uintptr, key uintptr) (r uintptr) {
  1756. (*Tsiphash)(unsafe.Pointer(H)).Fv0 = libc.Uint64FromUint32(0x736f6d65)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x70736575)) ^ *(*Tuint64_t)(unsafe.Pointer(key))
  1757. (*Tsiphash)(unsafe.Pointer(H)).Fv1 = libc.Uint64FromUint32(0x646f7261)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x6e646f6d)) ^ *(*Tuint64_t)(unsafe.Pointer(key + 1*8))
  1758. (*Tsiphash)(unsafe.Pointer(H)).Fv2 = libc.Uint64FromUint32(0x6c796765)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x6e657261)) ^ *(*Tuint64_t)(unsafe.Pointer(key))
  1759. (*Tsiphash)(unsafe.Pointer(H)).Fv3 = libc.Uint64FromUint32(0x74656462)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x79746573)) ^ *(*Tuint64_t)(unsafe.Pointer(key + 1*8))
  1760. (*Tsiphash)(unsafe.Pointer(H)).Fp = H + 32
  1761. (*Tsiphash)(unsafe.Pointer(H)).Fc = uint64(0)
  1762. return H
  1763. }
  1764. func _sip24_update(tls *libc.TLS, H uintptr, src uintptr, len1 Tsize_t) (r uintptr) {
  1765. var m Tuint64_t
  1766. var p, pe, v1, v2, v3 uintptr
  1767. _, _, _, _, _, _ = m, p, pe, v1, v2, v3
  1768. p = src
  1769. pe = p + uintptr(len1)
  1770. for cond := true; cond; cond = p < pe {
  1771. for p < pe && (*Tsiphash)(unsafe.Pointer(H)).Fp < H+32+uintptr(libc.Uint64FromInt64(8)/libc.Uint64FromInt64(1)) {
  1772. v2 = H + 40
  1773. v1 = *(*uintptr)(unsafe.Pointer(v2))
  1774. *(*uintptr)(unsafe.Pointer(v2))++
  1775. v3 = p
  1776. p++
  1777. *(*uint8)(unsafe.Pointer(v1)) = *(*uint8)(unsafe.Pointer(v3))
  1778. }
  1779. if (*Tsiphash)(unsafe.Pointer(H)).Fp < H+32+uintptr(libc.Uint64FromInt64(8)/libc.Uint64FromInt64(1)) {
  1780. break
  1781. }
  1782. 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)
  1783. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= m
  1784. _sip_round(tls, H, int32(2))
  1785. *(*Tuint64_t)(unsafe.Pointer(H)) ^= m
  1786. (*Tsiphash)(unsafe.Pointer(H)).Fp = H + 32
  1787. *(*Tuint64_t)(unsafe.Pointer(H + 48)) += uint64(8)
  1788. }
  1789. return H
  1790. }
  1791. func _sip24_final(tls *libc.TLS, H uintptr) (r Tuint64_t) {
  1792. var b Tuint64_t
  1793. var left int8
  1794. _, _ = b, left
  1795. left = int8(int64((*Tsiphash)(unsafe.Pointer(H)).Fp) - t__predefined_ptrdiff_t(H+32))
  1796. b = ((*Tsiphash)(unsafe.Pointer(H)).Fc + libc.Uint64FromInt8(left)) << int32(56)
  1797. switch int32(left) {
  1798. case int32(7):
  1799. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 6))) << int32(48)
  1800. fallthrough
  1801. case int32(6):
  1802. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 5))) << int32(40)
  1803. fallthrough
  1804. case int32(5):
  1805. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 4))) << int32(32)
  1806. fallthrough
  1807. case int32(4):
  1808. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 3))) << int32(24)
  1809. fallthrough
  1810. case int32(3):
  1811. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 2))) << int32(16)
  1812. fallthrough
  1813. case int32(2):
  1814. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 1))) << int32(8)
  1815. fallthrough
  1816. case int32(1):
  1817. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32))) << 0
  1818. fallthrough
  1819. case 0:
  1820. break
  1821. }
  1822. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= b
  1823. _sip_round(tls, H, int32(2))
  1824. *(*Tuint64_t)(unsafe.Pointer(H)) ^= b
  1825. *(*Tuint64_t)(unsafe.Pointer(H + 16)) ^= uint64(0xff)
  1826. _sip_round(tls, H, int32(4))
  1827. return (*Tsiphash)(unsafe.Pointer(H)).Fv0 ^ (*Tsiphash)(unsafe.Pointer(H)).Fv1 ^ (*Tsiphash)(unsafe.Pointer(H)).Fv2 ^ (*Tsiphash)(unsafe.Pointer(H)).Fv3
  1828. }
  1829. func _siphash24(tls *libc.TLS, src uintptr, len1 Tsize_t, key uintptr) (r Tuint64_t) {
  1830. bp := tls.Alloc(64)
  1831. defer tls.Free(64)
  1832. var _ /* state at bp+0 */ Tsiphash
  1833. *(*Tsiphash)(unsafe.Pointer(bp)) = Tsiphash{}
  1834. return _sip24_final(tls, _sip24_update(tls, _sip24_init(tls, bp, key), src, len1))
  1835. }
  1836. func _sip24_valid(tls *libc.TLS) (r int32) {
  1837. bp := tls.Alloc(80)
  1838. defer tls.Free(80)
  1839. var i Tsize_t
  1840. var _ /* in at bp+0 */ [64]uint8
  1841. var _ /* k at bp+64 */ Tsipkey
  1842. _ = i
  1843. _sip_tokey(tls, bp+64, __ccgo_ts)
  1844. i = uint64(0)
  1845. for {
  1846. if !(i < uint64(64)) {
  1847. break
  1848. }
  1849. (*(*[64]uint8)(unsafe.Pointer(bp)))[i] = uint8(i)
  1850. 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) {
  1851. return 0
  1852. }
  1853. goto _1
  1854. _1:
  1855. ;
  1856. i++
  1857. }
  1858. return int32(1)
  1859. }
  1860. var _vectors = [64][8]uint8{
  1861. 0: {
  1862. 0: uint8(0x31),
  1863. 1: uint8(0x0e),
  1864. 2: uint8(0x0e),
  1865. 3: uint8(0xdd),
  1866. 4: uint8(0x47),
  1867. 5: uint8(0xdb),
  1868. 6: uint8(0x6f),
  1869. 7: uint8(0x72),
  1870. },
  1871. 1: {
  1872. 0: uint8(0xfd),
  1873. 1: uint8(0x67),
  1874. 2: uint8(0xdc),
  1875. 3: uint8(0x93),
  1876. 4: uint8(0xc5),
  1877. 5: uint8(0x39),
  1878. 6: uint8(0xf8),
  1879. 7: uint8(0x74),
  1880. },
  1881. 2: {
  1882. 0: uint8(0x5a),
  1883. 1: uint8(0x4f),
  1884. 2: uint8(0xa9),
  1885. 3: uint8(0xd9),
  1886. 4: uint8(0x09),
  1887. 5: uint8(0x80),
  1888. 6: uint8(0x6c),
  1889. 7: uint8(0x0d),
  1890. },
  1891. 3: {
  1892. 0: uint8(0x2d),
  1893. 1: uint8(0x7e),
  1894. 2: uint8(0xfb),
  1895. 3: uint8(0xd7),
  1896. 4: uint8(0x96),
  1897. 5: uint8(0x66),
  1898. 6: uint8(0x67),
  1899. 7: uint8(0x85),
  1900. },
  1901. 4: {
  1902. 0: uint8(0xb7),
  1903. 1: uint8(0x87),
  1904. 2: uint8(0x71),
  1905. 3: uint8(0x27),
  1906. 4: uint8(0xe0),
  1907. 5: uint8(0x94),
  1908. 6: uint8(0x27),
  1909. 7: uint8(0xcf),
  1910. },
  1911. 5: {
  1912. 0: uint8(0x8d),
  1913. 1: uint8(0xa6),
  1914. 2: uint8(0x99),
  1915. 3: uint8(0xcd),
  1916. 4: uint8(0x64),
  1917. 5: uint8(0x55),
  1918. 6: uint8(0x76),
  1919. 7: uint8(0x18),
  1920. },
  1921. 6: {
  1922. 0: uint8(0xce),
  1923. 1: uint8(0xe3),
  1924. 2: uint8(0xfe),
  1925. 3: uint8(0x58),
  1926. 4: uint8(0x6e),
  1927. 5: uint8(0x46),
  1928. 6: uint8(0xc9),
  1929. 7: uint8(0xcb),
  1930. },
  1931. 7: {
  1932. 0: uint8(0x37),
  1933. 1: uint8(0xd1),
  1934. 2: uint8(0x01),
  1935. 3: uint8(0x8b),
  1936. 4: uint8(0xf5),
  1937. 6: uint8(0x02),
  1938. 7: uint8(0xab),
  1939. },
  1940. 8: {
  1941. 0: uint8(0x62),
  1942. 1: uint8(0x24),
  1943. 2: uint8(0x93),
  1944. 3: uint8(0x9a),
  1945. 4: uint8(0x79),
  1946. 5: uint8(0xf5),
  1947. 6: uint8(0xf5),
  1948. 7: uint8(0x93),
  1949. },
  1950. 9: {
  1951. 0: uint8(0xb0),
  1952. 1: uint8(0xe4),
  1953. 2: uint8(0xa9),
  1954. 3: uint8(0x0b),
  1955. 4: uint8(0xdf),
  1956. 5: uint8(0x82),
  1957. 7: uint8(0x9e),
  1958. },
  1959. 10: {
  1960. 0: uint8(0xf3),
  1961. 1: uint8(0xb9),
  1962. 2: uint8(0xdd),
  1963. 3: uint8(0x94),
  1964. 4: uint8(0xc5),
  1965. 5: uint8(0xbb),
  1966. 6: uint8(0x5d),
  1967. 7: uint8(0x7a),
  1968. },
  1969. 11: {
  1970. 0: uint8(0xa7),
  1971. 1: uint8(0xad),
  1972. 2: uint8(0x6b),
  1973. 3: uint8(0x22),
  1974. 4: uint8(0x46),
  1975. 5: uint8(0x2f),
  1976. 6: uint8(0xb3),
  1977. 7: uint8(0xf4),
  1978. },
  1979. 12: {
  1980. 0: uint8(0xfb),
  1981. 1: uint8(0xe5),
  1982. 2: uint8(0x0e),
  1983. 3: uint8(0x86),
  1984. 4: uint8(0xbc),
  1985. 5: uint8(0x8f),
  1986. 6: uint8(0x1e),
  1987. 7: uint8(0x75),
  1988. },
  1989. 13: {
  1990. 0: uint8(0x90),
  1991. 1: uint8(0x3d),
  1992. 2: uint8(0x84),
  1993. 3: uint8(0xc0),
  1994. 4: uint8(0x27),
  1995. 5: uint8(0x56),
  1996. 6: uint8(0xea),
  1997. 7: uint8(0x14),
  1998. },
  1999. 14: {
  2000. 0: uint8(0xee),
  2001. 1: uint8(0xf2),
  2002. 2: uint8(0x7a),
  2003. 3: uint8(0x8e),
  2004. 4: uint8(0x90),
  2005. 5: uint8(0xca),
  2006. 6: uint8(0x23),
  2007. 7: uint8(0xf7),
  2008. },
  2009. 15: {
  2010. 0: uint8(0xe5),
  2011. 1: uint8(0x45),
  2012. 2: uint8(0xbe),
  2013. 3: uint8(0x49),
  2014. 4: uint8(0x61),
  2015. 5: uint8(0xca),
  2016. 6: uint8(0x29),
  2017. 7: uint8(0xa1),
  2018. },
  2019. 16: {
  2020. 0: uint8(0xdb),
  2021. 1: uint8(0x9b),
  2022. 2: uint8(0xc2),
  2023. 3: uint8(0x57),
  2024. 4: uint8(0x7f),
  2025. 5: uint8(0xcc),
  2026. 6: uint8(0x2a),
  2027. 7: uint8(0x3f),
  2028. },
  2029. 17: {
  2030. 0: uint8(0x94),
  2031. 1: uint8(0x47),
  2032. 2: uint8(0xbe),
  2033. 3: uint8(0x2c),
  2034. 4: uint8(0xf5),
  2035. 5: uint8(0xe9),
  2036. 6: uint8(0x9a),
  2037. 7: uint8(0x69),
  2038. },
  2039. 18: {
  2040. 0: uint8(0x9c),
  2041. 1: uint8(0xd3),
  2042. 2: uint8(0x8d),
  2043. 3: uint8(0x96),
  2044. 4: uint8(0xf0),
  2045. 5: uint8(0xb3),
  2046. 6: uint8(0xc1),
  2047. 7: uint8(0x4b),
  2048. },
  2049. 19: {
  2050. 0: uint8(0xbd),
  2051. 1: uint8(0x61),
  2052. 2: uint8(0x79),
  2053. 3: uint8(0xa7),
  2054. 4: uint8(0x1d),
  2055. 5: uint8(0xc9),
  2056. 6: uint8(0x6d),
  2057. 7: uint8(0xbb),
  2058. },
  2059. 20: {
  2060. 0: uint8(0x98),
  2061. 1: uint8(0xee),
  2062. 2: uint8(0xa2),
  2063. 3: uint8(0x1a),
  2064. 4: uint8(0xf2),
  2065. 5: uint8(0x5c),
  2066. 6: uint8(0xd6),
  2067. 7: uint8(0xbe),
  2068. },
  2069. 21: {
  2070. 0: uint8(0xc7),
  2071. 1: uint8(0x67),
  2072. 2: uint8(0x3b),
  2073. 3: uint8(0x2e),
  2074. 4: uint8(0xb0),
  2075. 5: uint8(0xcb),
  2076. 6: uint8(0xf2),
  2077. 7: uint8(0xd0),
  2078. },
  2079. 22: {
  2080. 0: uint8(0x88),
  2081. 1: uint8(0x3e),
  2082. 2: uint8(0xa3),
  2083. 3: uint8(0xe3),
  2084. 4: uint8(0x95),
  2085. 5: uint8(0x67),
  2086. 6: uint8(0x53),
  2087. 7: uint8(0x93),
  2088. },
  2089. 23: {
  2090. 0: uint8(0xc8),
  2091. 1: uint8(0xce),
  2092. 2: uint8(0x5c),
  2093. 3: uint8(0xcd),
  2094. 4: uint8(0x8c),
  2095. 5: uint8(0x03),
  2096. 6: uint8(0x0c),
  2097. 7: uint8(0xa8),
  2098. },
  2099. 24: {
  2100. 0: uint8(0x94),
  2101. 1: uint8(0xaf),
  2102. 2: uint8(0x49),
  2103. 3: uint8(0xf6),
  2104. 4: uint8(0xc6),
  2105. 5: uint8(0x50),
  2106. 6: uint8(0xad),
  2107. 7: uint8(0xb8),
  2108. },
  2109. 25: {
  2110. 0: uint8(0xea),
  2111. 1: uint8(0xb8),
  2112. 2: uint8(0x85),
  2113. 3: uint8(0x8a),
  2114. 4: uint8(0xde),
  2115. 5: uint8(0x92),
  2116. 6: uint8(0xe1),
  2117. 7: uint8(0xbc),
  2118. },
  2119. 26: {
  2120. 0: uint8(0xf3),
  2121. 1: uint8(0x15),
  2122. 2: uint8(0xbb),
  2123. 3: uint8(0x5b),
  2124. 4: uint8(0xb8),
  2125. 5: uint8(0x35),
  2126. 6: uint8(0xd8),
  2127. 7: uint8(0x17),
  2128. },
  2129. 27: {
  2130. 0: uint8(0xad),
  2131. 1: uint8(0xcf),
  2132. 2: uint8(0x6b),
  2133. 3: uint8(0x07),
  2134. 4: uint8(0x63),
  2135. 5: uint8(0x61),
  2136. 6: uint8(0x2e),
  2137. 7: uint8(0x2f),
  2138. },
  2139. 28: {
  2140. 0: uint8(0xa5),
  2141. 1: uint8(0xc9),
  2142. 2: uint8(0x1d),
  2143. 3: uint8(0xa7),
  2144. 4: uint8(0xac),
  2145. 5: uint8(0xaa),
  2146. 6: uint8(0x4d),
  2147. 7: uint8(0xde),
  2148. },
  2149. 29: {
  2150. 0: uint8(0x71),
  2151. 1: uint8(0x65),
  2152. 2: uint8(0x95),
  2153. 3: uint8(0x87),
  2154. 4: uint8(0x66),
  2155. 5: uint8(0x50),
  2156. 6: uint8(0xa2),
  2157. 7: uint8(0xa6),
  2158. },
  2159. 30: {
  2160. 0: uint8(0x28),
  2161. 1: uint8(0xef),
  2162. 2: uint8(0x49),
  2163. 3: uint8(0x5c),
  2164. 4: uint8(0x53),
  2165. 5: uint8(0xa3),
  2166. 6: uint8(0x87),
  2167. 7: uint8(0xad),
  2168. },
  2169. 31: {
  2170. 0: uint8(0x42),
  2171. 1: uint8(0xc3),
  2172. 2: uint8(0x41),
  2173. 3: uint8(0xd8),
  2174. 4: uint8(0xfa),
  2175. 5: uint8(0x92),
  2176. 6: uint8(0xd8),
  2177. 7: uint8(0x32),
  2178. },
  2179. 32: {
  2180. 0: uint8(0xce),
  2181. 1: uint8(0x7c),
  2182. 2: uint8(0xf2),
  2183. 3: uint8(0x72),
  2184. 4: uint8(0x2f),
  2185. 5: uint8(0x51),
  2186. 6: uint8(0x27),
  2187. 7: uint8(0x71),
  2188. },
  2189. 33: {
  2190. 0: uint8(0xe3),
  2191. 1: uint8(0x78),
  2192. 2: uint8(0x59),
  2193. 3: uint8(0xf9),
  2194. 4: uint8(0x46),
  2195. 5: uint8(0x23),
  2196. 6: uint8(0xf3),
  2197. 7: uint8(0xa7),
  2198. },
  2199. 34: {
  2200. 0: uint8(0x38),
  2201. 1: uint8(0x12),
  2202. 2: uint8(0x05),
  2203. 3: uint8(0xbb),
  2204. 4: uint8(0x1a),
  2205. 5: uint8(0xb0),
  2206. 6: uint8(0xe0),
  2207. 7: uint8(0x12),
  2208. },
  2209. 35: {
  2210. 0: uint8(0xae),
  2211. 1: uint8(0x97),
  2212. 2: uint8(0xa1),
  2213. 3: uint8(0x0f),
  2214. 4: uint8(0xd4),
  2215. 5: uint8(0x34),
  2216. 6: uint8(0xe0),
  2217. 7: uint8(0x15),
  2218. },
  2219. 36: {
  2220. 0: uint8(0xb4),
  2221. 1: uint8(0xa3),
  2222. 2: uint8(0x15),
  2223. 3: uint8(0x08),
  2224. 4: uint8(0xbe),
  2225. 5: uint8(0xff),
  2226. 6: uint8(0x4d),
  2227. 7: uint8(0x31),
  2228. },
  2229. 37: {
  2230. 0: uint8(0x81),
  2231. 1: uint8(0x39),
  2232. 2: uint8(0x62),
  2233. 3: uint8(0x29),
  2234. 4: uint8(0xf0),
  2235. 5: uint8(0x90),
  2236. 6: uint8(0x79),
  2237. 7: uint8(0x02),
  2238. },
  2239. 38: {
  2240. 0: uint8(0x4d),
  2241. 1: uint8(0x0c),
  2242. 2: uint8(0xf4),
  2243. 3: uint8(0x9e),
  2244. 4: uint8(0xe5),
  2245. 5: uint8(0xd4),
  2246. 6: uint8(0xdc),
  2247. 7: uint8(0xca),
  2248. },
  2249. 39: {
  2250. 0: uint8(0x5c),
  2251. 1: uint8(0x73),
  2252. 2: uint8(0x33),
  2253. 3: uint8(0x6a),
  2254. 4: uint8(0x76),
  2255. 5: uint8(0xd8),
  2256. 6: uint8(0xbf),
  2257. 7: uint8(0x9a),
  2258. },
  2259. 40: {
  2260. 0: uint8(0xd0),
  2261. 1: uint8(0xa7),
  2262. 2: uint8(0x04),
  2263. 3: uint8(0x53),
  2264. 4: uint8(0x6b),
  2265. 5: uint8(0xa9),
  2266. 6: uint8(0x3e),
  2267. 7: uint8(0x0e),
  2268. },
  2269. 41: {
  2270. 0: uint8(0x92),
  2271. 1: uint8(0x59),
  2272. 2: uint8(0x58),
  2273. 3: uint8(0xfc),
  2274. 4: uint8(0xd6),
  2275. 5: uint8(0x42),
  2276. 6: uint8(0x0c),
  2277. 7: uint8(0xad),
  2278. },
  2279. 42: {
  2280. 0: uint8(0xa9),
  2281. 1: uint8(0x15),
  2282. 2: uint8(0xc2),
  2283. 3: uint8(0x9b),
  2284. 4: uint8(0xc8),
  2285. 5: uint8(0x06),
  2286. 6: uint8(0x73),
  2287. 7: uint8(0x18),
  2288. },
  2289. 43: {
  2290. 0: uint8(0x95),
  2291. 1: uint8(0x2b),
  2292. 2: uint8(0x79),
  2293. 3: uint8(0xf3),
  2294. 4: uint8(0xbc),
  2295. 5: uint8(0x0a),
  2296. 6: uint8(0xa6),
  2297. 7: uint8(0xd4),
  2298. },
  2299. 44: {
  2300. 0: uint8(0xf2),
  2301. 1: uint8(0x1d),
  2302. 2: uint8(0xf2),
  2303. 3: uint8(0xe4),
  2304. 4: uint8(0x1d),
  2305. 5: uint8(0x45),
  2306. 6: uint8(0x35),
  2307. 7: uint8(0xf9),
  2308. },
  2309. 45: {
  2310. 0: uint8(0x87),
  2311. 1: uint8(0x57),
  2312. 2: uint8(0x75),
  2313. 3: uint8(0x19),
  2314. 4: uint8(0x04),
  2315. 5: uint8(0x8f),
  2316. 6: uint8(0x53),
  2317. 7: uint8(0xa9),
  2318. },
  2319. 46: {
  2320. 0: uint8(0x10),
  2321. 1: uint8(0xa5),
  2322. 2: uint8(0x6c),
  2323. 3: uint8(0xf5),
  2324. 4: uint8(0xdf),
  2325. 5: uint8(0xcd),
  2326. 6: uint8(0x9a),
  2327. 7: uint8(0xdb),
  2328. },
  2329. 47: {
  2330. 0: uint8(0xeb),
  2331. 1: uint8(0x75),
  2332. 2: uint8(0x09),
  2333. 3: uint8(0x5c),
  2334. 4: uint8(0xcd),
  2335. 5: uint8(0x98),
  2336. 6: uint8(0x6c),
  2337. 7: uint8(0xd0),
  2338. },
  2339. 48: {
  2340. 0: uint8(0x51),
  2341. 1: uint8(0xa9),
  2342. 2: uint8(0xcb),
  2343. 3: uint8(0x9e),
  2344. 4: uint8(0xcb),
  2345. 5: uint8(0xa3),
  2346. 6: uint8(0x12),
  2347. 7: uint8(0xe6),
  2348. },
  2349. 49: {
  2350. 0: uint8(0x96),
  2351. 1: uint8(0xaf),
  2352. 2: uint8(0xad),
  2353. 3: uint8(0xfc),
  2354. 4: uint8(0x2c),
  2355. 5: uint8(0xe6),
  2356. 6: uint8(0x66),
  2357. 7: uint8(0xc7),
  2358. },
  2359. 50: {
  2360. 0: uint8(0x72),
  2361. 1: uint8(0xfe),
  2362. 2: uint8(0x52),
  2363. 3: uint8(0x97),
  2364. 4: uint8(0x5a),
  2365. 5: uint8(0x43),
  2366. 6: uint8(0x64),
  2367. 7: uint8(0xee),
  2368. },
  2369. 51: {
  2370. 0: uint8(0x5a),
  2371. 1: uint8(0x16),
  2372. 2: uint8(0x45),
  2373. 3: uint8(0xb2),
  2374. 4: uint8(0x76),
  2375. 5: uint8(0xd5),
  2376. 6: uint8(0x92),
  2377. 7: uint8(0xa1),
  2378. },
  2379. 52: {
  2380. 0: uint8(0xb2),
  2381. 1: uint8(0x74),
  2382. 2: uint8(0xcb),
  2383. 3: uint8(0x8e),
  2384. 4: uint8(0xbf),
  2385. 5: uint8(0x87),
  2386. 6: uint8(0x87),
  2387. 7: uint8(0x0a),
  2388. },
  2389. 53: {
  2390. 0: uint8(0x6f),
  2391. 1: uint8(0x9b),
  2392. 2: uint8(0xb4),
  2393. 3: uint8(0x20),
  2394. 4: uint8(0x3d),
  2395. 5: uint8(0xe7),
  2396. 6: uint8(0xb3),
  2397. 7: uint8(0x81),
  2398. },
  2399. 54: {
  2400. 0: uint8(0xea),
  2401. 1: uint8(0xec),
  2402. 2: uint8(0xb2),
  2403. 3: uint8(0xa3),
  2404. 4: uint8(0x0b),
  2405. 5: uint8(0x22),
  2406. 6: uint8(0xa8),
  2407. 7: uint8(0x7f),
  2408. },
  2409. 55: {
  2410. 0: uint8(0x99),
  2411. 1: uint8(0x24),
  2412. 2: uint8(0xa4),
  2413. 3: uint8(0x3c),
  2414. 4: uint8(0xc1),
  2415. 5: uint8(0x31),
  2416. 6: uint8(0x57),
  2417. 7: uint8(0x24),
  2418. },
  2419. 56: {
  2420. 0: uint8(0xbd),
  2421. 1: uint8(0x83),
  2422. 2: uint8(0x8d),
  2423. 3: uint8(0x3a),
  2424. 4: uint8(0xaf),
  2425. 5: uint8(0xbf),
  2426. 6: uint8(0x8d),
  2427. 7: uint8(0xb7),
  2428. },
  2429. 57: {
  2430. 0: uint8(0x0b),
  2431. 1: uint8(0x1a),
  2432. 2: uint8(0x2a),
  2433. 3: uint8(0x32),
  2434. 4: uint8(0x65),
  2435. 5: uint8(0xd5),
  2436. 6: uint8(0x1a),
  2437. 7: uint8(0xea),
  2438. },
  2439. 58: {
  2440. 0: uint8(0x13),
  2441. 1: uint8(0x50),
  2442. 2: uint8(0x79),
  2443. 3: uint8(0xa3),
  2444. 4: uint8(0x23),
  2445. 5: uint8(0x1c),
  2446. 6: uint8(0xe6),
  2447. 7: uint8(0x60),
  2448. },
  2449. 59: {
  2450. 0: uint8(0x93),
  2451. 1: uint8(0x2b),
  2452. 2: uint8(0x28),
  2453. 3: uint8(0x46),
  2454. 4: uint8(0xe4),
  2455. 5: uint8(0xd7),
  2456. 6: uint8(0x06),
  2457. 7: uint8(0x66),
  2458. },
  2459. 60: {
  2460. 0: uint8(0xe1),
  2461. 1: uint8(0x91),
  2462. 2: uint8(0x5f),
  2463. 3: uint8(0x5c),
  2464. 4: uint8(0xb1),
  2465. 5: uint8(0xec),
  2466. 6: uint8(0xa4),
  2467. 7: uint8(0x6c),
  2468. },
  2469. 61: {
  2470. 0: uint8(0xf3),
  2471. 1: uint8(0x25),
  2472. 2: uint8(0x96),
  2473. 3: uint8(0x5c),
  2474. 4: uint8(0xa1),
  2475. 5: uint8(0x6d),
  2476. 6: uint8(0x62),
  2477. 7: uint8(0x9f),
  2478. },
  2479. 62: {
  2480. 0: uint8(0x57),
  2481. 1: uint8(0x5f),
  2482. 2: uint8(0xf2),
  2483. 3: uint8(0x8e),
  2484. 4: uint8(0x60),
  2485. 5: uint8(0x38),
  2486. 6: uint8(0x1b),
  2487. 7: uint8(0xe5),
  2488. },
  2489. 63: {
  2490. 0: uint8(0x72),
  2491. 1: uint8(0x45),
  2492. 2: uint8(0x06),
  2493. 3: uint8(0xeb),
  2494. 4: uint8(0x4c),
  2495. 5: uint8(0x32),
  2496. 6: uint8(0x8a),
  2497. 7: uint8(0x95),
  2498. },
  2499. }
  2500. type TICHAR = int8
  2501. type TPOSITION = struct {
  2502. FlineNumber TXML_Size
  2503. FcolumnNumber TXML_Size
  2504. }
  2505. type Tposition = TPOSITION
  2506. type TATTRIBUTE = struct {
  2507. Fname uintptr
  2508. FvaluePtr uintptr
  2509. FvalueEnd uintptr
  2510. Fnormalized int8
  2511. }
  2512. type Tencoding = struct {
  2513. Fscanners [4]TSCANNER
  2514. FliteralScanners [2]TSCANNER
  2515. FnameMatchesAscii uintptr
  2516. FnameLength uintptr
  2517. FskipS uintptr
  2518. FgetAtts uintptr
  2519. FcharRefNumber uintptr
  2520. FpredefinedEntityName uintptr
  2521. FupdatePosition uintptr
  2522. FisPublicId uintptr
  2523. Futf8Convert uintptr
  2524. Futf16Convert uintptr
  2525. FminBytesPerChar int32
  2526. FisUtf8 int8
  2527. FisUtf16 int8
  2528. }
  2529. type TENCODING = struct {
  2530. Fscanners [4]TSCANNER
  2531. FliteralScanners [2]TSCANNER
  2532. FnameMatchesAscii uintptr
  2533. FnameLength uintptr
  2534. FskipS uintptr
  2535. FgetAtts uintptr
  2536. FcharRefNumber uintptr
  2537. FpredefinedEntityName uintptr
  2538. FupdatePosition uintptr
  2539. FisPublicId uintptr
  2540. Futf8Convert uintptr
  2541. Futf16Convert uintptr
  2542. FminBytesPerChar int32
  2543. FisUtf8 int8
  2544. FisUtf16 int8
  2545. }
  2546. type TSCANNER = uintptr
  2547. type _XML_Convert_Result = int32
  2548. const _XML_CONVERT_COMPLETED = 0
  2549. const _XML_CONVERT_INPUT_INCOMPLETE = 1
  2550. const _XML_CONVERT_OUTPUT_EXHAUSTED = 2
  2551. type TINIT_ENCODING = struct {
  2552. FinitEnc TENCODING
  2553. FencPtr uintptr
  2554. }
  2555. type TCONVERTER = uintptr
  2556. const _XML_ROLE_ERROR = -1
  2557. const _XML_ROLE_NONE = 0
  2558. const _XML_ROLE_XML_DECL = 1
  2559. const _XML_ROLE_INSTANCE_START = 2
  2560. const _XML_ROLE_DOCTYPE_NONE = 3
  2561. const _XML_ROLE_DOCTYPE_NAME = 4
  2562. const _XML_ROLE_DOCTYPE_SYSTEM_ID = 5
  2563. const _XML_ROLE_DOCTYPE_PUBLIC_ID = 6
  2564. const _XML_ROLE_DOCTYPE_INTERNAL_SUBSET = 7
  2565. const _XML_ROLE_DOCTYPE_CLOSE = 8
  2566. const _XML_ROLE_GENERAL_ENTITY_NAME = 9
  2567. const _XML_ROLE_PARAM_ENTITY_NAME = 10
  2568. const _XML_ROLE_ENTITY_NONE = 11
  2569. const _XML_ROLE_ENTITY_VALUE = 12
  2570. const _XML_ROLE_ENTITY_SYSTEM_ID = 13
  2571. const _XML_ROLE_ENTITY_PUBLIC_ID = 14
  2572. const _XML_ROLE_ENTITY_COMPLETE = 15
  2573. const _XML_ROLE_ENTITY_NOTATION_NAME = 16
  2574. const _XML_ROLE_NOTATION_NONE = 17
  2575. const _XML_ROLE_NOTATION_NAME = 18
  2576. const _XML_ROLE_NOTATION_SYSTEM_ID = 19
  2577. const _XML_ROLE_NOTATION_NO_SYSTEM_ID = 20
  2578. const _XML_ROLE_NOTATION_PUBLIC_ID = 21
  2579. const _XML_ROLE_ATTRIBUTE_NAME = 22
  2580. const _XML_ROLE_ATTRIBUTE_TYPE_CDATA = 23
  2581. const _XML_ROLE_ATTRIBUTE_TYPE_ID = 24
  2582. const _XML_ROLE_ATTRIBUTE_TYPE_IDREF = 25
  2583. const _XML_ROLE_ATTRIBUTE_TYPE_IDREFS = 26
  2584. const _XML_ROLE_ATTRIBUTE_TYPE_ENTITY = 27
  2585. const _XML_ROLE_ATTRIBUTE_TYPE_ENTITIES = 28
  2586. const _XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN = 29
  2587. const _XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS = 30
  2588. const _XML_ROLE_ATTRIBUTE_ENUM_VALUE = 31
  2589. const _XML_ROLE_ATTRIBUTE_NOTATION_VALUE = 32
  2590. const _XML_ROLE_ATTLIST_NONE = 33
  2591. const _XML_ROLE_ATTLIST_ELEMENT_NAME = 34
  2592. const _XML_ROLE_IMPLIED_ATTRIBUTE_VALUE = 35
  2593. const _XML_ROLE_REQUIRED_ATTRIBUTE_VALUE = 36
  2594. const _XML_ROLE_DEFAULT_ATTRIBUTE_VALUE = 37
  2595. const _XML_ROLE_FIXED_ATTRIBUTE_VALUE = 38
  2596. const _XML_ROLE_ELEMENT_NONE = 39
  2597. const _XML_ROLE_ELEMENT_NAME = 40
  2598. const _XML_ROLE_CONTENT_ANY = 41
  2599. const _XML_ROLE_CONTENT_EMPTY = 42
  2600. const _XML_ROLE_CONTENT_PCDATA = 43
  2601. const _XML_ROLE_GROUP_OPEN = 44
  2602. const _XML_ROLE_GROUP_CLOSE = 45
  2603. const _XML_ROLE_GROUP_CLOSE_REP = 46
  2604. const _XML_ROLE_GROUP_CLOSE_OPT = 47
  2605. const _XML_ROLE_GROUP_CLOSE_PLUS = 48
  2606. const _XML_ROLE_GROUP_CHOICE = 49
  2607. const _XML_ROLE_GROUP_SEQUENCE = 50
  2608. const _XML_ROLE_CONTENT_ELEMENT = 51
  2609. const _XML_ROLE_CONTENT_ELEMENT_REP = 52
  2610. const _XML_ROLE_CONTENT_ELEMENT_OPT = 53
  2611. const _XML_ROLE_CONTENT_ELEMENT_PLUS = 54
  2612. const _XML_ROLE_PI = 55
  2613. const _XML_ROLE_COMMENT = 56
  2614. const _XML_ROLE_TEXT_DECL = 57
  2615. const _XML_ROLE_IGNORE_SECT = 58
  2616. const _XML_ROLE_INNER_PARAM_ENTITY_REF = 59
  2617. const _XML_ROLE_PARAM_ENTITY_REF = 60
  2618. type TPROLOG_STATE = struct {
  2619. Fhandler uintptr
  2620. Flevel uint32
  2621. Frole_none int32
  2622. FincludeLevel uint32
  2623. FdocumentEntity int32
  2624. FinEntityValue int32
  2625. }
  2626. type Tprolog_state = TPROLOG_STATE
  2627. type TKEY = uintptr
  2628. type TNAMED = struct {
  2629. Fname TKEY
  2630. }
  2631. type THASH_TABLE = struct {
  2632. Fv uintptr
  2633. Fpower uint8
  2634. Fsize Tsize_t
  2635. Fused Tsize_t
  2636. Fmem uintptr
  2637. }
  2638. /* For probing (after a collision) we need a step size relative prime
  2639. to the hash table size, which is a power of 2. We use double-hashing,
  2640. since we can calculate a second hash value cheaply by taking those bits
  2641. of the first hash value that were discarded (masked out) when the table
  2642. index was calculated: index = hash & mask, where mask = table->size - 1.
  2643. We limit the maximum step size to table->size / 4 (mask >> 2) and make
  2644. it odd, since odd numbers are always relative prime to a power of 2.
  2645. */
  2646. type THASH_TABLE_ITER = struct {
  2647. Fp uintptr
  2648. Fend uintptr
  2649. }
  2650. type TBINDING = struct {
  2651. Fprefix uintptr
  2652. FnextTagBinding uintptr
  2653. FprevPrefixBinding uintptr
  2654. FattId uintptr
  2655. Furi uintptr
  2656. FuriLen int32
  2657. FuriAlloc int32
  2658. }
  2659. type Tbinding = TBINDING
  2660. type TPREFIX = struct {
  2661. Fname uintptr
  2662. Fbinding uintptr
  2663. }
  2664. type Tprefix = TPREFIX
  2665. type TTAG_NAME = struct {
  2666. Fstr uintptr
  2667. FlocalPart uintptr
  2668. Fprefix uintptr
  2669. FstrLen int32
  2670. FuriLen int32
  2671. FprefixLen int32
  2672. }
  2673. // C documentation
  2674. //
  2675. // /* TAG represents an open element.
  2676. // The name of the element is stored in both the document and API
  2677. // encodings. The memory buffer 'buf' is a separately-allocated
  2678. // memory area which stores the name. During the XML_Parse()/
  2679. // XMLParseBuffer() when the element is open, the memory for the 'raw'
  2680. // version of the name (in the document encoding) is shared with the
  2681. // document buffer. If the element is open across calls to
  2682. // XML_Parse()/XML_ParseBuffer(), the buffer is re-allocated to
  2683. // contain the 'raw' name as well.
  2684. //
  2685. // A parser re-uses these structures, maintaining a list of allocated
  2686. // TAG objects in a free list.
  2687. // */
  2688. type TTAG = struct {
  2689. Fparent uintptr
  2690. FrawName uintptr
  2691. FrawNameLength int32
  2692. Fname TTAG_NAME
  2693. Fbuf uintptr
  2694. FbufEnd uintptr
  2695. Fbindings uintptr
  2696. }
  2697. // C documentation
  2698. //
  2699. // /* TAG represents an open element.
  2700. // The name of the element is stored in both the document and API
  2701. // encodings. The memory buffer 'buf' is a separately-allocated
  2702. // memory area which stores the name. During the XML_Parse()/
  2703. // XMLParseBuffer() when the element is open, the memory for the 'raw'
  2704. // version of the name (in the document encoding) is shared with the
  2705. // document buffer. If the element is open across calls to
  2706. // XML_Parse()/XML_ParseBuffer(), the buffer is re-allocated to
  2707. // contain the 'raw' name as well.
  2708. //
  2709. // A parser re-uses these structures, maintaining a list of allocated
  2710. // TAG objects in a free list.
  2711. // */
  2712. type Ttag = TTAG
  2713. type TENTITY = struct {
  2714. Fname uintptr
  2715. FtextPtr uintptr
  2716. FtextLen int32
  2717. Fprocessed int32
  2718. FsystemId uintptr
  2719. Fbase uintptr
  2720. FpublicId uintptr
  2721. Fnotation uintptr
  2722. Fopen TXML_Bool
  2723. Fis_param TXML_Bool
  2724. Fis_internal TXML_Bool
  2725. }
  2726. type TCONTENT_SCAFFOLD = struct {
  2727. Ftype1 _XML_Content_Type
  2728. Fquant _XML_Content_Quant
  2729. Fname uintptr
  2730. Ffirstchild int32
  2731. Flastchild int32
  2732. Fchildcnt int32
  2733. Fnextsib int32
  2734. }
  2735. type TBLOCK = struct {
  2736. Fnext uintptr
  2737. Fsize int32
  2738. Fs [1]TXML_Char
  2739. }
  2740. type Tblock = TBLOCK
  2741. type TSTRING_POOL = struct {
  2742. Fblocks uintptr
  2743. FfreeBlocks uintptr
  2744. Fend uintptr
  2745. Fptr uintptr
  2746. Fstart uintptr
  2747. Fmem uintptr
  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 = struct {
  2754. Fname uintptr
  2755. Fprefix uintptr
  2756. FmaybeTokenized TXML_Bool
  2757. Fxmlns TXML_Bool
  2758. }
  2759. // C documentation
  2760. //
  2761. // /* The XML_Char before the name is used to determine whether
  2762. // an attribute has been specified. */
  2763. type Tattribute_id = TATTRIBUTE_ID
  2764. type TDEFAULT_ATTRIBUTE = struct {
  2765. Fid uintptr
  2766. FisCdata TXML_Bool
  2767. Fvalue uintptr
  2768. }
  2769. type TNS_ATT = struct {
  2770. Fversion uint64
  2771. Fhash uint64
  2772. FuriName uintptr
  2773. }
  2774. type TELEMENT_TYPE = struct {
  2775. Fname uintptr
  2776. Fprefix uintptr
  2777. FidAtt uintptr
  2778. FnDefaultAtts int32
  2779. FallocDefaultAtts int32
  2780. FdefaultAtts uintptr
  2781. }
  2782. type TDTD = struct {
  2783. FgeneralEntities THASH_TABLE
  2784. FelementTypes THASH_TABLE
  2785. FattributeIds THASH_TABLE
  2786. Fprefixes THASH_TABLE
  2787. Fpool TSTRING_POOL
  2788. FentityValuePool TSTRING_POOL
  2789. FkeepProcessing TXML_Bool
  2790. FhasParamEntityRefs TXML_Bool
  2791. Fstandalone TXML_Bool
  2792. FparamEntityRead TXML_Bool
  2793. FparamEntities THASH_TABLE
  2794. FdefaultPrefix TPREFIX
  2795. Fin_eldecl TXML_Bool
  2796. Fscaffold uintptr
  2797. FcontentStringLen uint32
  2798. FscaffSize uint32
  2799. FscaffCount uint32
  2800. FscaffLevel int32
  2801. FscaffIndex uintptr
  2802. }
  2803. type TOPEN_INTERNAL_ENTITY = struct {
  2804. FinternalEventPtr uintptr
  2805. FinternalEventEndPtr uintptr
  2806. Fnext uintptr
  2807. Fentity uintptr
  2808. FstartTagLevel int32
  2809. FbetweenDecl TXML_Bool
  2810. }
  2811. type Topen_internal_entity = TOPEN_INTERNAL_ENTITY
  2812. type _XML_Account = int32
  2813. const _XML_ACCOUNT_DIRECT = 0
  2814. const /* bytes directly passed to the Expat parser */
  2815. _XML_ACCOUNT_ENTITY_EXPANSION = 1
  2816. const /* intermediate bytes produced during entity
  2817. expansion */
  2818. _XML_ACCOUNT_NONE = 2
  2819. type TXmlBigCount = uint64
  2820. type TACCOUNTING = struct {
  2821. FcountBytesDirect TXmlBigCount
  2822. FcountBytesIndirect TXmlBigCount
  2823. FdebugLevel int32
  2824. FmaximumAmplificationFactor float32
  2825. FactivationThresholdBytes uint64
  2826. }
  2827. type Taccounting = TACCOUNTING
  2828. type TENTITY_STATS = struct {
  2829. FcountEverOpened uint32
  2830. FcurrentDepth uint32
  2831. FmaximumDepthSeen uint32
  2832. FdebugLevel int32
  2833. }
  2834. type Tentity_stats = TENTITY_STATS
  2835. func XXML_ParserCreate(tls *libc.TLS, encodingName uintptr) (r TXML_Parser) {
  2836. return XXML_ParserCreate_MM(tls, encodingName, libc.UintptrFromInt32(0), libc.UintptrFromInt32(0))
  2837. }
  2838. func XXML_ParserCreateNS(tls *libc.TLS, encodingName uintptr, nsSep TXML_Char) (r TXML_Parser) {
  2839. bp := tls.Alloc(16)
  2840. defer tls.Free(16)
  2841. var _ /* tmp at bp+0 */ [2]TXML_Char
  2842. *(*[2]TXML_Char)(unsafe.Pointer(bp)) = [2]TXML_Char{
  2843. 0: nsSep,
  2844. }
  2845. return XXML_ParserCreate_MM(tls, encodingName, libc.UintptrFromInt32(0), bp)
  2846. }
  2847. // C documentation
  2848. //
  2849. // // "xml=http://www.w3.org/XML/1998/namespace"
  2850. var _implicitContext = [41]TXML_Char{
  2851. 0: int8(m_ASCII_x),
  2852. 1: int8(m_ASCII_m),
  2853. 2: int8(m_ASCII_l),
  2854. 3: int8(m_ASCII_EQUALS),
  2855. 4: int8(m_ASCII_h),
  2856. 5: int8(m_ASCII_t),
  2857. 6: int8(m_ASCII_t),
  2858. 7: int8(m_ASCII_p),
  2859. 8: int8(m_ASCII_COLON),
  2860. 9: int8(m_ASCII_SLASH),
  2861. 10: int8(m_ASCII_SLASH),
  2862. 11: int8(m_ASCII_w),
  2863. 12: int8(m_ASCII_w),
  2864. 13: int8(m_ASCII_w),
  2865. 14: int8(m_ASCII_PERIOD),
  2866. 15: int8(m_ASCII_w),
  2867. 16: int8(m_ASCII_3),
  2868. 17: int8(m_ASCII_PERIOD),
  2869. 18: int8(m_ASCII_o),
  2870. 19: int8(m_ASCII_r),
  2871. 20: int8(m_ASCII_g),
  2872. 21: int8(m_ASCII_SLASH),
  2873. 22: int8(m_ASCII_X),
  2874. 23: int8(m_ASCII_M),
  2875. 24: int8(m_ASCII_L),
  2876. 25: int8(m_ASCII_SLASH),
  2877. 26: int8(m_ASCII_1),
  2878. 27: int8(m_ASCII_9),
  2879. 28: int8(m_ASCII_9),
  2880. 29: int8(m_ASCII_8),
  2881. 30: int8(m_ASCII_SLASH),
  2882. 31: int8(m_ASCII_n),
  2883. 32: int8(m_ASCII_a),
  2884. 33: int8(m_ASCII_m),
  2885. 34: int8(m_ASCII_e),
  2886. 35: int8(m_ASCII_s),
  2887. 36: int8(m_ASCII_p),
  2888. 37: int8(m_ASCII_a),
  2889. 38: int8(m_ASCII_c),
  2890. 39: int8(m_ASCII_e),
  2891. }
  2892. /* To avoid warnings about unused functions: */
  2893. func _ENTROPY_DEBUG(tls *libc.TLS, label uintptr, entropy uint64) (r uint64) {
  2894. bp := tls.Alloc(48)
  2895. defer tls.Free(48)
  2896. if _getDebugLevel(tls, __ccgo_ts+17, uint64(0)) >= uint64(1) {
  2897. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+37, libc.VaList(bp+8, label, libc.Int32FromInt64(8)*libc.Int32FromInt32(2), entropy, libc.Uint64FromInt64(8)))
  2898. }
  2899. return entropy
  2900. }
  2901. func _generate_hash_secret_salt(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  2902. bp := tls.Alloc(16)
  2903. defer tls.Free(16)
  2904. var _ /* entropy at bp+0 */ uint64
  2905. _ = parser
  2906. /* "Failproof" high quality providers: */
  2907. libbsd.Xarc4random_buf(tls, bp, uint64(8))
  2908. return _ENTROPY_DEBUG(tls, __ccgo_ts+81, *(*uint64)(unsafe.Pointer(bp)))
  2909. }
  2910. func _get_hash_secret_salt(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  2911. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != libc.UintptrFromInt32(0) {
  2912. return _get_hash_secret_salt(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser)
  2913. }
  2914. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt
  2915. }
  2916. func _startParsing(tls *libc.TLS, parser TXML_Parser) (r TXML_Bool) {
  2917. /* hash functions must be initialized before setContext() is called */
  2918. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt == uint64(0) {
  2919. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = _generate_hash_secret_salt(tls, parser)
  2920. }
  2921. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  2922. /* implicit context only set for root parser, since child
  2923. parsers (i.e. external entity parsers) will inherit it
  2924. */
  2925. return _setContext(tls, parser, uintptr(unsafe.Pointer(&_implicitContext)))
  2926. }
  2927. return libc.Uint8FromInt32(1)
  2928. }
  2929. func XXML_ParserCreate_MM(tls *libc.TLS, encodingName uintptr, memsuite uintptr, nameSep uintptr) (r TXML_Parser) {
  2930. return _parserCreate(tls, encodingName, memsuite, nameSep, libc.UintptrFromInt32(0))
  2931. }
  2932. func _parserCreate(tls *libc.TLS, encodingName uintptr, memsuite uintptr, nameSep uintptr, dtd uintptr) (r TXML_Parser) {
  2933. var mtemp, mtemp1 uintptr
  2934. var parser TXML_Parser
  2935. _, _, _ = mtemp, mtemp1, parser
  2936. if memsuite != 0 {
  2937. parser = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Fmalloc_fcn})))(tls, uint64(976))
  2938. if parser != libc.UintptrFromInt32(0) {
  2939. mtemp = parser + 24
  2940. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp)).Fmalloc_fcn = (*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Fmalloc_fcn
  2941. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp)).Frealloc_fcn = (*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Frealloc_fcn
  2942. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp)).Ffree_fcn = (*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Ffree_fcn
  2943. }
  2944. } else {
  2945. parser = libc.Xmalloc(tls, uint64(976))
  2946. if parser != libc.UintptrFromInt32(0) {
  2947. mtemp1 = parser + 24
  2948. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp1)).Fmalloc_fcn = __ccgo_fp(libc.Xmalloc)
  2949. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp1)).Frealloc_fcn = __ccgo_fp(libc.Xrealloc)
  2950. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp1)).Ffree_fcn = __ccgo_fp(libc.Xfree)
  2951. }
  2952. }
  2953. if !(parser != 0) {
  2954. return parser
  2955. }
  2956. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer = libc.UintptrFromInt32(0)
  2957. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim = libc.UintptrFromInt32(0)
  2958. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = int32(m_INIT_ATTS_SIZE)
  2959. (*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))
  2960. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts == libc.UintptrFromInt32(0) {
  2961. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  2962. return libc.UintptrFromInt32(0)
  2963. }
  2964. (*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))
  2965. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf == 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_atts)
  2967. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  2968. return libc.UintptrFromInt32(0)
  2969. }
  2970. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf + uintptr(m_INIT_DATA_BUF_SIZE)
  2971. if dtd != 0 {
  2972. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd = dtd
  2973. } else {
  2974. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd = _dtdCreate(tls, parser+24)
  2975. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd == libc.UintptrFromInt32(0) {
  2976. (*(*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)
  2977. (*(*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)
  2978. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  2979. return libc.UintptrFromInt32(0)
  2980. }
  2981. }
  2982. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = libc.UintptrFromInt32(0)
  2983. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = libc.UintptrFromInt32(0)
  2984. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = libc.UintptrFromInt32(0)
  2985. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize = uint32(0)
  2986. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector = libc.UintptrFromInt32(0)
  2987. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler = libc.UintptrFromInt32(0)
  2988. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandlerData = libc.UintptrFromInt32(0)
  2989. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator = int8(m_ASCII_EXCL)
  2990. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns = libc.Uint8FromInt32(0)
  2991. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets = libc.Uint8FromInt32(0)
  2992. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts = libc.UintptrFromInt32(0)
  2993. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsVersion = uint64(0)
  2994. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = uint8(0)
  2995. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = libc.UintptrFromInt32(0)
  2996. _poolInit(tls, parser+784, parser+24)
  2997. _poolInit(tls, parser+832, parser+24)
  2998. _parserInit(tls, parser, encodingName)
  2999. if encodingName != 0 && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName != 0) {
  3000. if dtd != 0 {
  3001. // We need to stop the upcoming call to XML_ParserFree from happily
  3002. // destroying parser->m_dtd because the DTD is shared with the parent
  3003. // parser and the only guard that keeps XML_ParserFree from destroying
  3004. // parser->m_dtd is parser->m_isParamEntity but it will be set to
  3005. // XML_TRUE only later in XML_ExternalEntityParserCreate (or not at all).
  3006. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd = libc.UintptrFromInt32(0)
  3007. }
  3008. XXML_ParserFree(tls, parser)
  3009. return libc.UintptrFromInt32(0)
  3010. }
  3011. if nameSep != 0 {
  3012. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns = libc.Uint8FromInt32(1)
  3013. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding = XXmlGetUtf8InternalEncodingNS(tls)
  3014. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator = *(*TXML_Char)(unsafe.Pointer(nameSep))
  3015. } else {
  3016. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding = XXmlGetUtf8InternalEncoding(tls)
  3017. }
  3018. return parser
  3019. }
  3020. func _parserInit(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) {
  3021. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologInitProcessor)
  3022. XXmlPrologStateInit(tls, parser+496)
  3023. if encodingName != libc.UintptrFromInt32(0) {
  3024. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = _copyString(tls, encodingName, parser+24)
  3025. }
  3026. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase = libc.UintptrFromInt32(0)
  3027. XXmlInitEncoding(tls, parser+296, parser+288, uintptr(0))
  3028. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = libc.UintptrFromInt32(0)
  3029. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = libc.UintptrFromInt32(0)
  3030. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = libc.UintptrFromInt32(0)
  3031. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = libc.UintptrFromInt32(0)
  3032. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler = libc.UintptrFromInt32(0)
  3033. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler = libc.UintptrFromInt32(0)
  3034. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler = libc.UintptrFromInt32(0)
  3035. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = libc.UintptrFromInt32(0)
  3036. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = libc.UintptrFromInt32(0)
  3037. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = libc.UintptrFromInt32(0)
  3038. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler = libc.UintptrFromInt32(0)
  3039. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler = libc.UintptrFromInt32(0)
  3040. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler = libc.UintptrFromInt32(0)
  3041. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler = libc.UintptrFromInt32(0)
  3042. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = libc.UintptrFromInt32(0)
  3043. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = libc.UintptrFromInt32(0)
  3044. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler = libc.UintptrFromInt32(0)
  3045. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler = libc.UintptrFromInt32(0)
  3046. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = parser
  3047. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler = libc.UintptrFromInt32(0)
  3048. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler = libc.UintptrFromInt32(0)
  3049. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler = libc.UintptrFromInt32(0)
  3050. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler = libc.UintptrFromInt32(0)
  3051. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler = libc.UintptrFromInt32(0)
  3052. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer
  3053. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer
  3054. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndByteIndex = 0
  3055. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr = libc.UintptrFromInt32(0)
  3056. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = libc.UintptrFromInt32(0)
  3057. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId = libc.UintptrFromInt32(0)
  3058. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  3059. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName = libc.UintptrFromInt32(0)
  3060. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = libc.UintptrFromInt32(0)
  3061. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid = libc.UintptrFromInt32(0)
  3062. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = libc.UintptrFromInt32(0)
  3063. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName = libc.UintptrFromInt32(0)
  3064. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId = libc.UintptrFromInt32(0)
  3065. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata = libc.Uint8FromInt32(0)
  3066. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId = libc.Uint8FromInt32(0)
  3067. libc.Xmemset(tls, parser+768, 0, uint64(16))
  3068. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NONE)
  3069. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = libc.UintptrFromInt32(0)
  3070. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = libc.UintptrFromInt32(0)
  3071. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = libc.UintptrFromInt32(0)
  3072. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = libc.UintptrFromInt32(0)
  3073. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = libc.Uint8FromInt32(1)
  3074. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel = 0
  3075. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack = libc.UintptrFromInt32(0)
  3076. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_inheritedBindings = libc.UintptrFromInt32(0)
  3077. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nSpecifiedAtts = 0
  3078. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem = libc.UintptrFromInt32(0)
  3079. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease = libc.UintptrFromInt32(0)
  3080. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData = libc.UintptrFromInt32(0)
  3081. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser = libc.UintptrFromInt32(0)
  3082. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_INITIALIZED)
  3083. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity = libc.Uint8FromInt32(0)
  3084. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  3085. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = int32(_XML_PARAM_ENTITY_PARSING_NEVER)
  3086. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = uint64(0)
  3087. libc.Xmemset(tls, parser+928, 0, uint64(32))
  3088. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FdebugLevel = libc.Int32FromUint64(_getDebugLevel(tls, __ccgo_ts+96, 0))
  3089. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FmaximumAmplificationFactor = libc.Float32FromFloat32(100)
  3090. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FactivationThresholdBytes = uint64(m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT)
  3091. libc.Xmemset(tls, parser+960, 0, uint64(16))
  3092. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entity_stats.FdebugLevel = libc.Int32FromUint64(_getDebugLevel(tls, __ccgo_ts+119, 0))
  3093. }
  3094. // C documentation
  3095. //
  3096. // /* moves list of bindings to m_freeBindingList */
  3097. func _moveToFreeBindingList(tls *libc.TLS, parser TXML_Parser, bindings uintptr) {
  3098. var b uintptr
  3099. _ = b
  3100. for bindings != 0 {
  3101. b = bindings
  3102. bindings = (*TBINDING)(unsafe.Pointer(bindings)).FnextTagBinding
  3103. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  3104. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = b
  3105. }
  3106. }
  3107. func XXML_ParserReset(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) (r TXML_Bool) {
  3108. var openEntity, openEntityList, tStk, tag uintptr
  3109. _, _, _, _ = openEntity, openEntityList, tStk, tag
  3110. if parser == libc.UintptrFromInt32(0) {
  3111. return libc.Uint8FromInt32(0)
  3112. }
  3113. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 {
  3114. return libc.Uint8FromInt32(0)
  3115. }
  3116. /* move m_tagStack to m_freeTagList */
  3117. tStk = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  3118. for tStk != 0 {
  3119. tag = tStk
  3120. tStk = (*TTAG)(unsafe.Pointer(tStk)).Fparent
  3121. (*TTAG)(unsafe.Pointer(tag)).Fparent = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  3122. _moveToFreeBindingList(tls, parser, (*TTAG)(unsafe.Pointer(tag)).Fbindings)
  3123. (*TTAG)(unsafe.Pointer(tag)).Fbindings = libc.UintptrFromInt32(0)
  3124. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = tag
  3125. }
  3126. /* move m_openInternalEntities to m_freeInternalEntities */
  3127. openEntityList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  3128. for openEntityList != 0 {
  3129. openEntity = openEntityList
  3130. openEntityList = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  3131. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  3132. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = openEntity
  3133. }
  3134. _moveToFreeBindingList(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_inheritedBindings)
  3135. (*(*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)
  3136. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease != 0 {
  3137. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData)
  3138. }
  3139. _poolClear(tls, parser+784)
  3140. _poolClear(tls, parser+832)
  3141. (*(*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)
  3142. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = libc.UintptrFromInt32(0)
  3143. _parserInit(tls, parser, encodingName)
  3144. _dtdReset(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd, parser+24)
  3145. return libc.Uint8FromInt32(1)
  3146. }
  3147. func XXML_SetEncoding(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) (r _XML_Status) {
  3148. if parser == libc.UintptrFromInt32(0) {
  3149. return int32(_XML_STATUS_ERROR)
  3150. }
  3151. /* Block after XML_Parse()/XML_ParseBuffer() has been called.
  3152. XXX There's no way for the caller to determine which of the
  3153. XXX possible error cases caused the XML_STATUS_ERROR return.
  3154. */
  3155. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3156. return int32(_XML_STATUS_ERROR)
  3157. }
  3158. /* Get rid of any previous encoding name */
  3159. (*(*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)
  3160. if encodingName == libc.UintptrFromInt32(0) {
  3161. /* No new encoding name */
  3162. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = libc.UintptrFromInt32(0)
  3163. } else {
  3164. /* Copy the new encoding name into allocated memory */
  3165. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = _copyString(tls, encodingName, parser+24)
  3166. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName != 0) {
  3167. return int32(_XML_STATUS_ERROR)
  3168. }
  3169. }
  3170. return int32(_XML_STATUS_OK)
  3171. }
  3172. func XXML_ExternalEntityParserCreate(tls *libc.TLS, oldParser TXML_Parser, context uintptr, encodingName uintptr) (r TXML_Parser) {
  3173. bp := tls.Alloc(16)
  3174. defer tls.Free(16)
  3175. var newDtd, oldDeclElementType, oldDtd, oldHandlerArg, oldUserData uintptr
  3176. var oldAttlistDeclHandler TXML_AttlistDeclHandler
  3177. var oldCharacterDataHandler TXML_CharacterDataHandler
  3178. var oldCommentHandler TXML_CommentHandler
  3179. var oldDefaultExpandInternalEntities, oldns_triplets TXML_Bool
  3180. var oldDefaultHandler TXML_DefaultHandler
  3181. var oldElementDeclHandler TXML_ElementDeclHandler
  3182. var oldEndCdataSectionHandler TXML_EndCdataSectionHandler
  3183. var oldEndElementHandler TXML_EndElementHandler
  3184. var oldEndNamespaceDeclHandler TXML_EndNamespaceDeclHandler
  3185. var oldEntityDeclHandler TXML_EntityDeclHandler
  3186. var oldExternalEntityRefHandler TXML_ExternalEntityRefHandler
  3187. var oldExternalEntityRefHandlerArg, parser TXML_Parser
  3188. var oldInEntityValue int32
  3189. var oldNotStandaloneHandler TXML_NotStandaloneHandler
  3190. var oldNotationDeclHandler TXML_NotationDeclHandler
  3191. var oldParamEntityParsing _XML_ParamEntityParsing
  3192. var oldProcessingInstructionHandler TXML_ProcessingInstructionHandler
  3193. var oldSkippedEntityHandler TXML_SkippedEntityHandler
  3194. var oldStartCdataSectionHandler TXML_StartCdataSectionHandler
  3195. var oldStartElementHandler TXML_StartElementHandler
  3196. var oldStartNamespaceDeclHandler TXML_StartNamespaceDeclHandler
  3197. var oldUnknownEncodingHandler TXML_UnknownEncodingHandler
  3198. var oldUnparsedEntityDeclHandler TXML_UnparsedEntityDeclHandler
  3199. var oldXmlDeclHandler TXML_XmlDeclHandler
  3200. var oldhash_secret_salt uint64
  3201. var _ /* tmp at bp+0 */ [2]TXML_Char
  3202. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  3203. parser = oldParser
  3204. newDtd = libc.UintptrFromInt32(0)
  3205. /* Validate the oldParser parameter before we pull everything out of it */
  3206. if oldParser == libc.UintptrFromInt32(0) {
  3207. return libc.UintptrFromInt32(0)
  3208. }
  3209. /* Stash the original parser contents on the stack */
  3210. oldDtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  3211. oldStartElementHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler
  3212. oldEndElementHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler
  3213. oldCharacterDataHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler
  3214. oldProcessingInstructionHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler
  3215. oldCommentHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler
  3216. oldStartCdataSectionHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler
  3217. oldEndCdataSectionHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler
  3218. oldDefaultHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler
  3219. oldUnparsedEntityDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler
  3220. oldNotationDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler
  3221. oldStartNamespaceDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler
  3222. oldEndNamespaceDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler
  3223. oldNotStandaloneHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler
  3224. oldExternalEntityRefHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler
  3225. oldSkippedEntityHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler
  3226. oldUnknownEncodingHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler
  3227. oldElementDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler
  3228. oldAttlistDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler
  3229. oldEntityDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler
  3230. oldXmlDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler
  3231. oldDeclElementType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType
  3232. oldUserData = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData
  3233. oldHandlerArg = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg
  3234. oldDefaultExpandInternalEntities = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities
  3235. oldExternalEntityRefHandlerArg = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg
  3236. oldParamEntityParsing = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing
  3237. oldInEntityValue = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue
  3238. oldns_triplets = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets
  3239. /* Note that the new parser shares the same hash secret as the old
  3240. parser, so that dtdCopy and copyEntityTable can lookup values
  3241. from hash tables associated with either parser without us having
  3242. to worry which hash secrets each table has.
  3243. */
  3244. oldhash_secret_salt = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt
  3245. if !(context != 0) {
  3246. newDtd = oldDtd
  3247. }
  3248. /* Note that the magical uses of the pre-processor to make field
  3249. access look more like C++ require that `parser' be overwritten
  3250. here. This makes this function more painful to follow than it
  3251. would be otherwise.
  3252. */
  3253. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  3254. *(*[2]TXML_Char)(unsafe.Pointer(bp)) = [2]TXML_Char{
  3255. 0: (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator,
  3256. }
  3257. parser = _parserCreate(tls, encodingName, parser+24, bp, newDtd)
  3258. } else {
  3259. parser = _parserCreate(tls, encodingName, parser+24, libc.UintptrFromInt32(0), newDtd)
  3260. }
  3261. if !(parser != 0) {
  3262. return libc.UintptrFromInt32(0)
  3263. }
  3264. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = oldStartElementHandler
  3265. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = oldEndElementHandler
  3266. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler = oldCharacterDataHandler
  3267. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler = oldProcessingInstructionHandler
  3268. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler = oldCommentHandler
  3269. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = oldStartCdataSectionHandler
  3270. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = oldEndCdataSectionHandler
  3271. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = oldDefaultHandler
  3272. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler = oldUnparsedEntityDeclHandler
  3273. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler = oldNotationDeclHandler
  3274. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = oldStartNamespaceDeclHandler
  3275. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = oldEndNamespaceDeclHandler
  3276. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler = oldNotStandaloneHandler
  3277. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler = oldExternalEntityRefHandler
  3278. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler = oldSkippedEntityHandler
  3279. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler = oldUnknownEncodingHandler
  3280. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler = oldElementDeclHandler
  3281. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler = oldAttlistDeclHandler
  3282. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler = oldEntityDeclHandler
  3283. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler = oldXmlDeclHandler
  3284. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = oldDeclElementType
  3285. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = oldUserData
  3286. if oldUserData == oldHandlerArg {
  3287. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData
  3288. } else {
  3289. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = parser
  3290. }
  3291. if oldExternalEntityRefHandlerArg != oldParser {
  3292. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg
  3293. }
  3294. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = oldDefaultExpandInternalEntities
  3295. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets = oldns_triplets
  3296. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = oldhash_secret_salt
  3297. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser = oldParser
  3298. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = oldParamEntityParsing
  3299. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue = oldInEntityValue
  3300. if context != 0 {
  3301. if !(_dtdCopy(tls, oldParser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd, oldDtd, parser+24) != 0) || !(_setContext(tls, parser, context) != 0) {
  3302. XXML_ParserFree(tls, parser)
  3303. return libc.UintptrFromInt32(0)
  3304. }
  3305. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityInitProcessor)
  3306. } else {
  3307. /* The DTD instance referenced by parser->m_dtd is shared between the
  3308. document's root parser and external PE parsers, therefore one does not
  3309. need to call setContext. In addition, one also *must* not call
  3310. setContext, because this would overwrite existing prefix->binding
  3311. pointers in parser->m_dtd with ones that get destroyed with the external
  3312. PE parser. This would leave those prefixes with dangling pointers.
  3313. */
  3314. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity = libc.Uint8FromInt32(1)
  3315. XXmlPrologStateInitExternalEntity(tls, parser+496)
  3316. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalParEntInitProcessor)
  3317. }
  3318. return parser
  3319. }
  3320. func _destroyBindings(tls *libc.TLS, bindings uintptr, parser TXML_Parser) {
  3321. var b uintptr
  3322. _ = b
  3323. for {
  3324. b = bindings
  3325. if !(b != 0) {
  3326. break
  3327. }
  3328. bindings = (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding
  3329. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TBINDING)(unsafe.Pointer(b)).Furi)
  3330. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, b)
  3331. goto _1
  3332. _1:
  3333. }
  3334. }
  3335. func XXML_ParserFree(tls *libc.TLS, parser TXML_Parser) {
  3336. var entityList, openEntity, p, tagList uintptr
  3337. _, _, _, _ = entityList, openEntity, p, tagList
  3338. if parser == libc.UintptrFromInt32(0) {
  3339. return
  3340. }
  3341. /* free m_tagStack and m_freeTagList */
  3342. tagList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  3343. for {
  3344. if tagList == libc.UintptrFromInt32(0) {
  3345. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList == libc.UintptrFromInt32(0) {
  3346. break
  3347. }
  3348. tagList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  3349. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = libc.UintptrFromInt32(0)
  3350. }
  3351. p = tagList
  3352. tagList = (*TTAG)(unsafe.Pointer(tagList)).Fparent
  3353. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TTAG)(unsafe.Pointer(p)).Fbuf)
  3354. _destroyBindings(tls, (*TTAG)(unsafe.Pointer(p)).Fbindings, parser)
  3355. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, p)
  3356. goto _1
  3357. _1:
  3358. }
  3359. /* free m_openInternalEntities and m_freeInternalEntities */
  3360. entityList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  3361. for {
  3362. if entityList == libc.UintptrFromInt32(0) {
  3363. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities == libc.UintptrFromInt32(0) {
  3364. break
  3365. }
  3366. entityList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  3367. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = libc.UintptrFromInt32(0)
  3368. }
  3369. openEntity = entityList
  3370. entityList = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(entityList)).Fnext
  3371. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, openEntity)
  3372. goto _2
  3373. _2:
  3374. }
  3375. _destroyBindings(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList, parser)
  3376. _destroyBindings(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_inheritedBindings, parser)
  3377. _poolDestroy(tls, parser+784)
  3378. _poolDestroy(tls, parser+832)
  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_protocolEncodingName)
  3380. /* external parameter entity parsers share the DTD structure
  3381. parser->m_dtd with the root parser, so we must not destroy it
  3382. */
  3383. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd != 0 {
  3384. _dtdDestroy(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd, libc.BoolUint8(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0)), parser+24)
  3385. }
  3386. (*(*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)
  3387. (*(*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)
  3388. (*(*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)
  3389. (*(*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)
  3390. (*(*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)
  3391. (*(*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)
  3392. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease != 0 {
  3393. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData)
  3394. }
  3395. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  3396. }
  3397. func XXML_UseParserAsHandlerArg(tls *libc.TLS, parser TXML_Parser) {
  3398. if parser != libc.UintptrFromInt32(0) {
  3399. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = parser
  3400. }
  3401. }
  3402. func XXML_UseForeignDTD(tls *libc.TLS, parser TXML_Parser, useDTD TXML_Bool) (r _XML_Error) {
  3403. if parser == libc.UintptrFromInt32(0) {
  3404. return int32(_XML_ERROR_INVALID_ARGUMENT)
  3405. }
  3406. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3407. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3408. return int32(_XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING)
  3409. }
  3410. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = useDTD
  3411. return int32(_XML_ERROR_NONE)
  3412. }
  3413. func XXML_SetReturnNSTriplet(tls *libc.TLS, parser TXML_Parser, do_nst int32) {
  3414. var v1 int32
  3415. _ = v1
  3416. if parser == libc.UintptrFromInt32(0) {
  3417. return
  3418. }
  3419. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3420. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3421. return
  3422. }
  3423. if do_nst != 0 {
  3424. v1 = libc.Int32FromUint8(libc.Uint8FromInt32(1))
  3425. } else {
  3426. v1 = libc.Int32FromUint8(libc.Uint8FromInt32(0))
  3427. }
  3428. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets = libc.Uint8FromInt32(v1)
  3429. }
  3430. func XXML_SetUserData(tls *libc.TLS, parser TXML_Parser, p uintptr) {
  3431. var v1 uintptr
  3432. _ = v1
  3433. if parser == libc.UintptrFromInt32(0) {
  3434. return
  3435. }
  3436. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData {
  3437. v1 = p
  3438. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = v1
  3439. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = v1
  3440. } else {
  3441. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = p
  3442. }
  3443. }
  3444. func XXML_SetBase(tls *libc.TLS, parser TXML_Parser, p uintptr) (r _XML_Status) {
  3445. if parser == libc.UintptrFromInt32(0) {
  3446. return int32(_XML_STATUS_ERROR)
  3447. }
  3448. if p != 0 {
  3449. p = _poolCopyString(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd+160, p)
  3450. if !(p != 0) {
  3451. return int32(_XML_STATUS_ERROR)
  3452. }
  3453. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase = p
  3454. } else {
  3455. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase = libc.UintptrFromInt32(0)
  3456. }
  3457. return int32(_XML_STATUS_OK)
  3458. }
  3459. func XXML_GetBase(tls *libc.TLS, parser TXML_Parser) (r uintptr) {
  3460. if parser == libc.UintptrFromInt32(0) {
  3461. return libc.UintptrFromInt32(0)
  3462. }
  3463. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  3464. }
  3465. func XXML_GetSpecifiedAttributeCount(tls *libc.TLS, parser TXML_Parser) (r int32) {
  3466. if parser == libc.UintptrFromInt32(0) {
  3467. return -int32(1)
  3468. }
  3469. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nSpecifiedAtts
  3470. }
  3471. func XXML_GetIdAttributeIndex(tls *libc.TLS, parser TXML_Parser) (r int32) {
  3472. if parser == libc.UintptrFromInt32(0) {
  3473. return -int32(1)
  3474. }
  3475. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_idAttIndex
  3476. }
  3477. func XXML_SetElementHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartElementHandler, end TXML_EndElementHandler) {
  3478. if parser == libc.UintptrFromInt32(0) {
  3479. return
  3480. }
  3481. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = start
  3482. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = end
  3483. }
  3484. func XXML_SetStartElementHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartElementHandler) {
  3485. if parser != libc.UintptrFromInt32(0) {
  3486. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = start
  3487. }
  3488. }
  3489. func XXML_SetEndElementHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndElementHandler) {
  3490. if parser != libc.UintptrFromInt32(0) {
  3491. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = end
  3492. }
  3493. }
  3494. func XXML_SetCharacterDataHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_CharacterDataHandler) {
  3495. if parser != libc.UintptrFromInt32(0) {
  3496. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler = handler
  3497. }
  3498. }
  3499. func XXML_SetProcessingInstructionHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_ProcessingInstructionHandler) {
  3500. if parser != libc.UintptrFromInt32(0) {
  3501. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler = handler
  3502. }
  3503. }
  3504. func XXML_SetCommentHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_CommentHandler) {
  3505. if parser != libc.UintptrFromInt32(0) {
  3506. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler = handler
  3507. }
  3508. }
  3509. func XXML_SetCdataSectionHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartCdataSectionHandler, end TXML_EndCdataSectionHandler) {
  3510. if parser == libc.UintptrFromInt32(0) {
  3511. return
  3512. }
  3513. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = start
  3514. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = end
  3515. }
  3516. func XXML_SetStartCdataSectionHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartCdataSectionHandler) {
  3517. if parser != libc.UintptrFromInt32(0) {
  3518. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = start
  3519. }
  3520. }
  3521. func XXML_SetEndCdataSectionHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndCdataSectionHandler) {
  3522. if parser != libc.UintptrFromInt32(0) {
  3523. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = end
  3524. }
  3525. }
  3526. func XXML_SetDefaultHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_DefaultHandler) {
  3527. if parser == libc.UintptrFromInt32(0) {
  3528. return
  3529. }
  3530. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = handler
  3531. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = libc.Uint8FromInt32(0)
  3532. }
  3533. func XXML_SetDefaultHandlerExpand(tls *libc.TLS, parser TXML_Parser, handler TXML_DefaultHandler) {
  3534. if parser == libc.UintptrFromInt32(0) {
  3535. return
  3536. }
  3537. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = handler
  3538. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = libc.Uint8FromInt32(1)
  3539. }
  3540. func XXML_SetDoctypeDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartDoctypeDeclHandler, end TXML_EndDoctypeDeclHandler) {
  3541. if parser == libc.UintptrFromInt32(0) {
  3542. return
  3543. }
  3544. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler = start
  3545. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler = end
  3546. }
  3547. func XXML_SetStartDoctypeDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartDoctypeDeclHandler) {
  3548. if parser != libc.UintptrFromInt32(0) {
  3549. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler = start
  3550. }
  3551. }
  3552. func XXML_SetEndDoctypeDeclHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndDoctypeDeclHandler) {
  3553. if parser != libc.UintptrFromInt32(0) {
  3554. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler = end
  3555. }
  3556. }
  3557. func XXML_SetUnparsedEntityDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_UnparsedEntityDeclHandler) {
  3558. if parser != libc.UintptrFromInt32(0) {
  3559. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler = handler
  3560. }
  3561. }
  3562. func XXML_SetNotationDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_NotationDeclHandler) {
  3563. if parser != libc.UintptrFromInt32(0) {
  3564. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler = handler
  3565. }
  3566. }
  3567. func XXML_SetNamespaceDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartNamespaceDeclHandler, end TXML_EndNamespaceDeclHandler) {
  3568. if parser == libc.UintptrFromInt32(0) {
  3569. return
  3570. }
  3571. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = start
  3572. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = end
  3573. }
  3574. func XXML_SetStartNamespaceDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartNamespaceDeclHandler) {
  3575. if parser != libc.UintptrFromInt32(0) {
  3576. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = start
  3577. }
  3578. }
  3579. func XXML_SetEndNamespaceDeclHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndNamespaceDeclHandler) {
  3580. if parser != libc.UintptrFromInt32(0) {
  3581. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = end
  3582. }
  3583. }
  3584. func XXML_SetNotStandaloneHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_NotStandaloneHandler) {
  3585. if parser != libc.UintptrFromInt32(0) {
  3586. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler = handler
  3587. }
  3588. }
  3589. func XXML_SetExternalEntityRefHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_ExternalEntityRefHandler) {
  3590. if parser != libc.UintptrFromInt32(0) {
  3591. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler = handler
  3592. }
  3593. }
  3594. func XXML_SetExternalEntityRefHandlerArg(tls *libc.TLS, parser TXML_Parser, arg uintptr) {
  3595. if parser == libc.UintptrFromInt32(0) {
  3596. return
  3597. }
  3598. if arg != 0 {
  3599. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = arg
  3600. } else {
  3601. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = parser
  3602. }
  3603. }
  3604. func XXML_SetSkippedEntityHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_SkippedEntityHandler) {
  3605. if parser != libc.UintptrFromInt32(0) {
  3606. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler = handler
  3607. }
  3608. }
  3609. func XXML_SetUnknownEncodingHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_UnknownEncodingHandler, data uintptr) {
  3610. if parser == libc.UintptrFromInt32(0) {
  3611. return
  3612. }
  3613. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler = handler
  3614. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandlerData = data
  3615. }
  3616. func XXML_SetElementDeclHandler(tls *libc.TLS, parser TXML_Parser, eldecl TXML_ElementDeclHandler) {
  3617. if parser != libc.UintptrFromInt32(0) {
  3618. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler = eldecl
  3619. }
  3620. }
  3621. func XXML_SetAttlistDeclHandler(tls *libc.TLS, parser TXML_Parser, attdecl TXML_AttlistDeclHandler) {
  3622. if parser != libc.UintptrFromInt32(0) {
  3623. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler = attdecl
  3624. }
  3625. }
  3626. func XXML_SetEntityDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_EntityDeclHandler) {
  3627. if parser != libc.UintptrFromInt32(0) {
  3628. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler = handler
  3629. }
  3630. }
  3631. func XXML_SetXmlDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_XmlDeclHandler) {
  3632. if parser != libc.UintptrFromInt32(0) {
  3633. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler = handler
  3634. }
  3635. }
  3636. func XXML_SetParamEntityParsing(tls *libc.TLS, parser TXML_Parser, peParsing _XML_ParamEntityParsing) (r int32) {
  3637. if parser == libc.UintptrFromInt32(0) {
  3638. return 0
  3639. }
  3640. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3641. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3642. return 0
  3643. }
  3644. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = peParsing
  3645. return int32(1)
  3646. }
  3647. func XXML_SetHashSalt(tls *libc.TLS, parser TXML_Parser, hash_salt uint64) (r int32) {
  3648. if parser == libc.UintptrFromInt32(0) {
  3649. return 0
  3650. }
  3651. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 {
  3652. return XXML_SetHashSalt(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser, hash_salt)
  3653. }
  3654. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3655. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3656. return 0
  3657. }
  3658. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = hash_salt
  3659. return int32(1)
  3660. }
  3661. func XXML_Parse(tls *libc.TLS, parser TXML_Parser, s uintptr, len1 int32, isFinal int32) (r _XML_Status) {
  3662. var buff uintptr
  3663. _ = buff
  3664. if parser == libc.UintptrFromInt32(0) || len1 < 0 || s == libc.UintptrFromInt32(0) && len1 != 0 {
  3665. if parser != libc.UintptrFromInt32(0) {
  3666. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_INVALID_ARGUMENT)
  3667. }
  3668. return int32(_XML_STATUS_ERROR)
  3669. }
  3670. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3671. case int32(_XML_SUSPENDED):
  3672. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3673. return int32(_XML_STATUS_ERROR)
  3674. case int32(_XML_FINISHED):
  3675. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3676. return int32(_XML_STATUS_ERROR)
  3677. case int32(_XML_INITIALIZED):
  3678. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser == libc.UintptrFromInt32(0) && !(_startParsing(tls, parser) != 0) {
  3679. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3680. return int32(_XML_STATUS_ERROR)
  3681. }
  3682. /* fall through */
  3683. fallthrough
  3684. default:
  3685. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_PARSING)
  3686. }
  3687. if len1 == 0 {
  3688. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer = libc.Uint8FromInt32(isFinal)
  3689. if !(isFinal != 0) {
  3690. return int32(_XML_STATUS_OK)
  3691. }
  3692. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3693. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd
  3694. /* If data are left over from last buffer, and we now know that these
  3695. data are the final chunk of input, then we have to check them again
  3696. to detect errors based on that fact.
  3697. */
  3698. (*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)
  3699. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode == int32(_XML_ERROR_NONE) {
  3700. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3701. case int32(_XML_SUSPENDED):
  3702. /* It is hard to be certain, but it seems that this case
  3703. * cannot occur. This code is cleaning up a previous parse
  3704. * with no new data (since len == 0). Changing the parsing
  3705. * state requires getting to execute a handler function, and
  3706. * there doesn't seem to be an opportunity for that while in
  3707. * this circumstance.
  3708. *
  3709. * Given the uncertainty, we retain the code but exclude it
  3710. * from coverage tests.
  3711. *
  3712. * LCOV_EXCL_START
  3713. */
  3714. (*(*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)
  3715. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3716. return int32(_XML_STATUS_SUSPENDED)
  3717. /* LCOV_EXCL_STOP */
  3718. fallthrough
  3719. case int32(_XML_INITIALIZED):
  3720. fallthrough
  3721. case int32(_XML_PARSING):
  3722. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3723. /* fall through */
  3724. fallthrough
  3725. default:
  3726. return int32(_XML_STATUS_OK)
  3727. }
  3728. }
  3729. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  3730. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_errorProcessor)
  3731. return int32(_XML_STATUS_ERROR)
  3732. } else {
  3733. buff = XXML_GetBuffer(tls, parser, len1)
  3734. if buff == libc.UintptrFromInt32(0) {
  3735. return int32(_XML_STATUS_ERROR)
  3736. } else {
  3737. libc.Xmemcpy(tls, buff, s, libc.Uint64FromInt32(len1))
  3738. return XXML_ParseBuffer(tls, parser, len1, isFinal)
  3739. }
  3740. }
  3741. return r
  3742. }
  3743. func XXML_ParseBuffer(tls *libc.TLS, parser TXML_Parser, len1 int32, isFinal int32) (r _XML_Status) {
  3744. var result _XML_Status
  3745. var start uintptr
  3746. _, _ = result, start
  3747. result = int32(_XML_STATUS_OK)
  3748. if parser == libc.UintptrFromInt32(0) {
  3749. return int32(_XML_STATUS_ERROR)
  3750. }
  3751. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3752. case int32(_XML_SUSPENDED):
  3753. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3754. return int32(_XML_STATUS_ERROR)
  3755. case int32(_XML_FINISHED):
  3756. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3757. return int32(_XML_STATUS_ERROR)
  3758. case int32(_XML_INITIALIZED):
  3759. /* Has someone called XML_GetBuffer successfully before? */
  3760. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0) {
  3761. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_BUFFER)
  3762. return int32(_XML_STATUS_ERROR)
  3763. }
  3764. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser == libc.UintptrFromInt32(0) && !(_startParsing(tls, parser) != 0) {
  3765. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3766. return int32(_XML_STATUS_ERROR)
  3767. }
  3768. /* fall through */
  3769. fallthrough
  3770. default:
  3771. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_PARSING)
  3772. }
  3773. start = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3774. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = start
  3775. *(*uintptr)(unsafe.Pointer(parser + 56)) += uintptr(len1)
  3776. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd
  3777. *(*TXML_Index)(unsafe.Pointer(parser + 72)) += int64(len1)
  3778. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer = libc.Uint8FromInt32(isFinal)
  3779. (*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)
  3780. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode != int32(_XML_ERROR_NONE) {
  3781. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  3782. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_errorProcessor)
  3783. return int32(_XML_STATUS_ERROR)
  3784. } else {
  3785. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3786. case int32(_XML_SUSPENDED):
  3787. result = int32(_XML_STATUS_SUSPENDED)
  3788. case int32(_XML_INITIALIZED):
  3789. fallthrough
  3790. case int32(_XML_PARSING):
  3791. if isFinal != 0 {
  3792. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3793. return result
  3794. }
  3795. fallthrough
  3796. default: /* should not happen */
  3797. }
  3798. }
  3799. (*(*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)
  3800. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3801. return result
  3802. }
  3803. func XXML_GetBuffer(tls *libc.TLS, parser TXML_Parser, len1 int32) (r uintptr) {
  3804. var bufferSize, keep, neededSize, offset int32
  3805. var newBuf, v10, v11 uintptr
  3806. var v1, v2, v3, v4, v5, v6, v7, v8, v9 int64
  3807. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bufferSize, keep, neededSize, newBuf, offset, v1, v10, v11, v2, v3, v4, v5, v6, v7, v8, v9
  3808. if parser == libc.UintptrFromInt32(0) {
  3809. return libc.UintptrFromInt32(0)
  3810. }
  3811. if len1 < 0 {
  3812. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3813. return libc.UintptrFromInt32(0)
  3814. }
  3815. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3816. case int32(_XML_SUSPENDED):
  3817. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3818. return libc.UintptrFromInt32(0)
  3819. case int32(_XML_FINISHED):
  3820. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3821. return libc.UintptrFromInt32(0)
  3822. default:
  3823. }
  3824. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 {
  3825. v1 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd)
  3826. } else {
  3827. v1 = 0
  3828. }
  3829. if int64(len1) > v1 {
  3830. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3831. v2 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3832. } else {
  3833. v2 = 0
  3834. }
  3835. /* Do not invoke signed arithmetic overflow: */
  3836. neededSize = libc.Int32FromUint32(libc.Uint32FromInt32(len1) + libc.Uint32FromInt64(v2))
  3837. if neededSize < 0 {
  3838. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3839. return libc.UintptrFromInt32(0)
  3840. }
  3841. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3842. v3 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3843. } else {
  3844. v3 = 0
  3845. }
  3846. keep = int32(v3)
  3847. if keep > int32(m_XML_CONTEXT_BYTES) {
  3848. keep = int32(m_XML_CONTEXT_BYTES)
  3849. }
  3850. /* Detect and prevent integer overflow */
  3851. if keep > int32(m_INT_MAX)-neededSize {
  3852. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3853. return libc.UintptrFromInt32(0)
  3854. }
  3855. neededSize += keep
  3856. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3857. v4 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3858. } else {
  3859. v4 = 0
  3860. }
  3861. if int64(neededSize) <= v4 {
  3862. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3863. v5 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3864. } else {
  3865. v5 = 0
  3866. }
  3867. if int64(keep) < v5 {
  3868. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3869. v6 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3870. } else {
  3871. v6 = 0
  3872. }
  3873. offset = int32(v6) - keep
  3874. /* The buffer pointers cannot be NULL here; we have at least some bytes
  3875. * in the buffer */
  3876. 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)))
  3877. *(*uintptr)(unsafe.Pointer(parser + 56)) -= uintptr(offset)
  3878. *(*uintptr)(unsafe.Pointer(parser + 48)) -= uintptr(offset)
  3879. }
  3880. } else {
  3881. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3882. v7 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3883. } else {
  3884. v7 = 0
  3885. }
  3886. bufferSize = int32(v7)
  3887. if bufferSize == 0 {
  3888. bufferSize = int32(m_INIT_BUFFER_SIZE)
  3889. }
  3890. for cond := true; cond; cond = bufferSize < neededSize && bufferSize > 0 {
  3891. /* Do not invoke signed arithmetic overflow: */
  3892. bufferSize = libc.Int32FromUint32(libc.Uint32FromUint32(2) * libc.Uint32FromInt32(bufferSize))
  3893. }
  3894. if bufferSize <= 0 {
  3895. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3896. return libc.UintptrFromInt32(0)
  3897. }
  3898. newBuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32(bufferSize))
  3899. if newBuf == uintptr(0) {
  3900. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3901. return libc.UintptrFromInt32(0)
  3902. }
  3903. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim = newBuf + uintptr(bufferSize)
  3904. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3905. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3906. v8 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3907. } else {
  3908. v8 = 0
  3909. }
  3910. libc.Xmemcpy(tls, newBuf, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr+uintptr(-keep), libc.Uint64FromInt64(v8+int64(keep)))
  3911. (*(*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)
  3912. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer = newBuf
  3913. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3914. v9 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3915. } else {
  3916. v9 = 0
  3917. }
  3918. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer + uintptr(v9) + uintptr(keep)
  3919. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer + uintptr(keep)
  3920. } else {
  3921. /* This must be a brand new buffer with no data in it yet */
  3922. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd = newBuf
  3923. v10 = newBuf
  3924. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer = v10
  3925. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr = v10
  3926. }
  3927. }
  3928. v11 = libc.UintptrFromInt32(0)
  3929. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = v11
  3930. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = v11
  3931. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = libc.UintptrFromInt32(0)
  3932. }
  3933. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd
  3934. }
  3935. func XXML_StopParser(tls *libc.TLS, parser TXML_Parser, resumable TXML_Bool) (r _XML_Status) {
  3936. if parser == libc.UintptrFromInt32(0) {
  3937. return int32(_XML_STATUS_ERROR)
  3938. }
  3939. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3940. case int32(_XML_SUSPENDED):
  3941. if resumable != 0 {
  3942. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3943. return int32(_XML_STATUS_ERROR)
  3944. }
  3945. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3946. case int32(_XML_FINISHED):
  3947. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3948. return int32(_XML_STATUS_ERROR)
  3949. default:
  3950. if resumable != 0 {
  3951. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0 {
  3952. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPEND_PE)
  3953. return int32(_XML_STATUS_ERROR)
  3954. }
  3955. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_SUSPENDED)
  3956. } else {
  3957. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3958. }
  3959. }
  3960. return int32(_XML_STATUS_OK)
  3961. }
  3962. func XXML_ResumeParser(tls *libc.TLS, parser TXML_Parser) (r _XML_Status) {
  3963. var result _XML_Status
  3964. _ = result
  3965. result = int32(_XML_STATUS_OK)
  3966. if parser == libc.UintptrFromInt32(0) {
  3967. return int32(_XML_STATUS_ERROR)
  3968. }
  3969. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing != int32(_XML_SUSPENDED) {
  3970. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NOT_SUSPENDED)
  3971. return int32(_XML_STATUS_ERROR)
  3972. }
  3973. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_PARSING)
  3974. (*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)
  3975. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode != int32(_XML_ERROR_NONE) {
  3976. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  3977. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_errorProcessor)
  3978. return int32(_XML_STATUS_ERROR)
  3979. } else {
  3980. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3981. case int32(_XML_SUSPENDED):
  3982. result = int32(_XML_STATUS_SUSPENDED)
  3983. case int32(_XML_INITIALIZED):
  3984. fallthrough
  3985. case int32(_XML_PARSING):
  3986. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0 {
  3987. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3988. return result
  3989. }
  3990. fallthrough
  3991. default:
  3992. }
  3993. }
  3994. (*(*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)
  3995. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3996. return result
  3997. }
  3998. func XXML_GetParsingStatus(tls *libc.TLS, parser TXML_Parser, status uintptr) {
  3999. if parser == libc.UintptrFromInt32(0) {
  4000. return
  4001. }
  4002. *(*TXML_ParsingStatus)(unsafe.Pointer(status)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus
  4003. }
  4004. func XXML_GetErrorCode(tls *libc.TLS, parser TXML_Parser) (r _XML_Error) {
  4005. if parser == libc.UintptrFromInt32(0) {
  4006. return int32(_XML_ERROR_INVALID_ARGUMENT)
  4007. }
  4008. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode
  4009. }
  4010. func XXML_GetCurrentByteIndex(tls *libc.TLS, parser TXML_Parser) (r TXML_Index) {
  4011. if parser == libc.UintptrFromInt32(0) {
  4012. return int64(-int32(1))
  4013. }
  4014. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 {
  4015. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndByteIndex - (int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr))
  4016. }
  4017. return int64(-int32(1))
  4018. }
  4019. func XXML_GetCurrentByteCount(tls *libc.TLS, parser TXML_Parser) (r int32) {
  4020. if parser == libc.UintptrFromInt32(0) {
  4021. return 0
  4022. }
  4023. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 {
  4024. return int32(int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr))
  4025. }
  4026. return 0
  4027. }
  4028. func XXML_GetInputContext(tls *libc.TLS, parser TXML_Parser, offset uintptr, size uintptr) (r uintptr) {
  4029. if parser == libc.UintptrFromInt32(0) {
  4030. return libc.UintptrFromInt32(0)
  4031. }
  4032. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  4033. if offset != libc.UintptrFromInt32(0) {
  4034. *(*int32)(unsafe.Pointer(offset)) = int32(int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer))
  4035. }
  4036. if size != libc.UintptrFromInt32(0) {
  4037. *(*int32)(unsafe.Pointer(size)) = int32(int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer))
  4038. }
  4039. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer
  4040. }
  4041. return libc.UintptrFromInt32(0)
  4042. }
  4043. func XXML_GetCurrentLineNumber(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.FlineNumber + uint64(1)
  4052. }
  4053. func XXML_GetCurrentColumnNumber(tls *libc.TLS, parser TXML_Parser) (r TXML_Size) {
  4054. if parser == libc.UintptrFromInt32(0) {
  4055. return uint64(0)
  4056. }
  4057. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr >= (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr {
  4058. (*(*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)
  4059. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  4060. }
  4061. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_position.FcolumnNumber
  4062. }
  4063. func XXML_FreeContentModel(tls *libc.TLS, parser TXML_Parser, model uintptr) {
  4064. if parser != libc.UintptrFromInt32(0) {
  4065. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, model)
  4066. }
  4067. }
  4068. func XXML_MemMalloc(tls *libc.TLS, parser TXML_Parser, size Tsize_t) (r uintptr) {
  4069. if parser == libc.UintptrFromInt32(0) {
  4070. return libc.UintptrFromInt32(0)
  4071. }
  4072. return (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, size)
  4073. }
  4074. func XXML_MemRealloc(tls *libc.TLS, parser TXML_Parser, ptr uintptr, size Tsize_t) (r uintptr) {
  4075. if parser == libc.UintptrFromInt32(0) {
  4076. return libc.UintptrFromInt32(0)
  4077. }
  4078. return (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, ptr, size)
  4079. }
  4080. func XXML_MemFree(tls *libc.TLS, parser TXML_Parser, ptr uintptr) {
  4081. if parser != libc.UintptrFromInt32(0) {
  4082. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, ptr)
  4083. }
  4084. }
  4085. func XXML_DefaultCurrent(tls *libc.TLS, parser TXML_Parser) {
  4086. if parser == libc.UintptrFromInt32(0) {
  4087. return
  4088. }
  4089. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4090. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0 {
  4091. _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)
  4092. } else {
  4093. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr)
  4094. }
  4095. }
  4096. }
  4097. func XXML_ErrorString(tls *libc.TLS, code _XML_Error) (r uintptr) {
  4098. switch code {
  4099. case int32(_XML_ERROR_NONE):
  4100. return libc.UintptrFromInt32(0)
  4101. case int32(_XML_ERROR_NO_MEMORY):
  4102. return __ccgo_ts + 138
  4103. case int32(_XML_ERROR_SYNTAX):
  4104. return __ccgo_ts + 152
  4105. case int32(_XML_ERROR_NO_ELEMENTS):
  4106. return __ccgo_ts + 165
  4107. case int32(_XML_ERROR_INVALID_TOKEN):
  4108. return __ccgo_ts + 182
  4109. case int32(_XML_ERROR_UNCLOSED_TOKEN):
  4110. return __ccgo_ts + 214
  4111. case int32(_XML_ERROR_PARTIAL_CHAR):
  4112. return __ccgo_ts + 229
  4113. case int32(_XML_ERROR_TAG_MISMATCH):
  4114. return __ccgo_ts + 247
  4115. case int32(_XML_ERROR_DUPLICATE_ATTRIBUTE):
  4116. return __ccgo_ts + 262
  4117. case int32(_XML_ERROR_JUNK_AFTER_DOC_ELEMENT):
  4118. return __ccgo_ts + 282
  4119. case int32(_XML_ERROR_PARAM_ENTITY_REF):
  4120. return __ccgo_ts + 310
  4121. case int32(_XML_ERROR_UNDEFINED_ENTITY):
  4122. return __ccgo_ts + 345
  4123. case int32(_XML_ERROR_RECURSIVE_ENTITY_REF):
  4124. return __ccgo_ts + 362
  4125. case int32(_XML_ERROR_ASYNC_ENTITY):
  4126. return __ccgo_ts + 389
  4127. case int32(_XML_ERROR_BAD_CHAR_REF):
  4128. return __ccgo_ts + 409
  4129. case int32(_XML_ERROR_BINARY_ENTITY_REF):
  4130. return __ccgo_ts + 447
  4131. case int32(_XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF):
  4132. return __ccgo_ts + 474
  4133. case int32(_XML_ERROR_MISPLACED_XML_PI):
  4134. return __ccgo_ts + 516
  4135. case int32(_XML_ERROR_UNKNOWN_ENCODING):
  4136. return __ccgo_ts + 563
  4137. case int32(_XML_ERROR_INCORRECT_ENCODING):
  4138. return __ccgo_ts + 580
  4139. case int32(_XML_ERROR_UNCLOSED_CDATA_SECTION):
  4140. return __ccgo_ts + 631
  4141. case int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING):
  4142. return __ccgo_ts + 654
  4143. case int32(_XML_ERROR_NOT_STANDALONE):
  4144. return __ccgo_ts + 700
  4145. case int32(_XML_ERROR_UNEXPECTED_STATE):
  4146. return __ccgo_ts + 727
  4147. case int32(_XML_ERROR_ENTITY_DECLARED_IN_PE):
  4148. return __ccgo_ts + 778
  4149. case int32(_XML_ERROR_FEATURE_REQUIRES_XML_DTD):
  4150. return __ccgo_ts + 814
  4151. case int32(_XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING):
  4152. return __ccgo_ts + 866
  4153. /* Added in 1.95.7. */
  4154. fallthrough
  4155. case int32(_XML_ERROR_UNBOUND_PREFIX):
  4156. return __ccgo_ts + 911
  4157. /* Added in 1.95.8. */
  4158. fallthrough
  4159. case int32(_XML_ERROR_UNDECLARING_PREFIX):
  4160. return __ccgo_ts + 926
  4161. case int32(_XML_ERROR_INCOMPLETE_PE):
  4162. return __ccgo_ts + 952
  4163. case int32(_XML_ERROR_XML_DECL):
  4164. return __ccgo_ts + 990
  4165. case int32(_XML_ERROR_TEXT_DECL):
  4166. return __ccgo_ts + 1022
  4167. case int32(_XML_ERROR_PUBLICID):
  4168. return __ccgo_ts + 1055
  4169. case int32(_XML_ERROR_SUSPENDED):
  4170. return __ccgo_ts + 1089
  4171. case int32(_XML_ERROR_NOT_SUSPENDED):
  4172. return __ccgo_ts + 1106
  4173. case int32(_XML_ERROR_ABORTED):
  4174. return __ccgo_ts + 1127
  4175. case int32(_XML_ERROR_FINISHED):
  4176. return __ccgo_ts + 1143
  4177. case int32(_XML_ERROR_SUSPEND_PE):
  4178. return __ccgo_ts + 1160
  4179. /* Added in 2.0.0. */
  4180. fallthrough
  4181. case int32(_XML_ERROR_RESERVED_PREFIX_XML):
  4182. return __ccgo_ts + 1204
  4183. case int32(_XML_ERROR_RESERVED_PREFIX_XMLNS):
  4184. return __ccgo_ts + 1284
  4185. case int32(_XML_ERROR_RESERVED_NAMESPACE_URI):
  4186. return __ccgo_ts + 1343
  4187. /* Added in 2.2.5. */
  4188. fallthrough
  4189. case int32(_XML_ERROR_INVALID_ARGUMENT): /* Constant added in 2.2.1, already */
  4190. return __ccgo_ts + 1407
  4191. /* Added in 2.3.0. */
  4192. fallthrough
  4193. case int32(_XML_ERROR_NO_BUFFER):
  4194. return __ccgo_ts + 1424
  4195. /* Added in 2.4.0. */
  4196. fallthrough
  4197. case int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH):
  4198. return __ccgo_ts + 1486
  4199. }
  4200. return libc.UintptrFromInt32(0)
  4201. }
  4202. func XXML_ExpatVersion(tls *libc.TLS) (r uintptr) {
  4203. /* V1 is used to string-ize the version number. However, it would
  4204. string-ize the actual version macro *names* unless we get them
  4205. substituted before being passed to V1. CPP is defined to expand
  4206. a macro, then rescan for more expansions. Thus, we use V2 to expand
  4207. the version macros, then CPP will expand the resulting V1() macro
  4208. with the correct numerals. */
  4209. /* ### I'm assuming cpp is portable in this respect... */
  4210. return __ccgo_ts + 1555
  4211. }
  4212. func XXML_ExpatVersionInfo(tls *libc.TLS) (r TXML_Expat_Version) {
  4213. var version TXML_Expat_Version
  4214. _ = version
  4215. version.Fmajor = int32(m_XML_MAJOR_VERSION)
  4216. version.Fminor = int32(m_XML_MINOR_VERSION)
  4217. version.Fmicro = m_XML_MICRO_VERSION
  4218. return version
  4219. }
  4220. func XXML_GetFeatureList(tls *libc.TLS) (r uintptr) {
  4221. return uintptr(unsafe.Pointer(&_features))
  4222. }
  4223. var _features = [8]TXML_Feature{
  4224. 0: {
  4225. Ffeature: int32(_XML_FEATURE_SIZEOF_XML_CHAR),
  4226. Fname: __ccgo_ts + 1567,
  4227. Fvalue: int64(1),
  4228. },
  4229. 1: {
  4230. Ffeature: int32(_XML_FEATURE_SIZEOF_XML_LCHAR),
  4231. Fname: __ccgo_ts + 1584,
  4232. Fvalue: int64(1),
  4233. },
  4234. 2: {
  4235. Ffeature: int32(_XML_FEATURE_DTD),
  4236. Fname: __ccgo_ts + 1602,
  4237. },
  4238. 3: {
  4239. Ffeature: int32(_XML_FEATURE_CONTEXT_BYTES),
  4240. Fname: __ccgo_ts + 1610,
  4241. Fvalue: int64(m_XML_CONTEXT_BYTES),
  4242. },
  4243. 4: {
  4244. Ffeature: int32(_XML_FEATURE_NS),
  4245. Fname: __ccgo_ts + 1628,
  4246. },
  4247. 5: {
  4248. Ffeature: int32(_XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT),
  4249. Fname: __ccgo_ts + 1635,
  4250. Fvalue: libc.Int64FromFloat32(100),
  4251. },
  4252. 6: {
  4253. Ffeature: int32(_XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT),
  4254. Fname: __ccgo_ts + 1652,
  4255. Fvalue: int64(m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT),
  4256. },
  4257. 7: {},
  4258. }
  4259. func XXML_SetBillionLaughsAttackProtectionMaximumAmplification(tls *libc.TLS, parser TXML_Parser, maximumAmplificationFactor float32) (r TXML_Bool) {
  4260. bp := tls.Alloc(16)
  4261. defer tls.Free(16)
  4262. var v1 uint32
  4263. var v3 bool
  4264. var _ /* __u at bp+0 */ struct {
  4265. F__i [0]uint32
  4266. F__f float32
  4267. }
  4268. _, _ = v1, v3
  4269. if v3 = parser == libc.UintptrFromInt32(0) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != libc.UintptrFromInt32(0); !v3 {
  4270. *(*float32)(unsafe.Pointer(bp)) = maximumAmplificationFactor
  4271. v1 = *(*uint32)(unsafe.Pointer(bp))
  4272. goto _2
  4273. _2:
  4274. }
  4275. if v3 || libc.BoolInt32(v1&uint32(0x7fffffff) > uint32(0x7f800000)) != 0 || maximumAmplificationFactor < libc.Float32FromFloat32(1) {
  4276. return libc.Uint8FromInt32(0)
  4277. }
  4278. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FmaximumAmplificationFactor = maximumAmplificationFactor
  4279. return libc.Uint8FromInt32(1)
  4280. }
  4281. func XXML_SetBillionLaughsAttackProtectionActivationThreshold(tls *libc.TLS, parser TXML_Parser, activationThresholdBytes uint64) (r TXML_Bool) {
  4282. if parser == libc.UintptrFromInt32(0) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != libc.UintptrFromInt32(0) {
  4283. return libc.Uint8FromInt32(0)
  4284. }
  4285. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FactivationThresholdBytes = activationThresholdBytes
  4286. return libc.Uint8FromInt32(1)
  4287. }
  4288. // C documentation
  4289. //
  4290. // /* Initially tag->rawName always points into the parse buffer;
  4291. // for those TAG instances opened while the current parse buffer was
  4292. // processed, and not yet closed, we need to store tag->rawName in a more
  4293. // permanent location, since the parse buffer is about to be discarded.
  4294. // */
  4295. func _storeRawNames(tls *libc.TLS, parser TXML_Parser) (r TXML_Bool) {
  4296. var bufSize, nameLen int32
  4297. var rawNameBuf, tag, temp uintptr
  4298. var rawNameLen Tsize_t
  4299. _, _, _, _, _, _ = bufSize, nameLen, rawNameBuf, rawNameLen, tag, temp
  4300. tag = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  4301. for tag != 0 {
  4302. nameLen = libc.Int32FromUint64(uint64(1) * libc.Uint64FromInt32((*TTAG)(unsafe.Pointer(tag)).Fname.FstrLen+libc.Int32FromInt32(1)))
  4303. rawNameBuf = (*TTAG)(unsafe.Pointer(tag)).Fbuf + uintptr(nameLen)
  4304. /* Stop if already stored. Since m_tagStack is a stack, we can stop
  4305. at the first entry that has already been copied; everything
  4306. below it in the stack is already been accounted for in a
  4307. previous call to this function.
  4308. */
  4309. if (*TTAG)(unsafe.Pointer(tag)).FrawName == rawNameBuf {
  4310. break
  4311. }
  4312. /* For re-use purposes we need to ensure that the
  4313. size of tag->buf is a multiple of sizeof(XML_Char).
  4314. */
  4315. rawNameLen = (libc.Uint64FromInt32((*TTAG)(unsafe.Pointer(tag)).FrawNameLength) + (libc.Uint64FromInt64(1) - libc.Uint64FromInt32(1))) & ^(libc.Uint64FromInt64(1) - libc.Uint64FromInt32(1))
  4316. /* Detect and prevent integer overflow. */
  4317. if rawNameLen > libc.Uint64FromInt32(m_INT_MAX)-libc.Uint64FromInt32(nameLen) {
  4318. return libc.Uint8FromInt32(0)
  4319. }
  4320. bufSize = nameLen + libc.Int32FromUint64(rawNameLen)
  4321. if int64(bufSize) > int64((*TTAG)(unsafe.Pointer(tag)).FbufEnd)-int64((*TTAG)(unsafe.Pointer(tag)).Fbuf) {
  4322. 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))
  4323. if temp == libc.UintptrFromInt32(0) {
  4324. return libc.Uint8FromInt32(0)
  4325. }
  4326. /* if tag->name.str points to tag->buf (only when namespace
  4327. processing is off) then we have to update it
  4328. */
  4329. if (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr == (*TTAG)(unsafe.Pointer(tag)).Fbuf {
  4330. (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr = temp
  4331. }
  4332. /* if tag->name.localPart is set (when namespace processing is on)
  4333. then update it as well, since it will always point into tag->buf
  4334. */
  4335. if (*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart != 0 {
  4336. (*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart = temp + uintptr(int64((*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart)-int64((*TTAG)(unsafe.Pointer(tag)).Fbuf))
  4337. }
  4338. (*TTAG)(unsafe.Pointer(tag)).Fbuf = temp
  4339. (*TTAG)(unsafe.Pointer(tag)).FbufEnd = temp + uintptr(bufSize)
  4340. rawNameBuf = temp + uintptr(nameLen)
  4341. }
  4342. libc.Xmemcpy(tls, rawNameBuf, (*TTAG)(unsafe.Pointer(tag)).FrawName, libc.Uint64FromInt32((*TTAG)(unsafe.Pointer(tag)).FrawNameLength))
  4343. (*TTAG)(unsafe.Pointer(tag)).FrawName = rawNameBuf
  4344. tag = (*TTAG)(unsafe.Pointer(tag)).Fparent
  4345. }
  4346. return libc.Uint8FromInt32(1)
  4347. }
  4348. func _contentProcessor(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4349. var result _XML_Error
  4350. _ = result
  4351. 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))
  4352. if result == int32(_XML_ERROR_NONE) {
  4353. if !(_storeRawNames(tls, parser) != 0) {
  4354. return int32(_XML_ERROR_NO_MEMORY)
  4355. }
  4356. }
  4357. return result
  4358. }
  4359. func _externalEntityInitProcessor(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4360. var result _XML_Error
  4361. _ = result
  4362. result = _initializeEncoding(tls, parser)
  4363. if result != int32(_XML_ERROR_NONE) {
  4364. return result
  4365. }
  4366. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityInitProcessor2)
  4367. return _externalEntityInitProcessor2(tls, parser, start, end, endPtr)
  4368. }
  4369. func _externalEntityInitProcessor2(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4370. bp := tls.Alloc(16)
  4371. defer tls.Free(16)
  4372. var tok int32
  4373. var _ /* next at bp+0 */ uintptr
  4374. _ = tok
  4375. *(*uintptr)(unsafe.Pointer(bp)) = start /* XmlContentTok doesn't always set the last arg */
  4376. 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)
  4377. switch tok {
  4378. case int32(m_XML_TOK_BOM):
  4379. if !(_accountingDiffTolerated(tls, parser, tok, start, *(*uintptr)(unsafe.Pointer(bp)), int32(2649), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  4380. _accountingOnAbort(tls, parser)
  4381. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  4382. }
  4383. /* If we are at the end of the buffer, this would cause the next stage,
  4384. i.e. externalEntityInitProcessor3, to pass control directly to
  4385. doContent (by detecting XML_TOK_NONE) without processing any xml text
  4386. declaration - causing the error XML_ERROR_MISPLACED_XML_PI in doContent.
  4387. */
  4388. if *(*uintptr)(unsafe.Pointer(bp)) == end && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4389. *(*uintptr)(unsafe.Pointer(endPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4390. return int32(_XML_ERROR_NONE)
  4391. }
  4392. start = *(*uintptr)(unsafe.Pointer(bp))
  4393. case -int32(1):
  4394. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4395. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4396. return int32(_XML_ERROR_NONE)
  4397. }
  4398. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  4399. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  4400. case -int32(2):
  4401. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4402. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4403. return int32(_XML_ERROR_NONE)
  4404. }
  4405. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  4406. return int32(_XML_ERROR_PARTIAL_CHAR)
  4407. }
  4408. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityInitProcessor3)
  4409. return _externalEntityInitProcessor3(tls, parser, start, end, endPtr)
  4410. }
  4411. func _externalEntityInitProcessor3(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4412. bp := tls.Alloc(16)
  4413. defer tls.Free(16)
  4414. var result _XML_Error
  4415. var tok int32
  4416. var _ /* next at bp+0 */ uintptr
  4417. _, _ = result, tok
  4418. *(*uintptr)(unsafe.Pointer(bp)) = start /* XmlContentTok doesn't always set the last arg */
  4419. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  4420. 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)
  4421. /* Note: These bytes are accounted later in:
  4422. - processXmlDecl
  4423. - externalEntityContentProcessor
  4424. */
  4425. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = *(*uintptr)(unsafe.Pointer(bp))
  4426. switch tok {
  4427. case int32(m_XML_TOK_XML_DECL):
  4428. result = _processXmlDecl(tls, parser, int32(1), start, *(*uintptr)(unsafe.Pointer(bp)))
  4429. if result != int32(_XML_ERROR_NONE) {
  4430. return result
  4431. }
  4432. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  4433. case int32(_XML_SUSPENDED):
  4434. *(*uintptr)(unsafe.Pointer(endPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4435. return int32(_XML_ERROR_NONE)
  4436. case int32(_XML_FINISHED):
  4437. return int32(_XML_ERROR_ABORTED)
  4438. default:
  4439. start = *(*uintptr)(unsafe.Pointer(bp))
  4440. }
  4441. case -int32(1):
  4442. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4443. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4444. return int32(_XML_ERROR_NONE)
  4445. }
  4446. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  4447. case -int32(2):
  4448. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4449. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4450. return int32(_XML_ERROR_NONE)
  4451. }
  4452. return int32(_XML_ERROR_PARTIAL_CHAR)
  4453. }
  4454. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityContentProcessor)
  4455. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel = int32(1)
  4456. return _externalEntityContentProcessor(tls, parser, start, end, endPtr)
  4457. }
  4458. func _externalEntityContentProcessor(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4459. var result _XML_Error
  4460. _ = result
  4461. 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))
  4462. if result == int32(_XML_ERROR_NONE) {
  4463. if !(_storeRawNames(tls, parser) != 0) {
  4464. return int32(_XML_ERROR_NO_MEMORY)
  4465. }
  4466. }
  4467. return result
  4468. }
  4469. 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) {
  4470. bp := tls.Alloc(112)
  4471. defer tls.Free(112)
  4472. *(*uintptr)(unsafe.Pointer(bp)) = _s
  4473. 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
  4474. var bufSize, convLen, len1, n, tok int32
  4475. var charDataHandler TXML_CharacterDataHandler
  4476. var convert_res, convert_res1 _XML_Convert_Result
  4477. var noElmHandlers TXML_Bool
  4478. var result, result1, result2, result3 _XML_Error
  4479. var _ /* bindings at bp+40 */ uintptr
  4480. var _ /* buf at bp+88 */ [4]TXML_Char
  4481. var _ /* c at bp+16 */ TXML_Char
  4482. var _ /* c at bp+92 */ TXML_Char
  4483. var _ /* ch at bp+17 */ TXML_Char
  4484. var _ /* dataPtr at bp+104 */ uintptr
  4485. var _ /* dataPtr at bp+96 */ uintptr
  4486. var _ /* fromPtr at bp+32 */ uintptr
  4487. var _ /* name at bp+48 */ TTAG_NAME
  4488. var _ /* next at bp+8 */ uintptr
  4489. var _ /* toPtr at bp+24 */ uintptr
  4490. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  4491. /* save one level of indirection */
  4492. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  4493. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  4494. eventPP = parser + 544
  4495. eventEndPP = parser + 552
  4496. } else {
  4497. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  4498. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  4499. }
  4500. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  4501. for {
  4502. *(*uintptr)(unsafe.Pointer(bp + 8)) = *(*uintptr)(unsafe.Pointer(bp)) /* XmlContentTok doesn't always set the last arg */
  4503. 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)
  4504. if tok == -int32(5) || tok == -int32(3) {
  4505. if haveMore != 0 {
  4506. v3 = *(*uintptr)(unsafe.Pointer(bp))
  4507. } else {
  4508. v3 = end
  4509. }
  4510. v2 = v3
  4511. } else {
  4512. v2 = *(*uintptr)(unsafe.Pointer(bp + 8))
  4513. }
  4514. accountAfter = v2
  4515. if !(_accountingDiffTolerated(tls, parser, tok, *(*uintptr)(unsafe.Pointer(bp)), accountAfter, int32(2773), account) != 0) {
  4516. _accountingOnAbort(tls, parser)
  4517. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  4518. }
  4519. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  4520. switch tok {
  4521. case -int32(3):
  4522. if haveMore != 0 {
  4523. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4524. return int32(_XML_ERROR_NONE)
  4525. }
  4526. *(*uintptr)(unsafe.Pointer(eventEndPP)) = end
  4527. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4528. *(*TXML_Char)(unsafe.Pointer(bp + 16)) = int8(0xA)
  4529. (*(*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))
  4530. } else {
  4531. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4532. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), end)
  4533. }
  4534. }
  4535. /* We are at the end of the final buffer, should we check for
  4536. XML_SUSPENDED, XML_FINISHED?
  4537. */
  4538. if startTagLevel == 0 {
  4539. return int32(_XML_ERROR_NO_ELEMENTS)
  4540. }
  4541. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel != startTagLevel {
  4542. return int32(_XML_ERROR_ASYNC_ENTITY)
  4543. }
  4544. *(*uintptr)(unsafe.Pointer(nextPtr)) = end
  4545. return int32(_XML_ERROR_NONE)
  4546. case -int32(4):
  4547. if haveMore != 0 {
  4548. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4549. return int32(_XML_ERROR_NONE)
  4550. }
  4551. if startTagLevel > 0 {
  4552. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel != startTagLevel {
  4553. return int32(_XML_ERROR_ASYNC_ENTITY)
  4554. }
  4555. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4556. return int32(_XML_ERROR_NONE)
  4557. }
  4558. return int32(_XML_ERROR_NO_ELEMENTS)
  4559. case m_XML_TOK_INVALID:
  4560. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  4561. return int32(_XML_ERROR_INVALID_TOKEN)
  4562. case -int32(1):
  4563. if haveMore != 0 {
  4564. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4565. return int32(_XML_ERROR_NONE)
  4566. }
  4567. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  4568. case -int32(2):
  4569. if haveMore != 0 {
  4570. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4571. return int32(_XML_ERROR_NONE)
  4572. }
  4573. return int32(_XML_ERROR_PARTIAL_CHAR)
  4574. case int32(m_XML_TOK_ENTITY_REF):
  4575. *(*TXML_Char)(unsafe.Pointer(bp + 17)) = int8((*(*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)))
  4576. if *(*TXML_Char)(unsafe.Pointer(bp + 17)) != 0 {
  4577. /* NOTE: We are replacing 4-6 characters original input for 1 character
  4578. * so there is no amplification and hence recording without
  4579. * protection. */
  4580. _accountingDiffTolerated(tls, parser, tok, bp+17, bp+17+uintptr(1), int32(2839), int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  4581. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4582. (*(*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))
  4583. } else {
  4584. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4585. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4586. }
  4587. }
  4588. break
  4589. }
  4590. 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))
  4591. if !(name != 0) {
  4592. return int32(_XML_ERROR_NO_MEMORY)
  4593. }
  4594. entity = _lookup(tls, parser, dtd, name, uint64(0))
  4595. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  4596. /* First, determine if a check for an existing declaration is needed;
  4597. if yes, check that the entity exists, and that it is internal,
  4598. otherwise call the skipped entity or default handler.
  4599. */
  4600. if !((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0) || (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0 {
  4601. if !(entity != 0) {
  4602. return int32(_XML_ERROR_UNDEFINED_ENTITY)
  4603. } else {
  4604. if !((*TENTITY)(unsafe.Pointer(entity)).Fis_internal != 0) {
  4605. return int32(_XML_ERROR_ENTITY_DECLARED_IN_PE)
  4606. }
  4607. }
  4608. } else {
  4609. if !(entity != 0) {
  4610. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler != 0 {
  4611. (*(*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)
  4612. } else {
  4613. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4614. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4615. }
  4616. }
  4617. break
  4618. }
  4619. }
  4620. if (*TENTITY)(unsafe.Pointer(entity)).Fopen != 0 {
  4621. return int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  4622. }
  4623. if (*TENTITY)(unsafe.Pointer(entity)).Fnotation != 0 {
  4624. return int32(_XML_ERROR_BINARY_ENTITY_REF)
  4625. }
  4626. if (*TENTITY)(unsafe.Pointer(entity)).FtextPtr != 0 {
  4627. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities != 0) {
  4628. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler != 0 {
  4629. (*(*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)
  4630. } else {
  4631. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4632. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4633. }
  4634. }
  4635. break
  4636. }
  4637. result = _processInternalEntity(tls, parser, entity, libc.Uint8FromInt32(0))
  4638. if result != int32(_XML_ERROR_NONE) {
  4639. return result
  4640. }
  4641. } else {
  4642. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  4643. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  4644. context = _getContext(tls, parser)
  4645. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  4646. if !(context != 0) {
  4647. return int32(_XML_ERROR_NO_MEMORY)
  4648. }
  4649. 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) {
  4650. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  4651. }
  4652. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  4653. } else {
  4654. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4655. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4656. }
  4657. }
  4658. }
  4659. case int32(m_XML_TOK_START_TAG_NO_ATTS):
  4660. /* fall through */
  4661. fallthrough
  4662. case int32(m_XML_TOK_START_TAG_WITH_ATTS):
  4663. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList != 0 {
  4664. tag = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  4665. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = (*TTAG)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList)).Fparent
  4666. } else {
  4667. tag = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(88))
  4668. if !(tag != 0) {
  4669. return int32(_XML_ERROR_NO_MEMORY)
  4670. }
  4671. (*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)))
  4672. if !((*TTAG)(unsafe.Pointer(tag)).Fbuf != 0) {
  4673. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, tag)
  4674. return int32(_XML_ERROR_NO_MEMORY)
  4675. }
  4676. (*TTAG)(unsafe.Pointer(tag)).FbufEnd = (*TTAG)(unsafe.Pointer(tag)).Fbuf + uintptr(m_INIT_TAG_BUF_SIZE)
  4677. }
  4678. (*TTAG)(unsafe.Pointer(tag)).Fbindings = libc.UintptrFromInt32(0)
  4679. (*TTAG)(unsafe.Pointer(tag)).Fparent = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  4680. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack = tag
  4681. (*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart = libc.UintptrFromInt32(0)
  4682. (*TTAG)(unsafe.Pointer(tag)).Fname.Fprefix = libc.UintptrFromInt32(0)
  4683. (*TTAG)(unsafe.Pointer(tag)).FrawName = *(*uintptr)(unsafe.Pointer(bp)) + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  4684. (*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)
  4685. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel++
  4686. rawNameEnd = (*TTAG)(unsafe.Pointer(tag)).FrawName + uintptr((*TTAG)(unsafe.Pointer(tag)).FrawNameLength)
  4687. *(*uintptr)(unsafe.Pointer(bp + 32)) = (*TTAG)(unsafe.Pointer(tag)).FrawName
  4688. *(*uintptr)(unsafe.Pointer(bp + 24)) = (*TTAG)(unsafe.Pointer(tag)).Fbuf
  4689. for {
  4690. 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))
  4691. convLen = int32(int64(*(*uintptr)(unsafe.Pointer(bp + 24))) - int64((*TTAG)(unsafe.Pointer(tag)).Fbuf))
  4692. if *(*uintptr)(unsafe.Pointer(bp + 32)) >= rawNameEnd || convert_res == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  4693. (*TTAG)(unsafe.Pointer(tag)).Fname.FstrLen = convLen
  4694. break
  4695. }
  4696. bufSize = int32(int64((*TTAG)(unsafe.Pointer(tag)).FbufEnd)-int64((*TTAG)(unsafe.Pointer(tag)).Fbuf)) << int32(1)
  4697. 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))
  4698. if temp == libc.UintptrFromInt32(0) {
  4699. return int32(_XML_ERROR_NO_MEMORY)
  4700. }
  4701. (*TTAG)(unsafe.Pointer(tag)).Fbuf = temp
  4702. (*TTAG)(unsafe.Pointer(tag)).FbufEnd = temp + uintptr(bufSize)
  4703. *(*uintptr)(unsafe.Pointer(bp + 24)) = temp + uintptr(convLen)
  4704. goto _4
  4705. _4:
  4706. }
  4707. (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr = (*TTAG)(unsafe.Pointer(tag)).Fbuf
  4708. *(*TXML_Char)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24)))) = int8('\000')
  4709. result1 = _storeAtts(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), tag+24, tag+80, account)
  4710. if result1 != 0 {
  4711. return result1
  4712. }
  4713. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler != 0 {
  4714. (*(*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)
  4715. } else {
  4716. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4717. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4718. }
  4719. }
  4720. _poolClear(tls, parser+784)
  4721. case int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS):
  4722. /* fall through */
  4723. fallthrough
  4724. case int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS):
  4725. rawName = *(*uintptr)(unsafe.Pointer(bp)) + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  4726. *(*uintptr)(unsafe.Pointer(bp + 40)) = libc.UintptrFromInt32(0)
  4727. noElmHandlers = libc.Uint8FromInt32(1)
  4728. (*(*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)))
  4729. if !((*(*TTAG_NAME)(unsafe.Pointer(bp + 48))).Fstr != 0) {
  4730. return int32(_XML_ERROR_NO_MEMORY)
  4731. }
  4732. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  4733. result2 = _storeAtts(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), bp+48, bp+40, int32(_XML_ACCOUNT_NONE))
  4734. if result2 != int32(_XML_ERROR_NONE) {
  4735. _freeBindings(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 40)))
  4736. return result2
  4737. }
  4738. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  4739. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler != 0 {
  4740. (*(*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)
  4741. noElmHandlers = libc.Uint8FromInt32(0)
  4742. }
  4743. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler != 0 {
  4744. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler != 0 {
  4745. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(eventEndPP))
  4746. }
  4747. (*(*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)
  4748. noElmHandlers = libc.Uint8FromInt32(0)
  4749. }
  4750. if noElmHandlers != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4751. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4752. }
  4753. _poolClear(tls, parser+784)
  4754. _freeBindings(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 40)))
  4755. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel == 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing != int32(_XML_FINISHED) {
  4756. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  4757. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_epilogProcessor)
  4758. } else {
  4759. return _epilogProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 8)), end, nextPtr)
  4760. }
  4761. }
  4762. case int32(m_XML_TOK_END_TAG):
  4763. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel == startTagLevel {
  4764. return int32(_XML_ERROR_ASYNC_ENTITY)
  4765. } else {
  4766. tag1 = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  4767. rawName1 = *(*uintptr)(unsafe.Pointer(bp)) + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(2))
  4768. len1 = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameLength})))(tls, enc, rawName1)
  4769. if len1 != (*TTAG)(unsafe.Pointer(tag1)).FrawNameLength || libc.Xmemcmp(tls, (*TTAG)(unsafe.Pointer(tag1)).FrawName, rawName1, libc.Uint64FromInt32(len1)) != 0 {
  4770. *(*uintptr)(unsafe.Pointer(eventPP)) = rawName1
  4771. return int32(_XML_ERROR_TAG_MISMATCH)
  4772. }
  4773. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack = (*TTAG)(unsafe.Pointer(tag1)).Fparent
  4774. (*TTAG)(unsafe.Pointer(tag1)).Fparent = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  4775. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = tag1
  4776. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel--
  4777. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler != 0 {
  4778. localPart = (*TTAG)(unsafe.Pointer(tag1)).Fname.FlocalPart
  4779. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 && localPart != 0 {
  4780. /* localPart and prefix may have been overwritten in
  4781. tag->name.str, since this points to the binding->uri
  4782. buffer which gets re-used; so we have to add them again
  4783. */
  4784. uri = (*TTAG)(unsafe.Pointer(tag1)).Fname.Fstr + uintptr((*TTAG)(unsafe.Pointer(tag1)).Fname.FuriLen)
  4785. /* don't need to check for space - already done in storeAtts() */
  4786. for *(*TXML_Char)(unsafe.Pointer(localPart)) != 0 {
  4787. v5 = uri
  4788. uri++
  4789. v6 = localPart
  4790. localPart++
  4791. *(*TXML_Char)(unsafe.Pointer(v5)) = *(*TXML_Char)(unsafe.Pointer(v6))
  4792. }
  4793. prefix = (*TTAG)(unsafe.Pointer(tag1)).Fname.Fprefix
  4794. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets != 0 && prefix != 0 {
  4795. v7 = uri
  4796. uri++
  4797. *(*TXML_Char)(unsafe.Pointer(v7)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  4798. for *(*TXML_Char)(unsafe.Pointer(prefix)) != 0 {
  4799. v8 = uri
  4800. uri++
  4801. v9 = prefix
  4802. prefix++
  4803. *(*TXML_Char)(unsafe.Pointer(v8)) = *(*TXML_Char)(unsafe.Pointer(v9))
  4804. }
  4805. }
  4806. *(*TXML_Char)(unsafe.Pointer(uri)) = int8('\000')
  4807. }
  4808. (*(*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)
  4809. } else {
  4810. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4811. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4812. }
  4813. }
  4814. for (*TTAG)(unsafe.Pointer(tag1)).Fbindings != 0 {
  4815. b = (*TTAG)(unsafe.Pointer(tag1)).Fbindings
  4816. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler != 0 {
  4817. (*(*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)
  4818. }
  4819. (*TTAG)(unsafe.Pointer(tag1)).Fbindings = (*TBINDING)(unsafe.Pointer((*TTAG)(unsafe.Pointer(tag1)).Fbindings)).FnextTagBinding
  4820. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  4821. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = b
  4822. (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fbinding = (*TBINDING)(unsafe.Pointer(b)).FprevPrefixBinding
  4823. }
  4824. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel == 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing != int32(_XML_FINISHED) {
  4825. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  4826. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_epilogProcessor)
  4827. } else {
  4828. return _epilogProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 8)), end, nextPtr)
  4829. }
  4830. }
  4831. }
  4832. case int32(m_XML_TOK_CHAR_REF):
  4833. n = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FcharRefNumber})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp)))
  4834. if n < 0 {
  4835. return int32(_XML_ERROR_BAD_CHAR_REF)
  4836. }
  4837. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4838. (*(*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))
  4839. } else {
  4840. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4841. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4842. }
  4843. }
  4844. case int32(m_XML_TOK_XML_DECL):
  4845. return int32(_XML_ERROR_MISPLACED_XML_PI)
  4846. case int32(m_XML_TOK_DATA_NEWLINE):
  4847. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4848. *(*TXML_Char)(unsafe.Pointer(bp + 92)) = int8(0xA)
  4849. (*(*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))
  4850. } else {
  4851. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4852. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4853. }
  4854. }
  4855. case int32(m_XML_TOK_CDATA_SECT_OPEN):
  4856. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler != 0 {
  4857. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg)
  4858. } else {
  4859. if libc.Bool(0 != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4860. (*(*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)
  4861. } else {
  4862. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4863. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4864. }
  4865. }
  4866. }
  4867. result3 = _doCdataSection(tls, parser, enc, bp+8, end, nextPtr, haveMore, account)
  4868. if result3 != int32(_XML_ERROR_NONE) {
  4869. return result3
  4870. } else {
  4871. if !(*(*uintptr)(unsafe.Pointer(bp + 8)) != 0) {
  4872. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_cdataSectionProcessor)
  4873. return result3
  4874. }
  4875. }
  4876. case -int32(5):
  4877. if haveMore != 0 {
  4878. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4879. return int32(_XML_ERROR_NONE)
  4880. }
  4881. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4882. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  4883. *(*uintptr)(unsafe.Pointer(bp + 96)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  4884. (*(*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)
  4885. (*(*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)))
  4886. } else {
  4887. (*(*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)))))
  4888. }
  4889. } else {
  4890. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4891. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), end)
  4892. }
  4893. }
  4894. /* We are at the end of the final buffer, should we check for
  4895. XML_SUSPENDED, XML_FINISHED?
  4896. */
  4897. if startTagLevel == 0 {
  4898. *(*uintptr)(unsafe.Pointer(eventPP)) = end
  4899. return int32(_XML_ERROR_NO_ELEMENTS)
  4900. }
  4901. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel != startTagLevel {
  4902. *(*uintptr)(unsafe.Pointer(eventPP)) = end
  4903. return int32(_XML_ERROR_ASYNC_ENTITY)
  4904. }
  4905. *(*uintptr)(unsafe.Pointer(nextPtr)) = end
  4906. return int32(_XML_ERROR_NONE)
  4907. case int32(m_XML_TOK_DATA_CHARS):
  4908. charDataHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler
  4909. if charDataHandler != 0 {
  4910. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  4911. for {
  4912. *(*uintptr)(unsafe.Pointer(bp + 104)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  4913. 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)
  4914. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  4915. (*(*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)))
  4916. if convert_res1 == int32(_XML_CONVERT_COMPLETED) || convert_res1 == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  4917. break
  4918. }
  4919. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  4920. goto _10
  4921. _10:
  4922. }
  4923. } else {
  4924. (*(*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)))))
  4925. }
  4926. } else {
  4927. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4928. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4929. }
  4930. }
  4931. case int32(m_XML_TOK_PI):
  4932. if !(_reportProcessingInstruction(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8))) != 0) {
  4933. return int32(_XML_ERROR_NO_MEMORY)
  4934. }
  4935. case int32(m_XML_TOK_COMMENT):
  4936. if !(_reportComment(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8))) != 0) {
  4937. return int32(_XML_ERROR_NO_MEMORY)
  4938. }
  4939. default:
  4940. /* All of the tokens produced by XmlContentTok() have their own
  4941. * explicit cases, so this default is not strictly necessary.
  4942. * However it is a useful safety net, so we retain the code and
  4943. * simply exclude it from the coverage tests.
  4944. *
  4945. * LCOV_EXCL_START
  4946. */
  4947. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4948. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4949. }
  4950. break
  4951. /* LCOV_EXCL_STOP */
  4952. }
  4953. v11 = *(*uintptr)(unsafe.Pointer(bp + 8))
  4954. *(*uintptr)(unsafe.Pointer(bp)) = v11
  4955. *(*uintptr)(unsafe.Pointer(eventPP)) = v11
  4956. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  4957. case int32(_XML_SUSPENDED):
  4958. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  4959. return int32(_XML_ERROR_NONE)
  4960. case int32(_XML_FINISHED):
  4961. return int32(_XML_ERROR_ABORTED)
  4962. default:
  4963. }
  4964. goto _1
  4965. _1:
  4966. }
  4967. /* not reached */
  4968. return r
  4969. }
  4970. // C documentation
  4971. //
  4972. // /* This function does not call free() on the allocated memory, merely
  4973. // * moving it to the parser's m_freeBindingList where it can be freed or
  4974. // * reused as appropriate.
  4975. // */
  4976. func _freeBindings(tls *libc.TLS, parser TXML_Parser, bindings uintptr) {
  4977. var b uintptr
  4978. _ = b
  4979. for bindings != 0 {
  4980. b = bindings
  4981. /* m_startNamespaceDeclHandler will have been called for this
  4982. * binding in addBindings(), so call the end handler now.
  4983. */
  4984. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler != 0 {
  4985. (*(*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)
  4986. }
  4987. bindings = (*TBINDING)(unsafe.Pointer(bindings)).FnextTagBinding
  4988. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  4989. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = b
  4990. (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fbinding = (*TBINDING)(unsafe.Pointer(b)).FprevPrefixBinding
  4991. }
  4992. }
  4993. // C documentation
  4994. //
  4995. // /* Precondition: all arguments must be non-NULL;
  4996. // Purpose:
  4997. // - normalize attributes
  4998. // - check attributes for well-formedness
  4999. // - generate namespace aware attribute names (URI, prefix)
  5000. // - build list of attributes for startElementHandler
  5001. // - default attributes
  5002. // - process namespace declarations (check and report them)
  5003. // - generate namespace aware element name (URI, prefix)
  5004. // */
  5005. func _storeAtts(tls *libc.TLS, parser TXML_Parser, enc uintptr, attStr uintptr, tagNamePtr uintptr, bindingsPtr uintptr, account _XML_Account) (r _XML_Error) {
  5006. bp := tls.Alloc(80)
  5007. defer tls.Free(80)
  5008. 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
  5009. var attIndex, i, j, j1, n, nDefaultAtts, nPrefixes, oldAttsSize, prefixLen, v13, v17, v2, v23, v30, v33, v38, v40, v6, v7, v8, v9 int32
  5010. var c TXML_Char
  5011. var isCdata TXML_Bool
  5012. var mask, uriHash, version, v14 uint64
  5013. var nsAttsSize uint32
  5014. var oldNsAttsPower, step, v10 uint8
  5015. var result, result1, result2 _XML_Error
  5016. var _ /* sip_key at bp+56 */ Tsipkey
  5017. var _ /* sip_state at bp+0 */ Tsiphash
  5018. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  5019. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* the attribute list for the application */
  5020. attIndex = 0
  5021. nPrefixes = 0
  5022. /* lookup the element type name */
  5023. elementType = _lookup(tls, parser, dtd+40, (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr, uint64(0))
  5024. if !(elementType != 0) {
  5025. name = _poolCopyString(tls, dtd+160, (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr)
  5026. if !(name != 0) {
  5027. return int32(_XML_ERROR_NO_MEMORY)
  5028. }
  5029. elementType = _lookup(tls, parser, dtd+40, name, uint64(40))
  5030. if !(elementType != 0) {
  5031. return int32(_XML_ERROR_NO_MEMORY)
  5032. }
  5033. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 && !(_setElementTypePrefix(tls, parser, elementType) != 0) {
  5034. return int32(_XML_ERROR_NO_MEMORY)
  5035. }
  5036. }
  5037. nDefaultAtts = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FnDefaultAtts
  5038. /* get the attributes from the tokenizer */
  5039. 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)
  5040. /* Detect and prevent integer overflow */
  5041. if n > int32(m_INT_MAX)-nDefaultAtts {
  5042. return int32(_XML_ERROR_NO_MEMORY)
  5043. }
  5044. if n+nDefaultAtts > (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize {
  5045. oldAttsSize = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize
  5046. /* Detect and prevent integer overflow */
  5047. if nDefaultAtts > libc.Int32FromInt32(m_INT_MAX)-libc.Int32FromInt32(m_INIT_ATTS_SIZE) || n > int32(m_INT_MAX)-(nDefaultAtts+int32(m_INIT_ATTS_SIZE)) {
  5048. return int32(_XML_ERROR_NO_MEMORY)
  5049. }
  5050. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = n + nDefaultAtts + int32(m_INIT_ATTS_SIZE)
  5051. /* Detect and prevent integer overflow.
  5052. * The preprocessor guard addresses the "always false" warning
  5053. * from -Wtype-limits on platforms where
  5054. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5055. 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))
  5056. if temp == libc.UintptrFromInt32(0) {
  5057. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = oldAttsSize
  5058. return int32(_XML_ERROR_NO_MEMORY)
  5059. }
  5060. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts = temp
  5061. if n > oldAttsSize {
  5062. (*(*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)
  5063. }
  5064. }
  5065. appAtts = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts
  5066. i = 0
  5067. for {
  5068. if !(i < n) {
  5069. break
  5070. }
  5071. currAtt = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32
  5072. /* add the name and value to the attribute list */
  5073. 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)))
  5074. if !(attId != 0) {
  5075. return int32(_XML_ERROR_NO_MEMORY)
  5076. }
  5077. /* Detect duplicate attributes by their QNames. This does not work when
  5078. namespace processing is turned on and different prefixes for the same
  5079. namespace are used. For this case we have a check further down.
  5080. */
  5081. if *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname + uintptr(-libc.Int32FromInt32(1)))) != 0 {
  5082. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  5083. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).Fname
  5084. }
  5085. return int32(_XML_ERROR_DUPLICATE_ATTRIBUTE)
  5086. }
  5087. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname + uintptr(-libc.Int32FromInt32(1)))) = int8(1)
  5088. v2 = attIndex
  5089. attIndex++
  5090. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v2)*8)) = (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname
  5091. if !((*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).Fnormalized != 0) {
  5092. isCdata = libc.Uint8FromInt32(1)
  5093. /* figure out whether declared as other than CDATA */
  5094. if (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).FmaybeTokenized != 0 {
  5095. j = 0
  5096. for {
  5097. if !(j < nDefaultAtts) {
  5098. break
  5099. }
  5100. if attId == (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FdefaultAtts + uintptr(j)*24))).Fid {
  5101. isCdata = (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FdefaultAtts + uintptr(j)*24))).FisCdata
  5102. break
  5103. }
  5104. goto _3
  5105. _3:
  5106. ;
  5107. j++
  5108. }
  5109. }
  5110. /* normalize the attribute value */
  5111. 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)
  5112. if result != 0 {
  5113. return result
  5114. }
  5115. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)) = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  5116. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  5117. } else {
  5118. /* the value did not need normalizing */
  5119. *(*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)
  5120. if *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)) == uintptr(0) {
  5121. return int32(_XML_ERROR_NO_MEMORY)
  5122. }
  5123. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  5124. }
  5125. /* handle prefixed attribute names */
  5126. if (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fprefix != 0 {
  5127. if (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fxmlns != 0 {
  5128. /* deal with namespace declarations here */
  5129. result1 = _addBinding(tls, parser, (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fprefix, attId, *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)), bindingsPtr)
  5130. if result1 != 0 {
  5131. return result1
  5132. }
  5133. attIndex--
  5134. } else {
  5135. /* deal with other prefixed names later */
  5136. attIndex++
  5137. nPrefixes++
  5138. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname + uintptr(-libc.Int32FromInt32(1)))) = int8(2)
  5139. }
  5140. } else {
  5141. attIndex++
  5142. }
  5143. goto _1
  5144. _1:
  5145. ;
  5146. i++
  5147. }
  5148. /* set-up for XML_GetSpecifiedAttributeCount and XML_GetIdAttributeIndex */
  5149. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nSpecifiedAtts = attIndex
  5150. 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 {
  5151. i = 0
  5152. for {
  5153. if !(i < attIndex) {
  5154. break
  5155. }
  5156. if *(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8)) == (*TATTRIBUTE_ID)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FidAtt)).Fname {
  5157. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_idAttIndex = i
  5158. break
  5159. }
  5160. goto _4
  5161. _4:
  5162. ;
  5163. i += int32(2)
  5164. }
  5165. } else {
  5166. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_idAttIndex = -int32(1)
  5167. }
  5168. /* do attribute defaulting */
  5169. i = 0
  5170. for {
  5171. if !(i < nDefaultAtts) {
  5172. break
  5173. }
  5174. da = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FdefaultAtts + uintptr(i)*24
  5175. 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 {
  5176. if (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fprefix != 0 {
  5177. if (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fxmlns != 0 {
  5178. 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)
  5179. if result2 != 0 {
  5180. return result2
  5181. }
  5182. } else {
  5183. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname + uintptr(-libc.Int32FromInt32(1)))) = int8(2)
  5184. nPrefixes++
  5185. v6 = attIndex
  5186. attIndex++
  5187. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v6)*8)) = (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname
  5188. v7 = attIndex
  5189. attIndex++
  5190. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v7)*8)) = (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fvalue
  5191. }
  5192. } else {
  5193. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname + uintptr(-libc.Int32FromInt32(1)))) = int8(1)
  5194. v8 = attIndex
  5195. attIndex++
  5196. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v8)*8)) = (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname
  5197. v9 = attIndex
  5198. attIndex++
  5199. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v9)*8)) = (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fvalue
  5200. }
  5201. }
  5202. goto _5
  5203. _5:
  5204. ;
  5205. i++
  5206. }
  5207. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)) = uintptr(0)
  5208. /* expand prefixed attribute names, check for duplicates,
  5209. and clear flags that say whether attributes were specified */
  5210. i = 0
  5211. if nPrefixes != 0 { /* hash table index */
  5212. version = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsVersion
  5213. /* Detect and prevent invalid shift */
  5214. if uint64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower) >= libc.Uint64FromInt64(4)*libc.Uint64FromInt32(8) {
  5215. return int32(_XML_ERROR_NO_MEMORY)
  5216. }
  5217. nsAttsSize = uint32(1) << (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower
  5218. oldNsAttsPower = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower
  5219. /* size of hash table must be at least 2 * (# of prefixed attributes) */
  5220. if nPrefixes<<int32(1)>>(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower != 0 {
  5221. /* hash table size must also be a power of 2 and >= 8 */
  5222. for {
  5223. v11 = parser + 760
  5224. v10 = *(*uint8)(unsafe.Pointer(v11))
  5225. *(*uint8)(unsafe.Pointer(v11))++
  5226. if !(nPrefixes>>v10 != 0) {
  5227. break
  5228. }
  5229. }
  5230. if libc.Int32FromUint8((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower) < int32(3) {
  5231. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = uint8(3)
  5232. }
  5233. /* Detect and prevent invalid shift */
  5234. if uint64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower) >= libc.Uint64FromInt64(4)*libc.Uint64FromInt32(8) {
  5235. /* Restore actual size of memory in m_nsAtts */
  5236. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = oldNsAttsPower
  5237. return int32(_XML_ERROR_NO_MEMORY)
  5238. }
  5239. nsAttsSize = uint32(1) << (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower
  5240. /* Detect and prevent integer overflow.
  5241. * The preprocessor guard addresses the "always false" warning
  5242. * from -Wtype-limits on platforms where
  5243. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5244. 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))
  5245. if !(temp1 != 0) {
  5246. /* Restore actual size of memory in m_nsAtts */
  5247. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = oldNsAttsPower
  5248. return int32(_XML_ERROR_NO_MEMORY)
  5249. }
  5250. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts = temp1
  5251. version = uint64(0) /* force re-initialization of m_nsAtts hash table */
  5252. }
  5253. /* using a version flag saves us from initializing m_nsAtts every time */
  5254. if !(version != 0) { /* initialize version flags when version wraps around */
  5255. version = uint64(m_INIT_ATTS_VERSION)
  5256. j1 = libc.Int32FromUint32(nsAttsSize)
  5257. for {
  5258. if !(j1 != 0) {
  5259. break
  5260. }
  5261. j1--
  5262. v13 = j1
  5263. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(v13)*24))).Fversion = version
  5264. goto _12
  5265. _12:
  5266. }
  5267. }
  5268. version--
  5269. v14 = version
  5270. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsVersion = v14
  5271. /* expand prefixed names and check for duplicates */
  5272. for {
  5273. if !(i < attIndex) {
  5274. break
  5275. }
  5276. s = *(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8))
  5277. if int32(*(*TXML_Char)(unsafe.Pointer(s + uintptr(-libc.Int32FromInt32(1))))) == int32(2) {
  5278. _copy_salt_to_sipkey(tls, parser, bp+56)
  5279. _sip24_init(tls, bp, bp+56)
  5280. *(*TXML_Char)(unsafe.Pointer(s + uintptr(-libc.Int32FromInt32(1)))) = 0 /* clear flag */
  5281. id = _lookup(tls, parser, dtd+80, s, uint64(0))
  5282. if !(id != 0) || !((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix != 0) {
  5283. /* This code is walking through the appAtts array, dealing
  5284. * with (in this case) a prefixed attribute name. To be in
  5285. * the array, the attribute must have already been bound, so
  5286. * has to have passed through the hash table lookup once
  5287. * already. That implies that an entry for it already
  5288. * exists, so the lookup above will return a pointer to
  5289. * already allocated memory. There is no opportunaity for
  5290. * the allocator to fail, so the condition above cannot be
  5291. * fulfilled.
  5292. *
  5293. * Since it is difficult to be certain that the above
  5294. * analysis is complete, we retain the test and merely
  5295. * remove the code from coverage tests.
  5296. */
  5297. return int32(_XML_ERROR_NO_MEMORY) /* LCOV_EXCL_LINE */
  5298. }
  5299. b = (*TPREFIX)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix)).Fbinding
  5300. if !(b != 0) {
  5301. return int32(_XML_ERROR_UNBOUND_PREFIX)
  5302. }
  5303. j1 = 0
  5304. for {
  5305. if !(j1 < (*TBINDING)(unsafe.Pointer(b)).FuriLen) {
  5306. break
  5307. }
  5308. c = *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Furi + uintptr(j1)))
  5309. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  5310. v17 = 0
  5311. } else {
  5312. v19 = parser + 784 + 24
  5313. v18 = *(*uintptr)(unsafe.Pointer(v19))
  5314. *(*uintptr)(unsafe.Pointer(v19))++
  5315. *(*TXML_Char)(unsafe.Pointer(v18)) = c
  5316. v17 = libc.Int32FromInt32(1)
  5317. }
  5318. if !(v17 != 0) {
  5319. return int32(_XML_ERROR_NO_MEMORY)
  5320. }
  5321. goto _16
  5322. _16:
  5323. ;
  5324. j1++
  5325. }
  5326. _sip24_update(tls, bp, (*TBINDING)(unsafe.Pointer(b)).Furi, libc.Uint64FromInt32((*TBINDING)(unsafe.Pointer(b)).FuriLen)*uint64(1))
  5327. for {
  5328. v20 = s
  5329. s++
  5330. if !(int32(*(*TXML_Char)(unsafe.Pointer(v20))) != int32(m_ASCII_COLON)) {
  5331. break
  5332. }
  5333. }
  5334. _sip24_update(tls, bp, s, _keylen(tls, s)*uint64(1))
  5335. for { /* copies null terminator */
  5336. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  5337. v23 = 0
  5338. } else {
  5339. v25 = parser + 784 + 24
  5340. v24 = *(*uintptr)(unsafe.Pointer(v25))
  5341. *(*uintptr)(unsafe.Pointer(v25))++
  5342. *(*TXML_Char)(unsafe.Pointer(v24)) = *(*TXML_Char)(unsafe.Pointer(s))
  5343. v23 = libc.Int32FromInt32(1)
  5344. }
  5345. if !(v23 != 0) {
  5346. return int32(_XML_ERROR_NO_MEMORY)
  5347. }
  5348. goto _22
  5349. _22:
  5350. ;
  5351. v21 = s
  5352. s++
  5353. if !(*(*TXML_Char)(unsafe.Pointer(v21)) != 0) {
  5354. break
  5355. }
  5356. }
  5357. uriHash = _sip24_final(tls, bp)
  5358. /* Check hash table for duplicate of expanded name (uriName).
  5359. Derived from code in lookup(parser, HASH_TABLE *table, ...).
  5360. */
  5361. step = uint8(0)
  5362. mask = uint64(nsAttsSize - uint32(1))
  5363. j1 = libc.Int32FromUint64(uriHash & mask) /* index into hash table */
  5364. for (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fversion == version {
  5365. /* for speed we compare stored hash values first */
  5366. if uriHash == (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fhash {
  5367. s1 = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  5368. s2 = (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).FuriName
  5369. /* s1 is null terminated, but not s2 */
  5370. for {
  5371. if !(int32(*(*TXML_Char)(unsafe.Pointer(s1))) == int32(*(*TXML_Char)(unsafe.Pointer(s2))) && int32(*(*TXML_Char)(unsafe.Pointer(s1))) != 0) {
  5372. break
  5373. }
  5374. goto _26
  5375. _26:
  5376. ;
  5377. s1++
  5378. s2++
  5379. }
  5380. if int32(*(*TXML_Char)(unsafe.Pointer(s1))) == 0 {
  5381. return int32(_XML_ERROR_DUPLICATE_ATTRIBUTE)
  5382. }
  5383. }
  5384. if !(step != 0) {
  5385. step = uint8(uriHash & ^mask >> (libc.Int32FromUint8((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower)-libc.Int32FromInt32(1)) & (mask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  5386. }
  5387. if j1 < libc.Int32FromUint8(step) {
  5388. j1 = int32(uint32(j1) + (nsAttsSize - uint32(step)))
  5389. } else {
  5390. j1 -= libc.Int32FromUint8(step)
  5391. }
  5392. }
  5393. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets != 0 { /* append namespace separator and prefix */
  5394. *(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fptr + uintptr(-libc.Int32FromInt32(1)))) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  5395. s = (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fname
  5396. for {
  5397. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  5398. v30 = 0
  5399. } else {
  5400. v32 = parser + 784 + 24
  5401. v31 = *(*uintptr)(unsafe.Pointer(v32))
  5402. *(*uintptr)(unsafe.Pointer(v32))++
  5403. *(*TXML_Char)(unsafe.Pointer(v31)) = *(*TXML_Char)(unsafe.Pointer(s))
  5404. v30 = libc.Int32FromInt32(1)
  5405. }
  5406. if !(v30 != 0) {
  5407. return int32(_XML_ERROR_NO_MEMORY)
  5408. }
  5409. goto _29
  5410. _29:
  5411. ;
  5412. v28 = s
  5413. s++
  5414. if !(*(*TXML_Char)(unsafe.Pointer(v28)) != 0) {
  5415. break
  5416. }
  5417. }
  5418. }
  5419. /* store expanded name in attribute list */
  5420. s = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  5421. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  5422. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8)) = s
  5423. /* fill empty slot with new version, uriName and hash value */
  5424. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fversion = version
  5425. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fhash = uriHash
  5426. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).FuriName = s
  5427. nPrefixes--
  5428. v33 = nPrefixes
  5429. if !(v33 != 0) {
  5430. i += int32(2)
  5431. break
  5432. }
  5433. } else { /* not prefixed */
  5434. *(*TXML_Char)(unsafe.Pointer(s + uintptr(-libc.Int32FromInt32(1)))) = 0
  5435. } /* clear flag */
  5436. goto _15
  5437. _15:
  5438. ;
  5439. i += int32(2)
  5440. }
  5441. }
  5442. /* clear flags for the remaining attributes */
  5443. for {
  5444. if !(i < attIndex) {
  5445. break
  5446. }
  5447. *(*TXML_Char)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8)) + uintptr(-libc.Int32FromInt32(1)))) = 0
  5448. goto _34
  5449. _34:
  5450. ;
  5451. i += int32(2)
  5452. }
  5453. binding = *(*uintptr)(unsafe.Pointer(bindingsPtr))
  5454. for {
  5455. if !(binding != 0) {
  5456. break
  5457. }
  5458. *(*TXML_Char)(unsafe.Pointer((*Tattribute_id)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).FattId)).Fname + uintptr(-libc.Int32FromInt32(1)))) = 0
  5459. goto _35
  5460. _35:
  5461. ;
  5462. binding = (*TBINDING)(unsafe.Pointer(binding)).FnextTagBinding
  5463. }
  5464. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0) {
  5465. return int32(_XML_ERROR_NONE)
  5466. }
  5467. /* expand the element type name */
  5468. if (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fprefix != 0 {
  5469. binding = (*TPREFIX)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fprefix)).Fbinding
  5470. if !(binding != 0) {
  5471. return int32(_XML_ERROR_UNBOUND_PREFIX)
  5472. }
  5473. localPart = (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr
  5474. for {
  5475. v36 = localPart
  5476. localPart++
  5477. if !(int32(*(*TXML_Char)(unsafe.Pointer(v36))) != int32(m_ASCII_COLON)) {
  5478. break
  5479. }
  5480. }
  5481. } else {
  5482. if (*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding != 0 {
  5483. binding = (*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding
  5484. localPart = (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr
  5485. } else {
  5486. return int32(_XML_ERROR_NONE)
  5487. }
  5488. }
  5489. prefixLen = 0
  5490. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets != 0 && (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname != 0 {
  5491. for {
  5492. v38 = prefixLen
  5493. prefixLen++
  5494. if !(*(*TXML_Char)(unsafe.Pointer((*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname + uintptr(v38))) != 0) {
  5495. break
  5496. }
  5497. goto _37
  5498. _37:
  5499. } /* prefixLen includes null terminator */
  5500. }
  5501. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).FlocalPart = localPart
  5502. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).FuriLen = (*TBINDING)(unsafe.Pointer(binding)).FuriLen
  5503. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fprefix = (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname
  5504. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).FprefixLen = prefixLen
  5505. i = 0
  5506. for {
  5507. v40 = i
  5508. i++
  5509. if !(*(*TXML_Char)(unsafe.Pointer(localPart + uintptr(v40))) != 0) {
  5510. break
  5511. }
  5512. goto _39
  5513. _39:
  5514. } /* i includes null terminator */
  5515. /* Detect and prevent integer overflow */
  5516. if (*TBINDING)(unsafe.Pointer(binding)).FuriLen > int32(m_INT_MAX)-prefixLen || i > int32(m_INT_MAX)-((*TBINDING)(unsafe.Pointer(binding)).FuriLen+prefixLen) {
  5517. return int32(_XML_ERROR_NO_MEMORY)
  5518. }
  5519. n = i + (*TBINDING)(unsafe.Pointer(binding)).FuriLen + prefixLen
  5520. if n > (*TBINDING)(unsafe.Pointer(binding)).FuriAlloc {
  5521. /* Detect and prevent integer overflow */
  5522. if n > libc.Int32FromInt32(m_INT_MAX)-libc.Int32FromInt32(m_EXPAND_SPARE) {
  5523. return int32(_XML_ERROR_NO_MEMORY)
  5524. }
  5525. /* Detect and prevent integer overflow.
  5526. * The preprocessor guard addresses the "always false" warning
  5527. * from -Wtype-limits on platforms where
  5528. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5529. 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))
  5530. if !(uri != 0) {
  5531. return int32(_XML_ERROR_NO_MEMORY)
  5532. }
  5533. (*TBINDING)(unsafe.Pointer(binding)).FuriAlloc = n + int32(m_EXPAND_SPARE)
  5534. libc.Xmemcpy(tls, uri, (*TBINDING)(unsafe.Pointer(binding)).Furi, libc.Uint64FromInt32((*TBINDING)(unsafe.Pointer(binding)).FuriLen)*uint64(1))
  5535. p = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  5536. for {
  5537. if !(p != 0) {
  5538. break
  5539. }
  5540. if (*TTAG)(unsafe.Pointer(p)).Fname.Fstr == (*TBINDING)(unsafe.Pointer(binding)).Furi {
  5541. (*TTAG)(unsafe.Pointer(p)).Fname.Fstr = uri
  5542. }
  5543. goto _41
  5544. _41:
  5545. ;
  5546. p = (*TTAG)(unsafe.Pointer(p)).Fparent
  5547. }
  5548. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TBINDING)(unsafe.Pointer(binding)).Furi)
  5549. (*TBINDING)(unsafe.Pointer(binding)).Furi = uri
  5550. }
  5551. /* if m_namespaceSeparator != '\0' then uri includes it already */
  5552. uri = (*TBINDING)(unsafe.Pointer(binding)).Furi + uintptr((*TBINDING)(unsafe.Pointer(binding)).FuriLen)
  5553. libc.Xmemcpy(tls, uri, localPart, libc.Uint64FromInt32(i)*uint64(1))
  5554. /* we always have a namespace separator between localPart and prefix */
  5555. if prefixLen != 0 {
  5556. uri += uintptr(i - int32(1))
  5557. *(*TXML_Char)(unsafe.Pointer(uri)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator /* replace null terminator */
  5558. libc.Xmemcpy(tls, uri+uintptr(1), (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname, libc.Uint64FromInt32(prefixLen)*uint64(1))
  5559. }
  5560. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr = (*TBINDING)(unsafe.Pointer(binding)).Furi
  5561. return int32(_XML_ERROR_NONE)
  5562. }
  5563. func _is_rfc3986_uri_char(tls *libc.TLS, candidate TXML_Char) (r TXML_Bool) {
  5564. // For the RFC 3986 ANBF grammar see
  5565. // https://datatracker.ietf.org/doc/html/rfc3986#appendix-A
  5566. switch int32(candidate) {
  5567. // From rule "ALPHA" (uppercase half)
  5568. case int32('A'):
  5569. fallthrough
  5570. case int32('B'):
  5571. fallthrough
  5572. case int32('C'):
  5573. fallthrough
  5574. case int32('D'):
  5575. fallthrough
  5576. case int32('E'):
  5577. fallthrough
  5578. case int32('F'):
  5579. fallthrough
  5580. case int32('G'):
  5581. fallthrough
  5582. case int32('H'):
  5583. fallthrough
  5584. case int32('I'):
  5585. fallthrough
  5586. case int32('J'):
  5587. fallthrough
  5588. case int32('K'):
  5589. fallthrough
  5590. case int32('L'):
  5591. fallthrough
  5592. case int32('M'):
  5593. fallthrough
  5594. case int32('N'):
  5595. fallthrough
  5596. case int32('O'):
  5597. fallthrough
  5598. case int32('P'):
  5599. fallthrough
  5600. case int32('Q'):
  5601. fallthrough
  5602. case int32('R'):
  5603. fallthrough
  5604. case int32('S'):
  5605. fallthrough
  5606. case int32('T'):
  5607. fallthrough
  5608. case int32('U'):
  5609. fallthrough
  5610. case int32('V'):
  5611. fallthrough
  5612. case int32('W'):
  5613. fallthrough
  5614. case int32('X'):
  5615. fallthrough
  5616. case int32('Y'):
  5617. fallthrough
  5618. case int32('Z'):
  5619. // From rule "ALPHA" (lowercase half)
  5620. fallthrough
  5621. case int32('a'):
  5622. fallthrough
  5623. case int32('b'):
  5624. fallthrough
  5625. case int32('c'):
  5626. fallthrough
  5627. case int32('d'):
  5628. fallthrough
  5629. case int32('e'):
  5630. fallthrough
  5631. case int32('f'):
  5632. fallthrough
  5633. case int32('g'):
  5634. fallthrough
  5635. case int32('h'):
  5636. fallthrough
  5637. case int32('i'):
  5638. fallthrough
  5639. case int32('j'):
  5640. fallthrough
  5641. case int32('k'):
  5642. fallthrough
  5643. case int32('l'):
  5644. fallthrough
  5645. case int32('m'):
  5646. fallthrough
  5647. case int32('n'):
  5648. fallthrough
  5649. case int32('o'):
  5650. fallthrough
  5651. case int32('p'):
  5652. fallthrough
  5653. case int32('q'):
  5654. fallthrough
  5655. case int32('r'):
  5656. fallthrough
  5657. case int32('s'):
  5658. fallthrough
  5659. case int32('t'):
  5660. fallthrough
  5661. case int32('u'):
  5662. fallthrough
  5663. case int32('v'):
  5664. fallthrough
  5665. case int32('w'):
  5666. fallthrough
  5667. case int32('x'):
  5668. fallthrough
  5669. case int32('y'):
  5670. fallthrough
  5671. case int32('z'):
  5672. // From rule "DIGIT"
  5673. fallthrough
  5674. case int32('0'):
  5675. fallthrough
  5676. case int32('1'):
  5677. fallthrough
  5678. case int32('2'):
  5679. fallthrough
  5680. case int32('3'):
  5681. fallthrough
  5682. case int32('4'):
  5683. fallthrough
  5684. case int32('5'):
  5685. fallthrough
  5686. case int32('6'):
  5687. fallthrough
  5688. case int32('7'):
  5689. fallthrough
  5690. case int32('8'):
  5691. fallthrough
  5692. case int32('9'):
  5693. // From rule "pct-encoded"
  5694. fallthrough
  5695. case int32('%'):
  5696. // From rule "unreserved"
  5697. fallthrough
  5698. case int32('-'):
  5699. fallthrough
  5700. case int32('.'):
  5701. fallthrough
  5702. case int32('_'):
  5703. fallthrough
  5704. case int32('~'):
  5705. // From rule "gen-delims"
  5706. fallthrough
  5707. case int32(':'):
  5708. fallthrough
  5709. case int32('/'):
  5710. fallthrough
  5711. case int32('?'):
  5712. fallthrough
  5713. case int32('#'):
  5714. fallthrough
  5715. case int32('['):
  5716. fallthrough
  5717. case int32(']'):
  5718. fallthrough
  5719. case int32('@'):
  5720. // From rule "sub-delims"
  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. fallthrough
  5734. case int32('*'):
  5735. fallthrough
  5736. case int32('+'):
  5737. fallthrough
  5738. case int32(','):
  5739. fallthrough
  5740. case int32(';'):
  5741. fallthrough
  5742. case int32('='):
  5743. return libc.Uint8FromInt32(1)
  5744. default:
  5745. return libc.Uint8FromInt32(0)
  5746. }
  5747. return r
  5748. }
  5749. // C documentation
  5750. //
  5751. // /* addBinding() overwrites the value of prefix->binding without checking.
  5752. // Therefore one must keep track of the old value outside of addBinding().
  5753. // */
  5754. func _addBinding(tls *libc.TLS, parser TXML_Parser, prefix uintptr, attId uintptr, uri uintptr, bindingsPtr uintptr) (r _XML_Error) {
  5755. var b, temp, v3 uintptr
  5756. var isXML, isXMLNS, mustBeXML TXML_Bool
  5757. var len1, v2 int32
  5758. _, _, _, _, _, _, _, _ = b, isXML, isXMLNS, len1, mustBeXML, temp, v2, v3
  5759. mustBeXML = libc.Uint8FromInt32(0)
  5760. isXML = libc.Uint8FromInt32(1)
  5761. isXMLNS = libc.Uint8FromInt32(1)
  5762. /* empty URI is only valid for default namespace per XML NS 1.0 (not 1.1) */
  5763. if int32(*(*TXML_Char)(unsafe.Pointer(uri))) == int32('\000') && (*TPREFIX)(unsafe.Pointer(prefix)).Fname != 0 {
  5764. return int32(_XML_ERROR_UNDECLARING_PREFIX)
  5765. }
  5766. if (*TPREFIX)(unsafe.Pointer(prefix)).Fname != 0 && int32(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname))) == int32(m_ASCII_x) && int32(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 1))) == int32(m_ASCII_m) && int32(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 2))) == int32(m_ASCII_l) {
  5767. /* Not allowed to bind xmlns */
  5768. if int32(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 3))) == int32(m_ASCII_n) && int32(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 4))) == int32(m_ASCII_s) && int32(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 5))) == int32('\000') {
  5769. return int32(_XML_ERROR_RESERVED_PREFIX_XMLNS)
  5770. }
  5771. if int32(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 3))) == int32('\000') {
  5772. mustBeXML = libc.Uint8FromInt32(1)
  5773. }
  5774. }
  5775. len1 = 0
  5776. for {
  5777. if !(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1))) != 0) {
  5778. break
  5779. }
  5780. if isXML != 0 && (len1 > _xmlLen || int32(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) != int32(_xmlNamespace[len1])) {
  5781. isXML = libc.Uint8FromInt32(0)
  5782. }
  5783. if !(mustBeXML != 0) && isXMLNS != 0 && (len1 > _xmlnsLen || int32(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) != int32(_xmlnsNamespace[len1])) {
  5784. isXMLNS = libc.Uint8FromInt32(0)
  5785. }
  5786. // NOTE: While Expat does not validate namespace URIs against RFC 3986
  5787. // today (and is not REQUIRED to do so with regard to the XML 1.0
  5788. // namespaces specification) we have to at least make sure, that
  5789. // the application on top of Expat (that is likely splitting expanded
  5790. // element names ("qualified names") of form
  5791. // "[uri sep] local [sep prefix] '\0'" back into 1, 2 or 3 pieces
  5792. // in its element handler code) cannot be confused by an attacker
  5793. // putting additional namespace separator characters into namespace
  5794. // declarations. That would be ambiguous and not to be expected.
  5795. //
  5796. // While the HTML API docs of function XML_ParserCreateNS have been
  5797. // advising against use of a namespace separator character that can
  5798. // appear in a URI for >20 years now, some widespread applications
  5799. // are using URI characters (':' (colon) in particular) for a
  5800. // namespace separator, in practice. To keep these applications
  5801. // functional, we only reject namespaces URIs containing the
  5802. // application-chosen namespace separator if the chosen separator
  5803. // is a non-URI character with regard to RFC 3986.
  5804. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 && int32(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) == int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator) && !(_is_rfc3986_uri_char(tls, *(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) != 0) {
  5805. return int32(_XML_ERROR_SYNTAX)
  5806. }
  5807. goto _1
  5808. _1:
  5809. ;
  5810. len1++
  5811. }
  5812. isXML = libc.BoolUint8(isXML != 0 && len1 == _xmlLen)
  5813. isXMLNS = libc.BoolUint8(isXMLNS != 0 && len1 == _xmlnsLen)
  5814. if libc.Int32FromUint8(mustBeXML) != libc.Int32FromUint8(isXML) {
  5815. if mustBeXML != 0 {
  5816. v2 = int32(_XML_ERROR_RESERVED_PREFIX_XML)
  5817. } else {
  5818. v2 = int32(_XML_ERROR_RESERVED_NAMESPACE_URI)
  5819. }
  5820. return v2
  5821. }
  5822. if isXMLNS != 0 {
  5823. return int32(_XML_ERROR_RESERVED_NAMESPACE_URI)
  5824. }
  5825. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  5826. len1++
  5827. }
  5828. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList != 0 {
  5829. b = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  5830. if len1 > (*TBINDING)(unsafe.Pointer(b)).FuriAlloc {
  5831. /* Detect and prevent integer overflow */
  5832. if len1 > libc.Int32FromInt32(m_INT_MAX)-libc.Int32FromInt32(m_EXPAND_SPARE) {
  5833. return int32(_XML_ERROR_NO_MEMORY)
  5834. }
  5835. /* Detect and prevent integer overflow.
  5836. * The preprocessor guard addresses the "always false" warning
  5837. * from -Wtype-limits on platforms where
  5838. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5839. 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)))
  5840. if temp == libc.UintptrFromInt32(0) {
  5841. return int32(_XML_ERROR_NO_MEMORY)
  5842. }
  5843. (*TBINDING)(unsafe.Pointer(b)).Furi = temp
  5844. (*TBINDING)(unsafe.Pointer(b)).FuriAlloc = len1 + int32(m_EXPAND_SPARE)
  5845. }
  5846. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding
  5847. } else {
  5848. b = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(48))
  5849. if !(b != 0) {
  5850. return int32(_XML_ERROR_NO_MEMORY)
  5851. }
  5852. /* Detect and prevent integer overflow */
  5853. if len1 > libc.Int32FromInt32(m_INT_MAX)-libc.Int32FromInt32(m_EXPAND_SPARE) {
  5854. return int32(_XML_ERROR_NO_MEMORY)
  5855. }
  5856. /* Detect and prevent integer overflow.
  5857. * The preprocessor guard addresses the "always false" warning
  5858. * from -Wtype-limits on platforms where
  5859. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5860. (*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)))
  5861. if !((*TBINDING)(unsafe.Pointer(b)).Furi != 0) {
  5862. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, b)
  5863. return int32(_XML_ERROR_NO_MEMORY)
  5864. }
  5865. (*TBINDING)(unsafe.Pointer(b)).FuriAlloc = len1 + int32(m_EXPAND_SPARE)
  5866. }
  5867. (*TBINDING)(unsafe.Pointer(b)).FuriLen = len1
  5868. libc.Xmemcpy(tls, (*TBINDING)(unsafe.Pointer(b)).Furi, uri, libc.Uint64FromInt32(len1)*uint64(1))
  5869. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  5870. *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Furi + uintptr(len1-int32(1)))) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  5871. }
  5872. (*TBINDING)(unsafe.Pointer(b)).Fprefix = prefix
  5873. (*TBINDING)(unsafe.Pointer(b)).FattId = attId
  5874. (*TBINDING)(unsafe.Pointer(b)).FprevPrefixBinding = (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding
  5875. /* NULL binding when default namespace undeclared */
  5876. if int32(*(*TXML_Char)(unsafe.Pointer(uri))) == int32('\000') && prefix == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd+304 {
  5877. (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding = libc.UintptrFromInt32(0)
  5878. } else {
  5879. (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding = b
  5880. }
  5881. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = *(*uintptr)(unsafe.Pointer(bindingsPtr))
  5882. *(*uintptr)(unsafe.Pointer(bindingsPtr)) = b
  5883. /* if attId == NULL then we are not starting a namespace scope */
  5884. if attId != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler != 0 {
  5885. if (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding != 0 {
  5886. v3 = uri
  5887. } else {
  5888. v3 = uintptr(0)
  5889. }
  5890. (*(*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)
  5891. }
  5892. return int32(_XML_ERROR_NONE)
  5893. }
  5894. // "http://www.w3.org/XML/1998/namespace"
  5895. var _xmlNamespace = [37]TXML_Char{
  5896. 0: int8(m_ASCII_h),
  5897. 1: int8(m_ASCII_t),
  5898. 2: int8(m_ASCII_t),
  5899. 3: int8(m_ASCII_p),
  5900. 4: int8(m_ASCII_COLON),
  5901. 5: int8(m_ASCII_SLASH),
  5902. 6: int8(m_ASCII_SLASH),
  5903. 7: int8(m_ASCII_w),
  5904. 8: int8(m_ASCII_w),
  5905. 9: int8(m_ASCII_w),
  5906. 10: int8(m_ASCII_PERIOD),
  5907. 11: int8(m_ASCII_w),
  5908. 12: int8(m_ASCII_3),
  5909. 13: int8(m_ASCII_PERIOD),
  5910. 14: int8(m_ASCII_o),
  5911. 15: int8(m_ASCII_r),
  5912. 16: int8(m_ASCII_g),
  5913. 17: int8(m_ASCII_SLASH),
  5914. 18: int8(m_ASCII_X),
  5915. 19: int8(m_ASCII_M),
  5916. 20: int8(m_ASCII_L),
  5917. 21: int8(m_ASCII_SLASH),
  5918. 22: int8(m_ASCII_1),
  5919. 23: int8(m_ASCII_9),
  5920. 24: int8(m_ASCII_9),
  5921. 25: int8(m_ASCII_8),
  5922. 26: int8(m_ASCII_SLASH),
  5923. 27: int8(m_ASCII_n),
  5924. 28: int8(m_ASCII_a),
  5925. 29: int8(m_ASCII_m),
  5926. 30: int8(m_ASCII_e),
  5927. 31: int8(m_ASCII_s),
  5928. 32: int8(m_ASCII_p),
  5929. 33: int8(m_ASCII_a),
  5930. 34: int8(m_ASCII_c),
  5931. 35: int8(m_ASCII_e),
  5932. }
  5933. var _xmlLen = libc.Int32FromUint64(libc.Uint64FromInt32(libc.Int32FromInt64(37))/libc.Uint64FromInt64(1) - libc.Uint64FromInt32(1))
  5934. // "http://www.w3.org/2000/xmlns/"
  5935. var _xmlnsNamespace = [30]TXML_Char{
  5936. 0: int8(m_ASCII_h),
  5937. 1: int8(m_ASCII_t),
  5938. 2: int8(m_ASCII_t),
  5939. 3: int8(m_ASCII_p),
  5940. 4: int8(m_ASCII_COLON),
  5941. 5: int8(m_ASCII_SLASH),
  5942. 6: int8(m_ASCII_SLASH),
  5943. 7: int8(m_ASCII_w),
  5944. 8: int8(m_ASCII_w),
  5945. 9: int8(m_ASCII_w),
  5946. 10: int8(m_ASCII_PERIOD),
  5947. 11: int8(m_ASCII_w),
  5948. 12: int8(m_ASCII_3),
  5949. 13: int8(m_ASCII_PERIOD),
  5950. 14: int8(m_ASCII_o),
  5951. 15: int8(m_ASCII_r),
  5952. 16: int8(m_ASCII_g),
  5953. 17: int8(m_ASCII_SLASH),
  5954. 18: int8(m_ASCII_2),
  5955. 19: int8(m_ASCII_0),
  5956. 20: int8(m_ASCII_0),
  5957. 21: int8(m_ASCII_0),
  5958. 22: int8(m_ASCII_SLASH),
  5959. 23: int8(m_ASCII_x),
  5960. 24: int8(m_ASCII_m),
  5961. 25: int8(m_ASCII_l),
  5962. 26: int8(m_ASCII_n),
  5963. 27: int8(m_ASCII_s),
  5964. 28: int8(m_ASCII_SLASH),
  5965. }
  5966. var _xmlnsLen = libc.Int32FromUint64(libc.Uint64FromInt32(libc.Int32FromInt64(30))/libc.Uint64FromInt64(1) - libc.Uint64FromInt32(1))
  5967. // C documentation
  5968. //
  5969. // /* The idea here is to avoid using stack for each CDATA section when
  5970. // the whole file is parsed with one call.
  5971. // */
  5972. func _cdataSectionProcessor(tls *libc.TLS, parser TXML_Parser, _start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  5973. bp := tls.Alloc(16)
  5974. defer tls.Free(16)
  5975. *(*uintptr)(unsafe.Pointer(bp)) = _start
  5976. var result _XML_Error
  5977. _ = result
  5978. 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))
  5979. if result != int32(_XML_ERROR_NONE) {
  5980. return result
  5981. }
  5982. if *(*uintptr)(unsafe.Pointer(bp)) != 0 {
  5983. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 { /* we are parsing an external entity */
  5984. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityContentProcessor)
  5985. return _externalEntityContentProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, endPtr)
  5986. } else {
  5987. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_contentProcessor)
  5988. return _contentProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, endPtr)
  5989. }
  5990. }
  5991. return result
  5992. }
  5993. // C documentation
  5994. //
  5995. // /* startPtr gets set to non-null if the section is closed, and to null if
  5996. // the section is not yet closed.
  5997. // */
  5998. 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) {
  5999. bp := tls.Alloc(32)
  6000. defer tls.Free(32)
  6001. var charDataHandler TXML_CharacterDataHandler
  6002. var convert_res _XML_Convert_Result
  6003. var eventEndPP, eventPP, v3 uintptr
  6004. var tok int32
  6005. var _ /* c at bp+16 */ TXML_Char
  6006. var _ /* dataPtr at bp+24 */ uintptr
  6007. var _ /* next at bp+8 */ uintptr
  6008. var _ /* s at bp+0 */ uintptr
  6009. _, _, _, _, _, _ = charDataHandler, convert_res, eventEndPP, eventPP, tok, v3
  6010. *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(startPtr))
  6011. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6012. eventPP = parser + 544
  6013. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6014. eventEndPP = parser + 552
  6015. } else {
  6016. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  6017. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  6018. }
  6019. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6020. *(*uintptr)(unsafe.Pointer(startPtr)) = libc.UintptrFromInt32(0)
  6021. for {
  6022. *(*uintptr)(unsafe.Pointer(bp + 8)) = *(*uintptr)(unsafe.Pointer(bp)) /* in case of XML_TOK_NONE or XML_TOK_PARTIAL */
  6023. 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)
  6024. if !(_accountingDiffTolerated(tls, parser, tok, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)), int32(4044), account) != 0) {
  6025. _accountingOnAbort(tls, parser)
  6026. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6027. }
  6028. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6029. switch tok {
  6030. case int32(m_XML_TOK_CDATA_SECT_CLOSE):
  6031. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler != 0 {
  6032. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg)
  6033. } else {
  6034. if libc.Bool(0 != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  6035. (*(*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)
  6036. } else {
  6037. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6038. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  6039. }
  6040. }
  6041. }
  6042. *(*uintptr)(unsafe.Pointer(startPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6043. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6044. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  6045. return int32(_XML_ERROR_ABORTED)
  6046. } else {
  6047. return int32(_XML_ERROR_NONE)
  6048. }
  6049. fallthrough
  6050. case int32(m_XML_TOK_DATA_NEWLINE):
  6051. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  6052. *(*TXML_Char)(unsafe.Pointer(bp + 16)) = int8(0xA)
  6053. (*(*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))
  6054. } else {
  6055. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6056. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  6057. }
  6058. }
  6059. case int32(m_XML_TOK_DATA_CHARS):
  6060. charDataHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler
  6061. if charDataHandler != 0 {
  6062. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  6063. for {
  6064. *(*uintptr)(unsafe.Pointer(bp + 24)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  6065. 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)
  6066. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6067. (*(*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)))
  6068. if convert_res == int32(_XML_CONVERT_COMPLETED) || convert_res == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  6069. break
  6070. }
  6071. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6072. goto _2
  6073. _2:
  6074. }
  6075. } else {
  6076. (*(*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)))))
  6077. }
  6078. } else {
  6079. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6080. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  6081. }
  6082. }
  6083. case m_XML_TOK_INVALID:
  6084. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6085. return int32(_XML_ERROR_INVALID_TOKEN)
  6086. case -int32(2):
  6087. if haveMore != 0 {
  6088. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6089. return int32(_XML_ERROR_NONE)
  6090. }
  6091. return int32(_XML_ERROR_PARTIAL_CHAR)
  6092. case -int32(1):
  6093. fallthrough
  6094. case -int32(4):
  6095. if haveMore != 0 {
  6096. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6097. return int32(_XML_ERROR_NONE)
  6098. }
  6099. return int32(_XML_ERROR_UNCLOSED_CDATA_SECTION)
  6100. default:
  6101. /* Every token returned by XmlCdataSectionTok() has its own
  6102. * explicit case, so this default case will never be executed.
  6103. * We retain it as a safety net and exclude it from the coverage
  6104. * statistics.
  6105. *
  6106. * LCOV_EXCL_START
  6107. */
  6108. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6109. return int32(_XML_ERROR_UNEXPECTED_STATE)
  6110. /* LCOV_EXCL_STOP */
  6111. }
  6112. v3 = *(*uintptr)(unsafe.Pointer(bp + 8))
  6113. *(*uintptr)(unsafe.Pointer(bp)) = v3
  6114. *(*uintptr)(unsafe.Pointer(eventPP)) = v3
  6115. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  6116. case int32(_XML_SUSPENDED):
  6117. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6118. return int32(_XML_ERROR_NONE)
  6119. case int32(_XML_FINISHED):
  6120. return int32(_XML_ERROR_ABORTED)
  6121. default:
  6122. }
  6123. goto _1
  6124. _1:
  6125. }
  6126. /* not reached */
  6127. return r
  6128. }
  6129. // C documentation
  6130. //
  6131. // /* The idea here is to avoid using stack for each IGNORE section when
  6132. // the whole file is parsed with one call.
  6133. // */
  6134. func _ignoreSectionProcessor(tls *libc.TLS, parser TXML_Parser, _start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  6135. bp := tls.Alloc(16)
  6136. defer tls.Free(16)
  6137. *(*uintptr)(unsafe.Pointer(bp)) = _start
  6138. var result _XML_Error
  6139. _ = result
  6140. 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)))
  6141. if result != int32(_XML_ERROR_NONE) {
  6142. return result
  6143. }
  6144. if *(*uintptr)(unsafe.Pointer(bp)) != 0 {
  6145. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  6146. return _prologProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, endPtr)
  6147. }
  6148. return result
  6149. }
  6150. // C documentation
  6151. //
  6152. // /* startPtr gets set to non-null is the section is closed, and to null
  6153. // if the section is not yet closed.
  6154. // */
  6155. func _doIgnoreSection(tls *libc.TLS, parser TXML_Parser, enc uintptr, startPtr uintptr, end uintptr, nextPtr uintptr, haveMore TXML_Bool) (r _XML_Error) {
  6156. bp := tls.Alloc(16)
  6157. defer tls.Free(16)
  6158. var eventEndPP, eventPP, s uintptr
  6159. var tok int32
  6160. var _ /* next at bp+0 */ uintptr
  6161. _, _, _, _ = eventEndPP, eventPP, s, tok
  6162. *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(startPtr))
  6163. s = *(*uintptr)(unsafe.Pointer(startPtr))
  6164. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6165. eventPP = parser + 544
  6166. *(*uintptr)(unsafe.Pointer(eventPP)) = s
  6167. eventEndPP = parser + 552
  6168. } else {
  6169. /* It's not entirely clear, but it seems the following two lines
  6170. * of code cannot be executed. The only occasions on which 'enc'
  6171. * is not 'encoding' are when this function is called
  6172. * from the internal entity processing, and IGNORE sections are an
  6173. * error in internal entities.
  6174. *
  6175. * Since it really isn't clear that this is true, we keep the code
  6176. * and just remove it from our coverage tests.
  6177. *
  6178. * LCOV_EXCL_START
  6179. */
  6180. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  6181. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  6182. /* LCOV_EXCL_STOP */
  6183. }
  6184. *(*uintptr)(unsafe.Pointer(eventPP)) = s
  6185. *(*uintptr)(unsafe.Pointer(startPtr)) = libc.UintptrFromInt32(0)
  6186. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 3*8))})))(tls, enc, s, end, bp)
  6187. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4196), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  6188. _accountingOnAbort(tls, parser)
  6189. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6190. }
  6191. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6192. switch tok {
  6193. case int32(m_XML_TOK_IGNORE_SECT):
  6194. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6195. _reportDefault(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6196. }
  6197. *(*uintptr)(unsafe.Pointer(startPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6198. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6199. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  6200. return int32(_XML_ERROR_ABORTED)
  6201. } else {
  6202. return int32(_XML_ERROR_NONE)
  6203. }
  6204. fallthrough
  6205. case m_XML_TOK_INVALID:
  6206. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6207. return int32(_XML_ERROR_INVALID_TOKEN)
  6208. case -int32(2):
  6209. if haveMore != 0 {
  6210. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6211. return int32(_XML_ERROR_NONE)
  6212. }
  6213. return int32(_XML_ERROR_PARTIAL_CHAR)
  6214. case -int32(1):
  6215. fallthrough
  6216. case -int32(4):
  6217. if haveMore != 0 {
  6218. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6219. return int32(_XML_ERROR_NONE)
  6220. }
  6221. return int32(_XML_ERROR_SYNTAX) /* XML_ERROR_UNCLOSED_IGNORE_SECTION */
  6222. default:
  6223. /* All of the tokens that XmlIgnoreSectionTok() returns have
  6224. * explicit cases to handle them, so this default case is never
  6225. * executed. We keep it as a safety net anyway, and remove it
  6226. * from our test coverage statistics.
  6227. *
  6228. * LCOV_EXCL_START
  6229. */
  6230. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6231. return int32(_XML_ERROR_UNEXPECTED_STATE)
  6232. /* LCOV_EXCL_STOP */
  6233. }
  6234. /* not reached */
  6235. return r
  6236. }
  6237. func _initializeEncoding(tls *libc.TLS, parser TXML_Parser) (r _XML_Error) {
  6238. var s uintptr
  6239. var v1 func(*libc.TLS, uintptr, uintptr, uintptr) int32
  6240. _, _ = s, v1
  6241. s = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName
  6242. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  6243. v1 = XXmlInitEncodingNS
  6244. } else {
  6245. v1 = XXmlInitEncoding
  6246. }
  6247. if v1(tls, parser+296, parser+288, s) != 0 {
  6248. return int32(_XML_ERROR_NONE)
  6249. }
  6250. return _handleUnknownEncoding(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName)
  6251. }
  6252. func _processXmlDecl(tls *libc.TLS, parser TXML_Parser, isGeneralTextEntity int32, s uintptr, next uintptr) (r _XML_Error) {
  6253. bp := tls.Alloc(48)
  6254. defer tls.Free(48)
  6255. var result _XML_Error
  6256. var storedEncName, storedversion uintptr
  6257. var v1 func(*libc.TLS, int32, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr) int32
  6258. var _ /* encodingName at bp+0 */ uintptr
  6259. var _ /* newEncoding at bp+8 */ uintptr
  6260. var _ /* standalone at bp+32 */ int32
  6261. var _ /* version at bp+16 */ uintptr
  6262. var _ /* versionend at bp+24 */ uintptr
  6263. _, _, _, _ = result, storedEncName, storedversion, v1
  6264. *(*uintptr)(unsafe.Pointer(bp)) = libc.UintptrFromInt32(0)
  6265. storedEncName = libc.UintptrFromInt32(0)
  6266. *(*uintptr)(unsafe.Pointer(bp + 8)) = libc.UintptrFromInt32(0)
  6267. *(*uintptr)(unsafe.Pointer(bp + 16)) = libc.UintptrFromInt32(0)
  6268. *(*uintptr)(unsafe.Pointer(bp + 24)) = libc.UintptrFromInt32(0)
  6269. storedversion = libc.UintptrFromInt32(0)
  6270. *(*int32)(unsafe.Pointer(bp + 32)) = -int32(1)
  6271. if !(_accountingDiffTolerated(tls, parser, int32(m_XML_TOK_XML_DECL), s, next, int32(4288), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  6272. _accountingOnAbort(tls, parser)
  6273. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6274. }
  6275. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  6276. v1 = XXmlParseXmlDeclNS
  6277. } else {
  6278. v1 = XXmlParseXmlDecl
  6279. }
  6280. 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) {
  6281. if isGeneralTextEntity != 0 {
  6282. return int32(_XML_ERROR_TEXT_DECL)
  6283. } else {
  6284. return int32(_XML_ERROR_XML_DECL)
  6285. }
  6286. }
  6287. if !(isGeneralTextEntity != 0) && *(*int32)(unsafe.Pointer(bp + 32)) == int32(1) {
  6288. (*TDTD)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd)).Fstandalone = libc.Uint8FromInt32(1)
  6289. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing == int32(_XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE) {
  6290. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = int32(_XML_PARAM_ENTITY_PARSING_NEVER)
  6291. }
  6292. }
  6293. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler != 0 {
  6294. if *(*uintptr)(unsafe.Pointer(bp)) != libc.UintptrFromInt32(0) {
  6295. 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)))))
  6296. if !(storedEncName != 0) {
  6297. return int32(_XML_ERROR_NO_MEMORY)
  6298. }
  6299. (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fptr
  6300. }
  6301. if *(*uintptr)(unsafe.Pointer(bp + 16)) != 0 {
  6302. 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))
  6303. if !(storedversion != 0) {
  6304. return int32(_XML_ERROR_NO_MEMORY)
  6305. }
  6306. }
  6307. (*(*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)))
  6308. } else {
  6309. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6310. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, next)
  6311. }
  6312. }
  6313. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName == libc.UintptrFromInt32(0) {
  6314. if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 {
  6315. /* Check that the specified encoding does not conflict with what
  6316. * the parser has already deduced. Do we have the same number
  6317. * of bytes in the smallest representation of a character? If
  6318. * this is UTF-16, is it the same endianness?
  6319. */
  6320. 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 {
  6321. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  6322. return int32(_XML_ERROR_INCORRECT_ENCODING)
  6323. }
  6324. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding = *(*uintptr)(unsafe.Pointer(bp + 8))
  6325. } else {
  6326. if *(*uintptr)(unsafe.Pointer(bp)) != 0 {
  6327. if !(storedEncName != 0) {
  6328. 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)))))
  6329. if !(storedEncName != 0) {
  6330. return int32(_XML_ERROR_NO_MEMORY)
  6331. }
  6332. }
  6333. result = _handleUnknownEncoding(tls, parser, storedEncName)
  6334. _poolClear(tls, parser+832)
  6335. if result == int32(_XML_ERROR_UNKNOWN_ENCODING) {
  6336. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  6337. }
  6338. return result
  6339. }
  6340. }
  6341. }
  6342. if storedEncName != 0 || storedversion != 0 {
  6343. _poolClear(tls, parser+832)
  6344. }
  6345. return int32(_XML_ERROR_NONE)
  6346. }
  6347. func _handleUnknownEncoding(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) (r _XML_Error) {
  6348. bp := tls.Alloc(1056)
  6349. defer tls.Free(1056)
  6350. var enc uintptr
  6351. var i int32
  6352. var v2 func(*libc.TLS, uintptr, uintptr, TCONVERTER, uintptr) uintptr
  6353. var _ /* info at bp+0 */ TXML_Encoding
  6354. _, _, _ = enc, i, v2
  6355. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler != 0 {
  6356. i = 0
  6357. for {
  6358. if !(i < int32(256)) {
  6359. break
  6360. }
  6361. *(*int32)(unsafe.Pointer(bp + uintptr(i)*4)) = -int32(1)
  6362. goto _1
  6363. _1:
  6364. ;
  6365. i++
  6366. }
  6367. (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fconvert = libc.UintptrFromInt32(0)
  6368. (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata = libc.UintptrFromInt32(0)
  6369. (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease = libc.UintptrFromInt32(0)
  6370. 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 {
  6371. (*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)))
  6372. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem != 0) {
  6373. if (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease != 0 {
  6374. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease})))(tls, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata)
  6375. }
  6376. return int32(_XML_ERROR_NO_MEMORY)
  6377. }
  6378. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  6379. v2 = XXmlInitUnknownEncodingNS
  6380. } else {
  6381. v2 = XXmlInitUnknownEncoding
  6382. }
  6383. enc = v2(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem, bp, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fconvert, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata)
  6384. if enc != 0 {
  6385. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData = (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata
  6386. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease = (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease
  6387. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding = enc
  6388. return int32(_XML_ERROR_NONE)
  6389. }
  6390. }
  6391. if (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease != libc.UintptrFromInt32(0) {
  6392. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease})))(tls, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata)
  6393. }
  6394. }
  6395. return int32(_XML_ERROR_UNKNOWN_ENCODING)
  6396. }
  6397. func _prologInitProcessor(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. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  6405. return _prologProcessor(tls, parser, s, end, nextPtr)
  6406. }
  6407. func _externalParEntInitProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6408. var result _XML_Error
  6409. _ = result
  6410. result = _initializeEncoding(tls, parser)
  6411. if result != int32(_XML_ERROR_NONE) {
  6412. return result
  6413. }
  6414. /* we know now that XML_Parse(Buffer) has been called,
  6415. so we consider the external parameter entity read */
  6416. (*TDTD)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd)).FparamEntityRead = libc.Uint8FromInt32(1)
  6417. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue != 0 {
  6418. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_entityValueInitProcessor)
  6419. return _entityValueInitProcessor(tls, parser, s, end, nextPtr)
  6420. } else {
  6421. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalParEntProcessor)
  6422. return _externalParEntProcessor(tls, parser, s, end, nextPtr)
  6423. }
  6424. return r
  6425. }
  6426. func _entityValueInitProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6427. bp := tls.Alloc(16)
  6428. defer tls.Free(16)
  6429. var result _XML_Error
  6430. var start uintptr
  6431. var tok int32
  6432. var _ /* next at bp+0 */ uintptr
  6433. _, _, _ = result, start, tok
  6434. start = s
  6435. *(*uintptr)(unsafe.Pointer(bp)) = start
  6436. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  6437. for {
  6438. 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)
  6439. /* Note: Except for XML_TOK_BOM below, these bytes are accounted later in:
  6440. - storeEntityValue
  6441. - processXmlDecl
  6442. */
  6443. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = *(*uintptr)(unsafe.Pointer(bp))
  6444. if tok <= 0 {
  6445. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) && tok != m_XML_TOK_INVALID {
  6446. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6447. return int32(_XML_ERROR_NONE)
  6448. }
  6449. switch tok {
  6450. case m_XML_TOK_INVALID:
  6451. return int32(_XML_ERROR_INVALID_TOKEN)
  6452. case -int32(1):
  6453. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6454. case -int32(2):
  6455. return int32(_XML_ERROR_PARTIAL_CHAR)
  6456. case -int32(4): /* start == end */
  6457. fallthrough
  6458. default:
  6459. break
  6460. }
  6461. /* found end of entity value - can store it now */
  6462. return _storeEntityValue(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, end, int32(_XML_ACCOUNT_DIRECT))
  6463. } else {
  6464. if tok == int32(m_XML_TOK_XML_DECL) {
  6465. result = _processXmlDecl(tls, parser, 0, start, *(*uintptr)(unsafe.Pointer(bp)))
  6466. if result != int32(_XML_ERROR_NONE) {
  6467. return result
  6468. }
  6469. /* At this point, m_parsingStatus.parsing cannot be XML_SUSPENDED. For
  6470. * that to happen, a parameter entity parsing handler must have attempted
  6471. * to suspend the parser, which fails and raises an error. The parser can
  6472. * be aborted, but can't be suspended.
  6473. */
  6474. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  6475. return int32(_XML_ERROR_ABORTED)
  6476. }
  6477. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6478. /* stop scanning for text declaration - we found one */
  6479. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_entityValueProcessor)
  6480. return _entityValueProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, nextPtr)
  6481. } else {
  6482. if tok == int32(m_XML_TOK_BOM) && *(*uintptr)(unsafe.Pointer(bp)) == end && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  6483. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4495), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  6484. _accountingOnAbort(tls, parser)
  6485. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6486. }
  6487. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6488. return int32(_XML_ERROR_NONE)
  6489. } else {
  6490. if tok == int32(m_XML_TOK_INSTANCE_START) {
  6491. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6492. return int32(_XML_ERROR_SYNTAX)
  6493. }
  6494. }
  6495. }
  6496. }
  6497. start = *(*uintptr)(unsafe.Pointer(bp))
  6498. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  6499. goto _1
  6500. _1:
  6501. }
  6502. return r
  6503. }
  6504. func _externalParEntProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6505. bp := tls.Alloc(16)
  6506. defer tls.Free(16)
  6507. var tok int32
  6508. var _ /* next at bp+0 */ uintptr
  6509. _ = tok
  6510. *(*uintptr)(unsafe.Pointer(bp)) = s
  6511. 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)
  6512. if tok <= 0 {
  6513. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) && tok != m_XML_TOK_INVALID {
  6514. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6515. return int32(_XML_ERROR_NONE)
  6516. }
  6517. switch tok {
  6518. case m_XML_TOK_INVALID:
  6519. return int32(_XML_ERROR_INVALID_TOKEN)
  6520. case -int32(1):
  6521. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6522. case -int32(2):
  6523. return int32(_XML_ERROR_PARTIAL_CHAR)
  6524. case -int32(4): /* start == end */
  6525. fallthrough
  6526. default:
  6527. break
  6528. }
  6529. } else {
  6530. if tok == int32(m_XML_TOK_BOM) {
  6531. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4548), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  6532. _accountingOnAbort(tls, parser)
  6533. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6534. }
  6535. s = *(*uintptr)(unsafe.Pointer(bp))
  6536. 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)
  6537. }
  6538. }
  6539. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  6540. 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))
  6541. }
  6542. func _entityValueProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6543. bp := tls.Alloc(16)
  6544. defer tls.Free(16)
  6545. var enc, start uintptr
  6546. var tok int32
  6547. var _ /* next at bp+0 */ uintptr
  6548. _, _, _ = enc, start, tok
  6549. start = s
  6550. *(*uintptr)(unsafe.Pointer(bp)) = s
  6551. enc = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding
  6552. for {
  6553. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc))})))(tls, enc, start, end, bp)
  6554. /* Note: These bytes are accounted later in:
  6555. - storeEntityValue
  6556. */
  6557. if tok <= 0 {
  6558. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) && tok != m_XML_TOK_INVALID {
  6559. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6560. return int32(_XML_ERROR_NONE)
  6561. }
  6562. switch tok {
  6563. case m_XML_TOK_INVALID:
  6564. return int32(_XML_ERROR_INVALID_TOKEN)
  6565. case -int32(1):
  6566. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6567. case -int32(2):
  6568. return int32(_XML_ERROR_PARTIAL_CHAR)
  6569. case -int32(4): /* start == end */
  6570. fallthrough
  6571. default:
  6572. break
  6573. }
  6574. /* found end of entity value - can store it now */
  6575. return _storeEntityValue(tls, parser, enc, s, end, int32(_XML_ACCOUNT_DIRECT))
  6576. }
  6577. start = *(*uintptr)(unsafe.Pointer(bp))
  6578. goto _1
  6579. _1:
  6580. }
  6581. return r
  6582. }
  6583. func _prologProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6584. bp := tls.Alloc(16)
  6585. defer tls.Free(16)
  6586. var tok int32
  6587. var _ /* next at bp+0 */ uintptr
  6588. _ = tok
  6589. *(*uintptr)(unsafe.Pointer(bp)) = s
  6590. 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)
  6591. 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))
  6592. }
  6593. 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) {
  6594. bp := tls.Alloc(16)
  6595. defer tls.Free(16)
  6596. *(*uintptr)(unsafe.Pointer(bp)) = _next
  6597. 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
  6598. var betweenDecl, hadParamEntityRefs, hadParamEntityRefs1, handleDefault TXML_Bool
  6599. var myindex, myindex1, role, v66, v69, v73, v76, v82, v84, v85 int32
  6600. var nameLen, v88 Tsize_t
  6601. var quant _XML_Content_Quant
  6602. var result, result1, result2, result3, result4, result5 _XML_Error
  6603. var v72, v79, v83 bool
  6604. var v81 uint32
  6605. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  6606. /* save one level of indirection */
  6607. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  6608. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6609. eventPP = parser + 544
  6610. eventEndPP = parser + 552
  6611. } else {
  6612. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  6613. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  6614. }
  6615. for {
  6616. handleDefault = libc.Uint8FromInt32(1)
  6617. *(*uintptr)(unsafe.Pointer(eventPP)) = s
  6618. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6619. if tok <= 0 {
  6620. if haveMore != 0 && tok != m_XML_TOK_INVALID {
  6621. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6622. return int32(_XML_ERROR_NONE)
  6623. }
  6624. switch tok {
  6625. case m_XML_TOK_INVALID:
  6626. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6627. return int32(_XML_ERROR_INVALID_TOKEN)
  6628. case -int32(1):
  6629. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6630. case -int32(2):
  6631. return int32(_XML_ERROR_PARTIAL_CHAR)
  6632. case -int32(m_XML_TOK_PROLOG_S):
  6633. tok = -tok
  6634. case -int32(4):
  6635. /* for internal PE NOT referenced between declarations */
  6636. if enc != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding && !((*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities)).FbetweenDecl != 0) {
  6637. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6638. return int32(_XML_ERROR_NONE)
  6639. }
  6640. /* WFC: PE Between Declarations - must check that PE contains
  6641. complete markup, not only for external PEs, but also for
  6642. internal PEs if the reference occurs between declarations.
  6643. */
  6644. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0 || enc != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6645. 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) {
  6646. return int32(_XML_ERROR_INCOMPLETE_PE)
  6647. }
  6648. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6649. return int32(_XML_ERROR_NONE)
  6650. }
  6651. return int32(_XML_ERROR_NO_ELEMENTS)
  6652. default:
  6653. tok = -tok
  6654. *(*uintptr)(unsafe.Pointer(bp)) = end
  6655. break
  6656. }
  6657. }
  6658. 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)
  6659. switch role {
  6660. case int32(_XML_ROLE_INSTANCE_START): // bytes accounted in contentProcessor
  6661. fallthrough
  6662. case int32(_XML_ROLE_XML_DECL): // bytes accounted in processXmlDecl
  6663. fallthrough
  6664. case int32(_XML_ROLE_TEXT_DECL): // bytes accounted in processXmlDecl
  6665. default:
  6666. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4717), account) != 0) {
  6667. _accountingOnAbort(tls, parser)
  6668. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6669. }
  6670. }
  6671. switch role {
  6672. case int32(_XML_ROLE_XML_DECL):
  6673. goto _2
  6674. case int32(_XML_ROLE_DOCTYPE_NAME):
  6675. goto _3
  6676. case int32(_XML_ROLE_DOCTYPE_INTERNAL_SUBSET):
  6677. goto _4
  6678. case int32(_XML_ROLE_TEXT_DECL):
  6679. goto _5
  6680. case int32(_XML_ROLE_DOCTYPE_PUBLIC_ID):
  6681. goto _6
  6682. case int32(_XML_ROLE_ENTITY_PUBLIC_ID):
  6683. goto _7
  6684. case int32(_XML_ROLE_DOCTYPE_CLOSE):
  6685. goto _8
  6686. case int32(_XML_ROLE_INSTANCE_START):
  6687. goto _9
  6688. case int32(_XML_ROLE_ATTLIST_ELEMENT_NAME):
  6689. goto _10
  6690. case int32(_XML_ROLE_ATTRIBUTE_NAME):
  6691. goto _11
  6692. case int32(_XML_ROLE_ATTRIBUTE_TYPE_CDATA):
  6693. goto _12
  6694. case int32(_XML_ROLE_ATTRIBUTE_TYPE_ID):
  6695. goto _13
  6696. case int32(_XML_ROLE_ATTRIBUTE_TYPE_IDREF):
  6697. goto _14
  6698. case int32(_XML_ROLE_ATTRIBUTE_TYPE_IDREFS):
  6699. goto _15
  6700. case int32(_XML_ROLE_ATTRIBUTE_TYPE_ENTITY):
  6701. goto _16
  6702. case int32(_XML_ROLE_ATTRIBUTE_TYPE_ENTITIES):
  6703. goto _17
  6704. case int32(_XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN):
  6705. goto _18
  6706. case int32(_XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS):
  6707. goto _19
  6708. case int32(_XML_ROLE_ATTRIBUTE_NOTATION_VALUE):
  6709. goto _20
  6710. case int32(_XML_ROLE_ATTRIBUTE_ENUM_VALUE):
  6711. goto _21
  6712. case int32(_XML_ROLE_REQUIRED_ATTRIBUTE_VALUE):
  6713. goto _22
  6714. case int32(_XML_ROLE_IMPLIED_ATTRIBUTE_VALUE):
  6715. goto _23
  6716. case int32(_XML_ROLE_FIXED_ATTRIBUTE_VALUE):
  6717. goto _24
  6718. case int32(_XML_ROLE_DEFAULT_ATTRIBUTE_VALUE):
  6719. goto _25
  6720. case int32(_XML_ROLE_ENTITY_VALUE):
  6721. goto _26
  6722. case int32(_XML_ROLE_DOCTYPE_SYSTEM_ID):
  6723. goto _27
  6724. case int32(_XML_ROLE_ENTITY_SYSTEM_ID):
  6725. goto _28
  6726. case int32(_XML_ROLE_ENTITY_COMPLETE):
  6727. goto _29
  6728. case int32(_XML_ROLE_ENTITY_NOTATION_NAME):
  6729. goto _30
  6730. case int32(_XML_ROLE_GENERAL_ENTITY_NAME):
  6731. goto _31
  6732. case int32(_XML_ROLE_PARAM_ENTITY_NAME):
  6733. goto _32
  6734. case int32(_XML_ROLE_NOTATION_NAME):
  6735. goto _33
  6736. case int32(_XML_ROLE_NOTATION_PUBLIC_ID):
  6737. goto _34
  6738. case int32(_XML_ROLE_NOTATION_SYSTEM_ID):
  6739. goto _35
  6740. case int32(_XML_ROLE_NOTATION_NO_SYSTEM_ID):
  6741. goto _36
  6742. case int32(_XML_ROLE_ERROR):
  6743. goto _37
  6744. case int32(_XML_ROLE_IGNORE_SECT):
  6745. goto _38
  6746. case int32(_XML_ROLE_GROUP_OPEN):
  6747. goto _39
  6748. case int32(_XML_ROLE_GROUP_SEQUENCE):
  6749. goto _40
  6750. case int32(_XML_ROLE_GROUP_CHOICE):
  6751. goto _41
  6752. case int32(_XML_ROLE_INNER_PARAM_ENTITY_REF):
  6753. goto _42
  6754. case int32(_XML_ROLE_PARAM_ENTITY_REF):
  6755. goto _43
  6756. case int32(_XML_ROLE_ELEMENT_NAME):
  6757. goto _44
  6758. case int32(_XML_ROLE_CONTENT_EMPTY):
  6759. goto _45
  6760. case int32(_XML_ROLE_CONTENT_ANY):
  6761. goto _46
  6762. case int32(_XML_ROLE_CONTENT_PCDATA):
  6763. goto _47
  6764. case int32(_XML_ROLE_CONTENT_ELEMENT):
  6765. goto _48
  6766. case int32(_XML_ROLE_CONTENT_ELEMENT_OPT):
  6767. goto _49
  6768. case int32(_XML_ROLE_CONTENT_ELEMENT_REP):
  6769. goto _50
  6770. case int32(_XML_ROLE_CONTENT_ELEMENT_PLUS):
  6771. goto _51
  6772. case int32(_XML_ROLE_GROUP_CLOSE):
  6773. goto _52
  6774. case int32(_XML_ROLE_GROUP_CLOSE_OPT):
  6775. goto _53
  6776. case int32(_XML_ROLE_GROUP_CLOSE_REP):
  6777. goto _54
  6778. case int32(_XML_ROLE_GROUP_CLOSE_PLUS):
  6779. goto _55
  6780. case int32(_XML_ROLE_PI):
  6781. goto _56
  6782. case int32(_XML_ROLE_COMMENT):
  6783. goto _57
  6784. case int32(_XML_ROLE_NONE):
  6785. goto _58
  6786. case int32(_XML_ROLE_DOCTYPE_NONE):
  6787. goto _59
  6788. case int32(_XML_ROLE_ENTITY_NONE):
  6789. goto _60
  6790. case int32(_XML_ROLE_NOTATION_NONE):
  6791. goto _61
  6792. case int32(_XML_ROLE_ATTLIST_NONE):
  6793. goto _62
  6794. case int32(_XML_ROLE_ELEMENT_NONE):
  6795. goto _63
  6796. }
  6797. goto _64
  6798. _2:
  6799. ;
  6800. result = _processXmlDecl(tls, parser, 0, s, *(*uintptr)(unsafe.Pointer(bp)))
  6801. if result != int32(_XML_ERROR_NONE) {
  6802. return result
  6803. }
  6804. enc = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding
  6805. handleDefault = libc.Uint8FromInt32(0)
  6806. goto _64
  6807. _3:
  6808. ;
  6809. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  6810. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName = _poolStoreString(tls, parser+784, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6811. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName != 0) {
  6812. return int32(_XML_ERROR_NO_MEMORY)
  6813. }
  6814. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  6815. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid = libc.UintptrFromInt32(0)
  6816. handleDefault = libc.Uint8FromInt32(0)
  6817. }
  6818. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = libc.UintptrFromInt32(0) /* always initialize to NULL */
  6819. goto _64
  6820. _4:
  6821. ;
  6822. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  6823. (*(*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))
  6824. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName = libc.UintptrFromInt32(0)
  6825. _poolClear(tls, parser+784)
  6826. handleDefault = libc.Uint8FromInt32(0)
  6827. }
  6828. goto _64
  6829. _5:
  6830. ;
  6831. result1 = _processXmlDecl(tls, parser, int32(1), s, *(*uintptr)(unsafe.Pointer(bp)))
  6832. if result1 != int32(_XML_ERROR_NONE) {
  6833. return result1
  6834. }
  6835. enc = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding
  6836. handleDefault = libc.Uint8FromInt32(0)
  6837. goto _64
  6838. _6:
  6839. ;
  6840. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  6841. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  6842. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  6843. return int32(_XML_ERROR_NO_MEMORY)
  6844. }
  6845. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  6846. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  6847. 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) {
  6848. return int32(_XML_ERROR_PUBLICID)
  6849. }
  6850. pubId = _poolStoreString(tls, parser+784, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  6851. if !(pubId != 0) {
  6852. return int32(_XML_ERROR_NO_MEMORY)
  6853. }
  6854. _normalizePublicId(tls, pubId)
  6855. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  6856. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid = pubId
  6857. handleDefault = libc.Uint8FromInt32(0)
  6858. goto alreadyChecked
  6859. }
  6860. /* fall through */
  6861. _7:
  6862. ;
  6863. 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) {
  6864. return int32(_XML_ERROR_PUBLICID)
  6865. }
  6866. goto alreadyChecked
  6867. alreadyChecked:
  6868. ;
  6869. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  6870. tem = _poolStoreString(tls, dtd+160, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  6871. if !(tem != 0) {
  6872. return int32(_XML_ERROR_NO_MEMORY)
  6873. }
  6874. _normalizePublicId(tls, tem)
  6875. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = tem
  6876. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  6877. /* Don't suppress the default handler if we fell through from
  6878. * the XML_ROLE_DOCTYPE_PUBLIC_ID case.
  6879. */
  6880. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 && role == int32(_XML_ROLE_ENTITY_PUBLIC_ID) {
  6881. handleDefault = libc.Uint8FromInt32(0)
  6882. }
  6883. }
  6884. goto _64
  6885. _8:
  6886. ;
  6887. if libc.Int32FromUint8(allowClosingDoctype) != libc.Int32FromUint8(libc.Uint8FromInt32(1)) {
  6888. /* Must not close doctype from within expanded parameter entities */
  6889. return int32(_XML_ERROR_INVALID_TOKEN)
  6890. }
  6891. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName != 0 {
  6892. (*(*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)
  6893. _poolClear(tls, parser+784)
  6894. handleDefault = libc.Uint8FromInt32(0)
  6895. }
  6896. /* parser->m_doctypeSysid will be non-NULL in the case of a previous
  6897. XML_ROLE_DOCTYPE_SYSTEM_ID, even if parser->m_startDoctypeDeclHandler
  6898. was not set, indicating an external subset
  6899. */
  6900. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid != 0 || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD != 0 {
  6901. hadParamEntityRefs = (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs
  6902. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  6903. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  6904. entity = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  6905. if !(entity != 0) {
  6906. /* The external subset name "#" will have already been
  6907. * inserted into the hash table at the start of the
  6908. * external entity parsing, so no allocation will happen
  6909. * and lookup() cannot fail.
  6910. */
  6911. return int32(_XML_ERROR_NO_MEMORY) /* LCOV_EXCL_LINE */
  6912. }
  6913. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD != 0 {
  6914. (*TENTITY)(unsafe.Pointer(entity)).Fbase = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  6915. }
  6916. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  6917. 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) {
  6918. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  6919. }
  6920. if (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0 {
  6921. 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) {
  6922. return int32(_XML_ERROR_NOT_STANDALONE)
  6923. }
  6924. } else {
  6925. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid != 0) {
  6926. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = hadParamEntityRefs
  6927. }
  6928. }
  6929. /* end of DTD - no need to update dtd->keepProcessing */
  6930. }
  6931. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  6932. }
  6933. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler != 0 {
  6934. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg)
  6935. handleDefault = libc.Uint8FromInt32(0)
  6936. }
  6937. goto _64
  6938. _9:
  6939. ;
  6940. /* if there is no DOCTYPE declaration then now is the
  6941. last chance to read the foreign DTD
  6942. */
  6943. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD != 0 {
  6944. hadParamEntityRefs1 = (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs
  6945. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  6946. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  6947. entity1 = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  6948. if !(entity1 != 0) {
  6949. return int32(_XML_ERROR_NO_MEMORY)
  6950. }
  6951. (*TENTITY)(unsafe.Pointer(entity1)).Fbase = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  6952. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  6953. 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) {
  6954. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  6955. }
  6956. if (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0 {
  6957. 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) {
  6958. return int32(_XML_ERROR_NOT_STANDALONE)
  6959. }
  6960. } else {
  6961. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = hadParamEntityRefs1
  6962. }
  6963. /* end of DTD - no need to update dtd->keepProcessing */
  6964. }
  6965. }
  6966. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_contentProcessor)
  6967. return _contentProcessor(tls, parser, s, end, nextPtr)
  6968. _10:
  6969. ;
  6970. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = _getElementType(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6971. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType != 0) {
  6972. return int32(_XML_ERROR_NO_MEMORY)
  6973. }
  6974. goto checkAttListDeclHandler
  6975. _11:
  6976. ;
  6977. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId = _getAttributeId(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6978. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId != 0) {
  6979. return int32(_XML_ERROR_NO_MEMORY)
  6980. }
  6981. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata = libc.Uint8FromInt32(0)
  6982. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = libc.UintptrFromInt32(0)
  6983. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId = libc.Uint8FromInt32(0)
  6984. goto checkAttListDeclHandler
  6985. _12:
  6986. ;
  6987. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata = libc.Uint8FromInt32(1)
  6988. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeCDATA))
  6989. goto checkAttListDeclHandler
  6990. _13:
  6991. ;
  6992. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId = libc.Uint8FromInt32(1)
  6993. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeID))
  6994. goto checkAttListDeclHandler
  6995. _14:
  6996. ;
  6997. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeIDREF))
  6998. goto checkAttListDeclHandler
  6999. _15:
  7000. ;
  7001. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeIDREFS))
  7002. goto checkAttListDeclHandler
  7003. _16:
  7004. ;
  7005. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeENTITY))
  7006. goto checkAttListDeclHandler
  7007. _17:
  7008. ;
  7009. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeENTITIES))
  7010. goto checkAttListDeclHandler
  7011. _18:
  7012. ;
  7013. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeNMTOKEN))
  7014. goto checkAttListDeclHandler
  7015. _19:
  7016. ;
  7017. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeNMTOKENS))
  7018. goto checkAttListDeclHandler
  7019. checkAttListDeclHandler:
  7020. ;
  7021. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 {
  7022. handleDefault = libc.Uint8FromInt32(0)
  7023. }
  7024. goto _64
  7025. _21:
  7026. ;
  7027. _20:
  7028. ;
  7029. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 {
  7030. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType != 0 {
  7031. prefix = uintptr(unsafe.Pointer(&_enumValueSep))
  7032. } else {
  7033. if role == int32(_XML_ROLE_ATTRIBUTE_NOTATION_VALUE) {
  7034. v65 = uintptr(unsafe.Pointer(&_notationPrefix))
  7035. } else {
  7036. v65 = uintptr(unsafe.Pointer(&_enumValueStart))
  7037. }
  7038. prefix = v65
  7039. }
  7040. if !(_poolAppendString(tls, parser+784, prefix) != 0) {
  7041. return int32(_XML_ERROR_NO_MEMORY)
  7042. }
  7043. if !(_poolAppend(tls, parser+784, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7044. return int32(_XML_ERROR_NO_MEMORY)
  7045. }
  7046. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  7047. handleDefault = libc.Uint8FromInt32(0)
  7048. }
  7049. goto _64
  7050. _23:
  7051. ;
  7052. _22:
  7053. ;
  7054. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7055. 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) {
  7056. return int32(_XML_ERROR_NO_MEMORY)
  7057. }
  7058. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType != 0 {
  7059. if int32(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_LPAREN) || int32(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_N) && int32(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType + 1))) == int32(m_ASCII_O) {
  7060. /* Enumerated or Notation type */
  7061. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  7062. v66 = 0
  7063. } else {
  7064. v68 = parser + 784 + 24
  7065. v67 = *(*uintptr)(unsafe.Pointer(v68))
  7066. *(*uintptr)(unsafe.Pointer(v68))++
  7067. *(*TXML_Char)(unsafe.Pointer(v67)) = int8(m_ASCII_RPAREN)
  7068. v66 = libc.Int32FromInt32(1)
  7069. }
  7070. if v72 = !(v66 != 0); !v72 {
  7071. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  7072. v69 = 0
  7073. } else {
  7074. v71 = parser + 784 + 24
  7075. v70 = *(*uintptr)(unsafe.Pointer(v71))
  7076. *(*uintptr)(unsafe.Pointer(v71))++
  7077. *(*TXML_Char)(unsafe.Pointer(v70)) = int8('\000')
  7078. v69 = libc.Int32FromInt32(1)
  7079. }
  7080. }
  7081. if v72 || !(v69 != 0) {
  7082. return int32(_XML_ERROR_NO_MEMORY)
  7083. }
  7084. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  7085. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  7086. }
  7087. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7088. (*(*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)))
  7089. handleDefault = libc.Uint8FromInt32(0)
  7090. }
  7091. }
  7092. _poolClear(tls, parser+784)
  7093. goto _64
  7094. _25:
  7095. ;
  7096. _24:
  7097. ;
  7098. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7099. 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))
  7100. if result2 != 0 {
  7101. return result2
  7102. }
  7103. attVal = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7104. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  7105. /* ID attributes aren't allowed to have a default */
  7106. 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) {
  7107. return int32(_XML_ERROR_NO_MEMORY)
  7108. }
  7109. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType != 0 {
  7110. if int32(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_LPAREN) || int32(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_N) && int32(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType + 1))) == int32(m_ASCII_O) {
  7111. /* Enumerated or Notation type */
  7112. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  7113. v73 = 0
  7114. } else {
  7115. v75 = parser + 784 + 24
  7116. v74 = *(*uintptr)(unsafe.Pointer(v75))
  7117. *(*uintptr)(unsafe.Pointer(v75))++
  7118. *(*TXML_Char)(unsafe.Pointer(v74)) = int8(m_ASCII_RPAREN)
  7119. v73 = libc.Int32FromInt32(1)
  7120. }
  7121. if v79 = !(v73 != 0); !v79 {
  7122. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  7123. v76 = 0
  7124. } else {
  7125. v78 = parser + 784 + 24
  7126. v77 = *(*uintptr)(unsafe.Pointer(v78))
  7127. *(*uintptr)(unsafe.Pointer(v78))++
  7128. *(*TXML_Char)(unsafe.Pointer(v77)) = int8('\000')
  7129. v76 = libc.Int32FromInt32(1)
  7130. }
  7131. }
  7132. if v79 || !(v76 != 0) {
  7133. return int32(_XML_ERROR_NO_MEMORY)
  7134. }
  7135. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  7136. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  7137. }
  7138. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7139. (*(*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)))
  7140. _poolClear(tls, parser+784)
  7141. handleDefault = libc.Uint8FromInt32(0)
  7142. }
  7143. }
  7144. goto _64
  7145. _26:
  7146. ;
  7147. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7148. 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))
  7149. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  7150. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FtextPtr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fstart
  7151. (*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))
  7152. (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fptr
  7153. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7154. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7155. (*(*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))
  7156. handleDefault = libc.Uint8FromInt32(0)
  7157. }
  7158. } else {
  7159. (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fstart
  7160. }
  7161. if result3 != int32(_XML_ERROR_NONE) {
  7162. return result3
  7163. }
  7164. }
  7165. goto _64
  7166. _27:
  7167. ;
  7168. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  7169. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  7170. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  7171. (*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))
  7172. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid == libc.UintptrFromInt32(0) {
  7173. return int32(_XML_ERROR_NO_MEMORY)
  7174. }
  7175. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  7176. handleDefault = libc.Uint8FromInt32(0)
  7177. } else {
  7178. /* use externalSubsetName to make parser->m_doctypeSysid non-NULL
  7179. for the case where no parser->m_startDoctypeDeclHandler is set */
  7180. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = uintptr(unsafe.Pointer(&_externalSubsetName))
  7181. }
  7182. 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) {
  7183. return int32(_XML_ERROR_NOT_STANDALONE)
  7184. }
  7185. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  7186. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  7187. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  7188. return int32(_XML_ERROR_NO_MEMORY)
  7189. }
  7190. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = libc.UintptrFromInt32(0)
  7191. }
  7192. /* fall through */
  7193. _28:
  7194. ;
  7195. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  7196. (*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))
  7197. if !((*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FsystemId != 0) {
  7198. return int32(_XML_ERROR_NO_MEMORY)
  7199. }
  7200. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fbase = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  7201. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  7202. /* Don't suppress the default handler if we fell through from
  7203. * the XML_ROLE_DOCTYPE_SYSTEM_ID case.
  7204. */
  7205. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 && role == int32(_XML_ROLE_ENTITY_SYSTEM_ID) {
  7206. handleDefault = libc.Uint8FromInt32(0)
  7207. }
  7208. }
  7209. goto _64
  7210. _29:
  7211. ;
  7212. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7213. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7214. (*(*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))
  7215. handleDefault = libc.Uint8FromInt32(0)
  7216. }
  7217. goto _64
  7218. _30:
  7219. ;
  7220. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  7221. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fnotation = _poolStoreString(tls, dtd+160, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7222. if !((*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fnotation != 0) {
  7223. return int32(_XML_ERROR_NO_MEMORY)
  7224. }
  7225. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  7226. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler != 0 {
  7227. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7228. (*(*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)
  7229. handleDefault = libc.Uint8FromInt32(0)
  7230. } else {
  7231. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7232. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7233. (*(*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)
  7234. handleDefault = libc.Uint8FromInt32(0)
  7235. }
  7236. }
  7237. }
  7238. goto _64
  7239. _31:
  7240. ;
  7241. 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 {
  7242. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7243. goto _64
  7244. }
  7245. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7246. name = _poolStoreString(tls, dtd+160, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7247. if !(name != 0) {
  7248. return int32(_XML_ERROR_NO_MEMORY)
  7249. }
  7250. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd, name, uint64(64))
  7251. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  7252. return int32(_XML_ERROR_NO_MEMORY)
  7253. }
  7254. if (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fname != name {
  7255. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7256. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7257. } else {
  7258. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  7259. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = libc.UintptrFromInt32(0)
  7260. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fis_param = libc.Uint8FromInt32(0)
  7261. /* if we have a parent parser or are reading an internal parameter
  7262. entity, then the entity declaration is not considered "internal"
  7263. */
  7264. (*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))
  7265. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7266. handleDefault = libc.Uint8FromInt32(0)
  7267. }
  7268. }
  7269. } else {
  7270. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7271. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7272. }
  7273. goto _64
  7274. _32:
  7275. ;
  7276. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7277. name1 = _poolStoreString(tls, dtd+160, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7278. if !(name1 != 0) {
  7279. return int32(_XML_ERROR_NO_MEMORY)
  7280. }
  7281. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd+264, name1, uint64(64))
  7282. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  7283. return int32(_XML_ERROR_NO_MEMORY)
  7284. }
  7285. if (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fname != name1 {
  7286. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7287. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7288. } else {
  7289. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  7290. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = libc.UintptrFromInt32(0)
  7291. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fis_param = libc.Uint8FromInt32(1)
  7292. /* if we have a parent parser or are reading an internal parameter
  7293. entity, then the entity declaration is not considered "internal"
  7294. */
  7295. (*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))
  7296. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7297. handleDefault = libc.Uint8FromInt32(0)
  7298. }
  7299. }
  7300. } else {
  7301. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7302. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7303. }
  7304. goto _64
  7305. _33:
  7306. ;
  7307. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId = libc.UintptrFromInt32(0)
  7308. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName = libc.UintptrFromInt32(0)
  7309. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  7310. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName = _poolStoreString(tls, parser+784, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7311. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName != 0) {
  7312. return int32(_XML_ERROR_NO_MEMORY)
  7313. }
  7314. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  7315. handleDefault = libc.Uint8FromInt32(0)
  7316. }
  7317. goto _64
  7318. _34:
  7319. ;
  7320. 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) {
  7321. return int32(_XML_ERROR_PUBLICID)
  7322. }
  7323. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName != 0 { /* means m_notationDeclHandler != NULL */
  7324. tem1 = _poolStoreString(tls, parser+784, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7325. if !(tem1 != 0) {
  7326. return int32(_XML_ERROR_NO_MEMORY)
  7327. }
  7328. _normalizePublicId(tls, tem1)
  7329. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId = tem1
  7330. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  7331. handleDefault = libc.Uint8FromInt32(0)
  7332. }
  7333. goto _64
  7334. _35:
  7335. ;
  7336. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  7337. systemId = _poolStoreString(tls, parser+784, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7338. if !(systemId != 0) {
  7339. return int32(_XML_ERROR_NO_MEMORY)
  7340. }
  7341. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7342. (*(*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)
  7343. handleDefault = libc.Uint8FromInt32(0)
  7344. }
  7345. _poolClear(tls, parser+784)
  7346. goto _64
  7347. _36:
  7348. ;
  7349. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  7350. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7351. (*(*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)
  7352. handleDefault = libc.Uint8FromInt32(0)
  7353. }
  7354. _poolClear(tls, parser+784)
  7355. goto _64
  7356. _37:
  7357. ;
  7358. switch tok {
  7359. case int32(m_XML_TOK_PARAM_ENTITY_REF):
  7360. /* PE references in internal subset are
  7361. not allowed within declarations. */
  7362. return int32(_XML_ERROR_PARAM_ENTITY_REF)
  7363. case int32(m_XML_TOK_XML_DECL):
  7364. return int32(_XML_ERROR_MISPLACED_XML_PI)
  7365. default:
  7366. return int32(_XML_ERROR_SYNTAX)
  7367. }
  7368. _38:
  7369. ;
  7370. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7371. _reportDefault(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7372. }
  7373. handleDefault = libc.Uint8FromInt32(0)
  7374. result4 = _doIgnoreSection(tls, parser, enc, bp, end, nextPtr, haveMore)
  7375. if result4 != int32(_XML_ERROR_NONE) {
  7376. return result4
  7377. } else {
  7378. if !(*(*uintptr)(unsafe.Pointer(bp)) != 0) {
  7379. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_ignoreSectionProcessor)
  7380. return result4
  7381. }
  7382. }
  7383. goto _64
  7384. _39:
  7385. ;
  7386. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel >= (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize {
  7387. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize != 0 {
  7388. /* Detect and prevent integer overflow */
  7389. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize > libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromUint32(2) {
  7390. return int32(_XML_ERROR_NO_MEMORY)
  7391. }
  7392. p80 = parser + 888
  7393. *(*uint32)(unsafe.Pointer(p80)) *= uint32(2)
  7394. 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))))
  7395. if new_connector == libc.UintptrFromInt32(0) {
  7396. *(*uint32)(unsafe.Pointer(parser + 888)) /= uint32(2)
  7397. return int32(_XML_ERROR_NO_MEMORY)
  7398. }
  7399. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector = new_connector
  7400. if (*TDTD)(unsafe.Pointer(dtd)).FscaffIndex != 0 {
  7401. /* Detect and prevent integer overflow.
  7402. * The preprocessor guard addresses the "always false" warning
  7403. * from -Wtype-limits on platforms where
  7404. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  7405. 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))
  7406. if new_scaff_index == libc.UintptrFromInt32(0) {
  7407. return int32(_XML_ERROR_NO_MEMORY)
  7408. }
  7409. (*TDTD)(unsafe.Pointer(dtd)).FscaffIndex = new_scaff_index
  7410. }
  7411. } else {
  7412. v81 = libc.Uint32FromInt32(32)
  7413. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize = v81
  7414. (*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))
  7415. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector != 0) {
  7416. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize = uint32(0)
  7417. return int32(_XML_ERROR_NO_MEMORY)
  7418. }
  7419. }
  7420. }
  7421. *(*int8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) = 0
  7422. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7423. myindex = _nextScaffoldPart(tls, parser)
  7424. if myindex < 0 {
  7425. return int32(_XML_ERROR_NO_MEMORY)
  7426. }
  7427. *(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel)*4)) = myindex
  7428. (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel++
  7429. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex)*32))).Ftype1 = int32(_XML_CTYPE_SEQ)
  7430. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7431. handleDefault = libc.Uint8FromInt32(0)
  7432. }
  7433. }
  7434. goto _64
  7435. _40:
  7436. ;
  7437. if int32(*(*int8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel)))) == int32(m_ASCII_PIPE) {
  7438. return int32(_XML_ERROR_SYNTAX)
  7439. }
  7440. *(*int8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) = int8(m_ASCII_COMMA)
  7441. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7442. handleDefault = libc.Uint8FromInt32(0)
  7443. }
  7444. goto _64
  7445. _41:
  7446. ;
  7447. if int32(*(*int8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel)))) == int32(m_ASCII_COMMA) {
  7448. return int32(_XML_ERROR_SYNTAX)
  7449. }
  7450. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 && !(*(*int8)(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) {
  7451. (*(*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)
  7452. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7453. handleDefault = libc.Uint8FromInt32(0)
  7454. }
  7455. }
  7456. *(*int8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) = int8(m_ASCII_PIPE)
  7457. goto _64
  7458. _43:
  7459. ;
  7460. _42:
  7461. ;
  7462. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  7463. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0) {
  7464. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7465. } else {
  7466. name2 = _poolStoreString(tls, dtd+160, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7467. if !(name2 != 0) {
  7468. return int32(_XML_ERROR_NO_MEMORY)
  7469. }
  7470. entity2 = _lookup(tls, parser, dtd+264, name2, uint64(0))
  7471. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7472. /* first, determine if a check for an existing declaration is needed;
  7473. if yes, check that the entity exists, and that it is internal,
  7474. otherwise call the skipped entity handler
  7475. */
  7476. if v83 = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FdocumentEntity != 0; v83 {
  7477. if (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0 {
  7478. v82 = libc.BoolInt32(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0))
  7479. } else {
  7480. v82 = libc.BoolInt32(!((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0))
  7481. }
  7482. }
  7483. if v83 && v82 != 0 {
  7484. if !(entity2 != 0) {
  7485. return int32(_XML_ERROR_UNDEFINED_ENTITY)
  7486. } else {
  7487. if !((*TENTITY)(unsafe.Pointer(entity2)).Fis_internal != 0) {
  7488. /* It's hard to exhaustively search the code to be sure,
  7489. * but there doesn't seem to be a way of executing the
  7490. * following line. There are two cases:
  7491. *
  7492. * If 'standalone' is false, the DTD must have no
  7493. * parameter entities or we wouldn't have passed the outer
  7494. * 'if' statement. That means the only entity in the hash
  7495. * table is the external subset name "#" which cannot be
  7496. * given as a parameter entity name in XML syntax, so the
  7497. * lookup must have returned NULL and we don't even reach
  7498. * the test for an internal entity.
  7499. *
  7500. * If 'standalone' is true, it does not seem to be
  7501. * possible to create entities taking this code path that
  7502. * are not internal entities, so fail the test above.
  7503. *
  7504. * Because this analysis is very uncertain, the code is
  7505. * being left in place and merely removed from the
  7506. * coverage test statistics.
  7507. */
  7508. return int32(_XML_ERROR_ENTITY_DECLARED_IN_PE) /* LCOV_EXCL_LINE */
  7509. }
  7510. }
  7511. } else {
  7512. if !(entity2 != 0) {
  7513. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7514. /* cannot report skipped entities in declarations */
  7515. if role == int32(_XML_ROLE_PARAM_ENTITY_REF) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler != 0 {
  7516. (*(*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))
  7517. handleDefault = libc.Uint8FromInt32(0)
  7518. }
  7519. goto _64
  7520. }
  7521. }
  7522. if (*TENTITY)(unsafe.Pointer(entity2)).Fopen != 0 {
  7523. return int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  7524. }
  7525. if (*TENTITY)(unsafe.Pointer(entity2)).FtextPtr != 0 {
  7526. if role == int32(_XML_ROLE_PARAM_ENTITY_REF) {
  7527. v84 = libc.Int32FromUint8(libc.Uint8FromInt32(1))
  7528. } else {
  7529. v84 = libc.Int32FromUint8(libc.Uint8FromInt32(0))
  7530. }
  7531. betweenDecl = libc.Uint8FromInt32(v84)
  7532. result5 = _processInternalEntity(tls, parser, entity2, betweenDecl)
  7533. if result5 != int32(_XML_ERROR_NONE) {
  7534. return result5
  7535. }
  7536. handleDefault = libc.Uint8FromInt32(0)
  7537. goto _64
  7538. }
  7539. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  7540. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  7541. (*TENTITY)(unsafe.Pointer(entity2)).Fopen = libc.Uint8FromInt32(1)
  7542. _entityTrackingOnOpen(tls, parser, entity2, int32(5439))
  7543. 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) {
  7544. _entityTrackingOnClose(tls, parser, entity2, int32(5443))
  7545. (*TENTITY)(unsafe.Pointer(entity2)).Fopen = libc.Uint8FromInt32(0)
  7546. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  7547. }
  7548. _entityTrackingOnClose(tls, parser, entity2, int32(5447))
  7549. (*TENTITY)(unsafe.Pointer(entity2)).Fopen = libc.Uint8FromInt32(0)
  7550. handleDefault = libc.Uint8FromInt32(0)
  7551. if !((*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0) {
  7552. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7553. goto _64
  7554. }
  7555. } else {
  7556. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7557. goto _64
  7558. }
  7559. }
  7560. 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) {
  7561. return int32(_XML_ERROR_NOT_STANDALONE)
  7562. }
  7563. goto _64
  7564. /* Element declaration stuff */
  7565. _44:
  7566. ;
  7567. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7568. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = _getElementType(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7569. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType != 0) {
  7570. return int32(_XML_ERROR_NO_MEMORY)
  7571. }
  7572. (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel = 0
  7573. (*TDTD)(unsafe.Pointer(dtd)).FscaffCount = uint32(0)
  7574. (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl = libc.Uint8FromInt32(1)
  7575. handleDefault = libc.Uint8FromInt32(0)
  7576. }
  7577. goto _64
  7578. _46:
  7579. ;
  7580. _45:
  7581. ;
  7582. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7583. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7584. content = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(32))
  7585. if !(content != 0) {
  7586. return int32(_XML_ERROR_NO_MEMORY)
  7587. }
  7588. (*TXML_Content)(unsafe.Pointer(content)).Fquant = int32(_XML_CQUANT_NONE)
  7589. (*TXML_Content)(unsafe.Pointer(content)).Fname = libc.UintptrFromInt32(0)
  7590. (*TXML_Content)(unsafe.Pointer(content)).Fnumchildren = uint32(0)
  7591. (*TXML_Content)(unsafe.Pointer(content)).Fchildren = libc.UintptrFromInt32(0)
  7592. if role == int32(_XML_ROLE_CONTENT_ANY) {
  7593. v85 = int32(_XML_CTYPE_ANY)
  7594. } else {
  7595. v85 = int32(_XML_CTYPE_EMPTY)
  7596. }
  7597. (*TXML_Content)(unsafe.Pointer(content)).Ftype1 = v85
  7598. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7599. (*(*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)
  7600. handleDefault = libc.Uint8FromInt32(0)
  7601. }
  7602. (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl = libc.Uint8FromInt32(0)
  7603. }
  7604. goto _64
  7605. _47:
  7606. ;
  7607. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7608. (*(*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)
  7609. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7610. handleDefault = libc.Uint8FromInt32(0)
  7611. }
  7612. }
  7613. goto _64
  7614. _48:
  7615. ;
  7616. quant = int32(_XML_CQUANT_NONE)
  7617. goto elementContent
  7618. _49:
  7619. ;
  7620. quant = int32(_XML_CQUANT_OPT)
  7621. goto elementContent
  7622. _50:
  7623. ;
  7624. quant = int32(_XML_CQUANT_REP)
  7625. goto elementContent
  7626. _51:
  7627. ;
  7628. quant = int32(_XML_CQUANT_PLUS)
  7629. goto elementContent
  7630. elementContent:
  7631. ;
  7632. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7633. if quant == int32(_XML_CQUANT_NONE) {
  7634. v86 = *(*uintptr)(unsafe.Pointer(bp))
  7635. } else {
  7636. v86 = *(*uintptr)(unsafe.Pointer(bp)) - uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  7637. }
  7638. nxt = v86
  7639. myindex1 = _nextScaffoldPart(tls, parser)
  7640. if myindex1 < 0 {
  7641. return int32(_XML_ERROR_NO_MEMORY)
  7642. }
  7643. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex1)*32))).Ftype1 = int32(_XML_CTYPE_NAME)
  7644. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex1)*32))).Fquant = quant
  7645. el = _getElementType(tls, parser, enc, s, nxt)
  7646. if !(el != 0) {
  7647. return int32(_XML_ERROR_NO_MEMORY)
  7648. }
  7649. name3 = (*TELEMENT_TYPE)(unsafe.Pointer(el)).Fname
  7650. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex1)*32))).Fname = name3
  7651. nameLen = uint64(0)
  7652. for {
  7653. v88 = nameLen
  7654. nameLen++
  7655. if !(*(*TXML_Char)(unsafe.Pointer(name3 + uintptr(v88))) != 0) {
  7656. break
  7657. }
  7658. goto _87
  7659. _87:
  7660. }
  7661. /* Detect and prevent integer overflow */
  7662. if nameLen > uint64(uint32(0xffffffff)-(*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen) {
  7663. return int32(_XML_ERROR_NO_MEMORY)
  7664. }
  7665. *(*uint32)(unsafe.Pointer(dtd + 336)) += uint32(nameLen)
  7666. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7667. handleDefault = libc.Uint8FromInt32(0)
  7668. }
  7669. }
  7670. goto _64
  7671. _52:
  7672. ;
  7673. quant = int32(_XML_CQUANT_NONE)
  7674. goto closeGroup
  7675. _53:
  7676. ;
  7677. quant = int32(_XML_CQUANT_OPT)
  7678. goto closeGroup
  7679. _54:
  7680. ;
  7681. quant = int32(_XML_CQUANT_REP)
  7682. goto closeGroup
  7683. _55:
  7684. ;
  7685. quant = int32(_XML_CQUANT_PLUS)
  7686. goto closeGroup
  7687. closeGroup:
  7688. ;
  7689. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7690. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7691. handleDefault = libc.Uint8FromInt32(0)
  7692. }
  7693. (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel--
  7694. (*(*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
  7695. if (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel == 0 {
  7696. if !(handleDefault != 0) {
  7697. model = _build_model(tls, parser)
  7698. if !(model != 0) {
  7699. return int32(_XML_ERROR_NO_MEMORY)
  7700. }
  7701. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7702. (*(*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)
  7703. }
  7704. (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl = libc.Uint8FromInt32(0)
  7705. (*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen = uint32(0)
  7706. }
  7707. }
  7708. goto _64
  7709. /* End element declaration stuff */
  7710. _56:
  7711. ;
  7712. if !(_reportProcessingInstruction(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7713. return int32(_XML_ERROR_NO_MEMORY)
  7714. }
  7715. handleDefault = libc.Uint8FromInt32(0)
  7716. goto _64
  7717. _57:
  7718. ;
  7719. if !(_reportComment(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7720. return int32(_XML_ERROR_NO_MEMORY)
  7721. }
  7722. handleDefault = libc.Uint8FromInt32(0)
  7723. goto _64
  7724. _58:
  7725. ;
  7726. switch tok {
  7727. case int32(m_XML_TOK_BOM):
  7728. handleDefault = libc.Uint8FromInt32(0)
  7729. break
  7730. }
  7731. goto _64
  7732. _59:
  7733. ;
  7734. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  7735. handleDefault = libc.Uint8FromInt32(0)
  7736. }
  7737. goto _64
  7738. _60:
  7739. ;
  7740. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7741. handleDefault = libc.Uint8FromInt32(0)
  7742. }
  7743. goto _64
  7744. _61:
  7745. ;
  7746. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  7747. handleDefault = libc.Uint8FromInt32(0)
  7748. }
  7749. goto _64
  7750. _62:
  7751. ;
  7752. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 {
  7753. handleDefault = libc.Uint8FromInt32(0)
  7754. }
  7755. goto _64
  7756. _63:
  7757. ;
  7758. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7759. handleDefault = libc.Uint8FromInt32(0)
  7760. }
  7761. goto _64
  7762. _64:
  7763. ; /* end of big switch */
  7764. if handleDefault != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7765. _reportDefault(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7766. }
  7767. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  7768. case int32(_XML_SUSPENDED):
  7769. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  7770. return int32(_XML_ERROR_NONE)
  7771. case int32(_XML_FINISHED):
  7772. return int32(_XML_ERROR_ABORTED)
  7773. default:
  7774. s = *(*uintptr)(unsafe.Pointer(bp))
  7775. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc))})))(tls, enc, s, end, bp)
  7776. }
  7777. goto _1
  7778. _1:
  7779. }
  7780. /* not reached */
  7781. return r
  7782. }
  7783. var _externalSubsetName = [2]TXML_Char{
  7784. 0: int8(m_ASCII_HASH),
  7785. }
  7786. var _atypeCDATA = [6]TXML_Char{
  7787. 0: int8(m_ASCII_C),
  7788. 1: int8(m_ASCII_D),
  7789. 2: int8(m_ASCII_A),
  7790. 3: int8(m_ASCII_T),
  7791. 4: int8(m_ASCII_A),
  7792. }
  7793. var _atypeID = [3]TXML_Char{
  7794. 0: int8(m_ASCII_I),
  7795. 1: int8(m_ASCII_D),
  7796. }
  7797. var _atypeIDREF = [6]TXML_Char{
  7798. 0: int8(m_ASCII_I),
  7799. 1: int8(m_ASCII_D),
  7800. 2: int8(m_ASCII_R),
  7801. 3: int8(m_ASCII_E),
  7802. 4: int8(m_ASCII_F),
  7803. }
  7804. var _atypeIDREFS = [7]TXML_Char{
  7805. 0: int8(m_ASCII_I),
  7806. 1: int8(m_ASCII_D),
  7807. 2: int8(m_ASCII_R),
  7808. 3: int8(m_ASCII_E),
  7809. 4: int8(m_ASCII_F),
  7810. 5: int8(m_ASCII_S),
  7811. }
  7812. var _atypeENTITY = [7]TXML_Char{
  7813. 0: int8(m_ASCII_E),
  7814. 1: int8(m_ASCII_N),
  7815. 2: int8(m_ASCII_T),
  7816. 3: int8(m_ASCII_I),
  7817. 4: int8(m_ASCII_T),
  7818. 5: int8(m_ASCII_Y),
  7819. }
  7820. var _atypeENTITIES = [9]TXML_Char{
  7821. 0: int8(m_ASCII_E),
  7822. 1: int8(m_ASCII_N),
  7823. 2: int8(m_ASCII_T),
  7824. 3: int8(m_ASCII_I),
  7825. 4: int8(m_ASCII_T),
  7826. 5: int8(m_ASCII_I),
  7827. 6: int8(m_ASCII_E),
  7828. 7: int8(m_ASCII_S),
  7829. }
  7830. var _atypeNMTOKEN = [8]TXML_Char{
  7831. 0: int8(m_ASCII_N),
  7832. 1: int8(m_ASCII_M),
  7833. 2: int8(m_ASCII_T),
  7834. 3: int8(m_ASCII_O),
  7835. 4: int8(m_ASCII_K),
  7836. 5: int8(m_ASCII_E),
  7837. 6: int8(m_ASCII_N),
  7838. }
  7839. var _atypeNMTOKENS = [9]TXML_Char{
  7840. 0: int8(m_ASCII_N),
  7841. 1: int8(m_ASCII_M),
  7842. 2: int8(m_ASCII_T),
  7843. 3: int8(m_ASCII_O),
  7844. 4: int8(m_ASCII_K),
  7845. 5: int8(m_ASCII_E),
  7846. 6: int8(m_ASCII_N),
  7847. 7: int8(m_ASCII_S),
  7848. }
  7849. var _notationPrefix = [10]TXML_Char{
  7850. 0: int8(m_ASCII_N),
  7851. 1: int8(m_ASCII_O),
  7852. 2: int8(m_ASCII_T),
  7853. 3: int8(m_ASCII_A),
  7854. 4: int8(m_ASCII_T),
  7855. 5: int8(m_ASCII_I),
  7856. 6: int8(m_ASCII_O),
  7857. 7: int8(m_ASCII_N),
  7858. 8: int8(m_ASCII_LPAREN),
  7859. }
  7860. var _enumValueSep = [2]TXML_Char{
  7861. 0: int8(m_ASCII_PIPE),
  7862. }
  7863. var _enumValueStart = [2]TXML_Char{
  7864. 0: int8(m_ASCII_LPAREN),
  7865. }
  7866. func _epilogProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  7867. bp := tls.Alloc(16)
  7868. defer tls.Free(16)
  7869. var tok int32
  7870. var v2 uintptr
  7871. var _ /* next at bp+0 */ uintptr
  7872. _, _ = tok, v2
  7873. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_epilogProcessor)
  7874. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = s
  7875. for {
  7876. *(*uintptr)(unsafe.Pointer(bp)) = libc.UintptrFromInt32(0)
  7877. 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)
  7878. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(5652), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  7879. _accountingOnAbort(tls, parser)
  7880. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  7881. }
  7882. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = *(*uintptr)(unsafe.Pointer(bp))
  7883. switch tok {
  7884. /* report partial linebreak - it might be the last token */
  7885. case -int32(m_XML_TOK_PROLOG_S):
  7886. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7887. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp)))
  7888. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  7889. return int32(_XML_ERROR_ABORTED)
  7890. }
  7891. }
  7892. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  7893. return int32(_XML_ERROR_NONE)
  7894. case -int32(4):
  7895. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  7896. return int32(_XML_ERROR_NONE)
  7897. case int32(m_XML_TOK_PROLOG_S):
  7898. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7899. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp)))
  7900. }
  7901. case int32(m_XML_TOK_PI):
  7902. if !(_reportProcessingInstruction(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7903. return int32(_XML_ERROR_NO_MEMORY)
  7904. }
  7905. case int32(m_XML_TOK_COMMENT):
  7906. if !(_reportComment(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7907. return int32(_XML_ERROR_NO_MEMORY)
  7908. }
  7909. case m_XML_TOK_INVALID:
  7910. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  7911. return int32(_XML_ERROR_INVALID_TOKEN)
  7912. case -int32(1):
  7913. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  7914. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  7915. return int32(_XML_ERROR_NONE)
  7916. }
  7917. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  7918. case -int32(2):
  7919. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  7920. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  7921. return int32(_XML_ERROR_NONE)
  7922. }
  7923. return int32(_XML_ERROR_PARTIAL_CHAR)
  7924. default:
  7925. return int32(_XML_ERROR_JUNK_AFTER_DOC_ELEMENT)
  7926. }
  7927. v2 = *(*uintptr)(unsafe.Pointer(bp))
  7928. s = v2
  7929. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = v2
  7930. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  7931. case int32(_XML_SUSPENDED):
  7932. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  7933. return int32(_XML_ERROR_NONE)
  7934. case int32(_XML_FINISHED):
  7935. return int32(_XML_ERROR_ABORTED)
  7936. default:
  7937. }
  7938. goto _1
  7939. _1:
  7940. }
  7941. return r
  7942. }
  7943. func _processInternalEntity(tls *libc.TLS, parser TXML_Parser, entity uintptr, betweenDecl TXML_Bool) (r _XML_Error) {
  7944. bp := tls.Alloc(16)
  7945. defer tls.Free(16)
  7946. var openEntity, textEnd, textStart uintptr
  7947. var result _XML_Error
  7948. var tok int32
  7949. var _ /* next at bp+0 */ uintptr
  7950. _, _, _, _, _ = openEntity, result, textEnd, textStart, tok
  7951. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities != 0 {
  7952. openEntity = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  7953. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  7954. } else {
  7955. openEntity = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(40))
  7956. if !(openEntity != 0) {
  7957. return int32(_XML_ERROR_NO_MEMORY)
  7958. }
  7959. }
  7960. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  7961. _entityTrackingOnOpen(tls, parser, entity, int32(5732))
  7962. (*TENTITY)(unsafe.Pointer(entity)).Fprocessed = 0
  7963. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  7964. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = openEntity
  7965. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fentity = entity
  7966. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FstartTagLevel = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel
  7967. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FbetweenDecl = betweenDecl
  7968. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FinternalEventPtr = libc.UintptrFromInt32(0)
  7969. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FinternalEventEndPtr = libc.UintptrFromInt32(0)
  7970. textStart = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr
  7971. textEnd = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen)
  7972. /* Set a safe default value in case 'next' does not get set */
  7973. *(*uintptr)(unsafe.Pointer(bp)) = textStart
  7974. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  7975. 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)
  7976. 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))
  7977. } else {
  7978. 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))
  7979. }
  7980. if result == int32(_XML_ERROR_NONE) {
  7981. if textEnd != *(*uintptr)(unsafe.Pointer(bp)) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  7982. (*TENTITY)(unsafe.Pointer(entity)).Fprocessed = int32(int64(*(*uintptr)(unsafe.Pointer(bp))) - int64(textStart))
  7983. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_internalEntityProcessor)
  7984. } else {
  7985. _entityTrackingOnClose(tls, parser, entity, int32(5766))
  7986. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  7987. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  7988. /* put openEntity back in list of free instances */
  7989. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  7990. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = openEntity
  7991. }
  7992. }
  7993. return result
  7994. }
  7995. func _internalEntityProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  7996. bp := tls.Alloc(16)
  7997. defer tls.Free(16)
  7998. var entity, openEntity, textEnd, textStart uintptr
  7999. var result _XML_Error
  8000. var tok, tok1, v1 int32
  8001. var _ /* next at bp+0 */ uintptr
  8002. _, _, _, _, _, _, _, _ = entity, openEntity, result, textEnd, textStart, tok, tok1, v1
  8003. openEntity = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  8004. if !(openEntity != 0) {
  8005. return int32(_XML_ERROR_UNEXPECTED_STATE)
  8006. }
  8007. entity = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fentity
  8008. textStart = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).Fprocessed)
  8009. textEnd = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen)
  8010. /* Set a safe default value in case 'next' does not get set */
  8011. *(*uintptr)(unsafe.Pointer(bp)) = textStart
  8012. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  8013. 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)
  8014. 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))
  8015. } else {
  8016. 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))
  8017. }
  8018. if result != int32(_XML_ERROR_NONE) {
  8019. return result
  8020. }
  8021. if textEnd != *(*uintptr)(unsafe.Pointer(bp)) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  8022. (*TENTITY)(unsafe.Pointer(entity)).Fprocessed = int32(int64(*(*uintptr)(unsafe.Pointer(bp))) - int64((*TENTITY)(unsafe.Pointer(entity)).FtextPtr))
  8023. return result
  8024. }
  8025. _entityTrackingOnClose(tls, parser, entity, int32(5817))
  8026. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8027. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  8028. /* put openEntity back in list of free instances */
  8029. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  8030. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = openEntity
  8031. // If there are more open entities we want to stop right here and have the
  8032. // upcoming call to XML_ResumeParser continue with entity content, or it would
  8033. // be ignored altogether.
  8034. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != libc.UintptrFromInt32(0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  8035. return int32(_XML_ERROR_NONE)
  8036. }
  8037. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  8038. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  8039. 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)
  8040. 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))
  8041. } else {
  8042. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_contentProcessor)
  8043. /* see externalEntityContentProcessor vs contentProcessor */
  8044. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 {
  8045. v1 = int32(1)
  8046. } else {
  8047. v1 = 0
  8048. }
  8049. 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))
  8050. if result == int32(_XML_ERROR_NONE) {
  8051. if !(_storeRawNames(tls, parser) != 0) {
  8052. return int32(_XML_ERROR_NO_MEMORY)
  8053. }
  8054. }
  8055. return result
  8056. }
  8057. return r
  8058. }
  8059. func _errorProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  8060. _ = s
  8061. _ = end
  8062. _ = nextPtr
  8063. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode
  8064. }
  8065. 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) {
  8066. var result _XML_Error
  8067. var v1 int32
  8068. var v2, v3 uintptr
  8069. _, _, _, _ = result, v1, v2, v3
  8070. result = _appendAttributeValue(tls, parser, enc, isCdata, ptr, end, pool, account)
  8071. if result != 0 {
  8072. return result
  8073. }
  8074. if !(isCdata != 0) && int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart) != 0 && int32(*(*TXML_Char)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20) {
  8075. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr--
  8076. }
  8077. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  8078. v1 = 0
  8079. } else {
  8080. v3 = pool + 24
  8081. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8082. *(*uintptr)(unsafe.Pointer(v3))++
  8083. *(*TXML_Char)(unsafe.Pointer(v2)) = int8('\000')
  8084. v1 = libc.Int32FromInt32(1)
  8085. }
  8086. if !(v1 != 0) {
  8087. return int32(_XML_ERROR_NO_MEMORY)
  8088. }
  8089. return int32(_XML_ERROR_NONE)
  8090. }
  8091. 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) {
  8092. bp := tls.Alloc(16)
  8093. defer tls.Free(16)
  8094. var checkEntityDecl int8
  8095. var dtd, entity, name, textEnd, v10, v11, v4, v5, v7, v8 uintptr
  8096. var i, n, tok, v12, v3, v6, v9 int32
  8097. var result _XML_Error
  8098. var v13 bool
  8099. var _ /* buf at bp+8 */ [4]TXML_Char
  8100. var _ /* ch at bp+12 */ TXML_Char
  8101. var _ /* next at bp+0 */ uintptr
  8102. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = checkEntityDecl, dtd, entity, i, n, name, result, textEnd, tok, v10, v11, v12, v13, v3, v4, v5, v6, v7, v8, v9
  8103. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  8104. for {
  8105. *(*uintptr)(unsafe.Pointer(bp)) = ptr /* XmlAttributeValueTok doesn't always set the last arg */
  8106. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 32))})))(tls, enc, ptr, end, bp)
  8107. if !(_accountingDiffTolerated(tls, parser, tok, ptr, *(*uintptr)(unsafe.Pointer(bp)), int32(5896), account) != 0) {
  8108. _accountingOnAbort(tls, parser)
  8109. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  8110. }
  8111. switch tok {
  8112. case -int32(4):
  8113. return int32(_XML_ERROR_NONE)
  8114. case m_XML_TOK_INVALID:
  8115. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8116. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  8117. }
  8118. return int32(_XML_ERROR_INVALID_TOKEN)
  8119. case -int32(1):
  8120. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8121. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8122. }
  8123. return int32(_XML_ERROR_INVALID_TOKEN)
  8124. case int32(m_XML_TOK_CHAR_REF):
  8125. n = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FcharRefNumber})))(tls, enc, ptr)
  8126. if n < 0 {
  8127. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8128. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8129. }
  8130. return int32(_XML_ERROR_BAD_CHAR_REF)
  8131. }
  8132. if !(isCdata != 0) && n == int32(0x20) && (int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart) == 0 || int32(*(*TXML_Char)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20)) {
  8133. break
  8134. }
  8135. n = XXmlUtf8Encode(tls, n, bp+8)
  8136. /* The XmlEncode() functions can never return 0 here. That
  8137. * error return happens if the code point passed in is either
  8138. * negative or greater than or equal to 0x110000. The
  8139. * XmlCharRefNumber() functions will all return a number
  8140. * strictly less than 0x110000 or a negative value if an error
  8141. * occurred. The negative value is intercepted above, so
  8142. * XmlEncode() is never passed a value it might return an
  8143. * error for.
  8144. */
  8145. i = 0
  8146. for {
  8147. if !(i < n) {
  8148. break
  8149. }
  8150. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  8151. v3 = 0
  8152. } else {
  8153. v5 = pool + 24
  8154. v4 = *(*uintptr)(unsafe.Pointer(v5))
  8155. *(*uintptr)(unsafe.Pointer(v5))++
  8156. *(*TXML_Char)(unsafe.Pointer(v4)) = (*(*[4]TXML_Char)(unsafe.Pointer(bp + 8)))[i]
  8157. v3 = libc.Int32FromInt32(1)
  8158. }
  8159. if !(v3 != 0) {
  8160. return int32(_XML_ERROR_NO_MEMORY)
  8161. }
  8162. goto _2
  8163. _2:
  8164. ;
  8165. i++
  8166. }
  8167. case int32(m_XML_TOK_DATA_CHARS):
  8168. if !(_poolAppend(tls, pool, enc, ptr, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  8169. return int32(_XML_ERROR_NO_MEMORY)
  8170. }
  8171. case -int32(3):
  8172. *(*uintptr)(unsafe.Pointer(bp)) = ptr + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  8173. /* fall through */
  8174. fallthrough
  8175. case int32(m_XML_TOK_ATTRIBUTE_VALUE_S):
  8176. fallthrough
  8177. case int32(m_XML_TOK_DATA_NEWLINE):
  8178. if !(isCdata != 0) && (int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart) == 0 || int32(*(*TXML_Char)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20)) {
  8179. break
  8180. }
  8181. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  8182. v6 = 0
  8183. } else {
  8184. v8 = pool + 24
  8185. v7 = *(*uintptr)(unsafe.Pointer(v8))
  8186. *(*uintptr)(unsafe.Pointer(v8))++
  8187. *(*TXML_Char)(unsafe.Pointer(v7)) = int8(0x20)
  8188. v6 = libc.Int32FromInt32(1)
  8189. }
  8190. if !(v6 != 0) {
  8191. return int32(_XML_ERROR_NO_MEMORY)
  8192. }
  8193. case int32(m_XML_TOK_ENTITY_REF):
  8194. *(*TXML_Char)(unsafe.Pointer(bp + 12)) = int8((*(*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)))
  8195. if *(*TXML_Char)(unsafe.Pointer(bp + 12)) != 0 {
  8196. /* NOTE: We are replacing 4-6 characters original input for 1 character
  8197. * so there is no amplification and hence recording without
  8198. * protection. */
  8199. _accountingDiffTolerated(tls, parser, tok, bp+12, bp+12+uintptr(1), int32(5965), int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  8200. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  8201. v9 = 0
  8202. } else {
  8203. v11 = pool + 24
  8204. v10 = *(*uintptr)(unsafe.Pointer(v11))
  8205. *(*uintptr)(unsafe.Pointer(v11))++
  8206. *(*TXML_Char)(unsafe.Pointer(v10)) = *(*TXML_Char)(unsafe.Pointer(bp + 12))
  8207. v9 = libc.Int32FromInt32(1)
  8208. }
  8209. if !(v9 != 0) {
  8210. return int32(_XML_ERROR_NO_MEMORY)
  8211. }
  8212. break
  8213. }
  8214. name = _poolStoreString(tls, parser+832, enc, ptr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  8215. if !(name != 0) {
  8216. return int32(_XML_ERROR_NO_MEMORY)
  8217. }
  8218. entity = _lookup(tls, parser, dtd, name, uint64(0))
  8219. (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fstart
  8220. /* First, determine if a check for an existing declaration is needed;
  8221. if yes, check that the entity exists, and that it is internal.
  8222. */
  8223. if pool == dtd+160 { /* are we called from prolog? */
  8224. if v13 = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FdocumentEntity != 0; v13 {
  8225. if (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0 {
  8226. v12 = libc.BoolInt32(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0))
  8227. } else {
  8228. v12 = libc.BoolInt32(!((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0))
  8229. }
  8230. }
  8231. checkEntityDecl = libc.BoolInt8(v13 && v12 != 0)
  8232. } else { /* if (pool == &parser->m_tempPool): we are called from content */
  8233. checkEntityDecl = libc.BoolInt8(!((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0) || (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0)
  8234. }
  8235. if checkEntityDecl != 0 {
  8236. if !(entity != 0) {
  8237. return int32(_XML_ERROR_UNDEFINED_ENTITY)
  8238. } else {
  8239. if !((*TENTITY)(unsafe.Pointer(entity)).Fis_internal != 0) {
  8240. return int32(_XML_ERROR_ENTITY_DECLARED_IN_PE)
  8241. }
  8242. }
  8243. } else {
  8244. if !(entity != 0) {
  8245. /* Cannot report skipped entity here - see comments on
  8246. parser->m_skippedEntityHandler.
  8247. if (parser->m_skippedEntityHandler)
  8248. parser->m_skippedEntityHandler(parser->m_handlerArg, name, 0);
  8249. */
  8250. /* Cannot call the default handler because this would be
  8251. out of sync with the call to the startElementHandler.
  8252. if ((pool == &parser->m_tempPool) && parser->m_defaultHandler)
  8253. reportDefault(parser, enc, ptr, next);
  8254. */
  8255. break
  8256. }
  8257. }
  8258. if (*TENTITY)(unsafe.Pointer(entity)).Fopen != 0 {
  8259. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8260. /* It does not appear that this line can be executed.
  8261. *
  8262. * The "if (entity->open)" check catches recursive entity
  8263. * definitions. In order to be called with an open
  8264. * entity, it must have gone through this code before and
  8265. * been through the recursive call to
  8266. * appendAttributeValue() some lines below. That call
  8267. * sets the local encoding ("enc") to the parser's
  8268. * internal encoding (internal_utf8 or internal_utf16),
  8269. * which can never be the same as the principle encoding.
  8270. * It doesn't appear there is another code path that gets
  8271. * here with entity->open being TRUE.
  8272. *
  8273. * Since it is not certain that this logic is watertight,
  8274. * we keep the line and merely exclude it from coverage
  8275. * tests.
  8276. */
  8277. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr /* LCOV_EXCL_LINE */
  8278. }
  8279. return int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  8280. }
  8281. if (*TENTITY)(unsafe.Pointer(entity)).Fnotation != 0 {
  8282. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8283. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8284. }
  8285. return int32(_XML_ERROR_BINARY_ENTITY_REF)
  8286. }
  8287. if !((*TENTITY)(unsafe.Pointer(entity)).FtextPtr != 0) {
  8288. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8289. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8290. }
  8291. return int32(_XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF)
  8292. } else {
  8293. textEnd = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen)
  8294. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  8295. _entityTrackingOnOpen(tls, parser, entity, int32(6046))
  8296. result = _appendAttributeValue(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding, isCdata, (*TENTITY)(unsafe.Pointer(entity)).FtextPtr, textEnd, pool, int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  8297. _entityTrackingOnClose(tls, parser, entity, int32(6053))
  8298. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8299. if result != 0 {
  8300. return result
  8301. }
  8302. }
  8303. default:
  8304. /* The only token returned by XmlAttributeValueTok() that does
  8305. * not have an explicit case here is XML_TOK_PARTIAL_CHAR.
  8306. * Getting that would require an entity name to contain an
  8307. * incomplete XML character (e.g. \xE2\x82); however previous
  8308. * tokenisers will have already recognised and rejected such
  8309. * names before XmlAttributeValueTok() gets a look-in. This
  8310. * default case should be retained as a safety net, but the code
  8311. * excluded from coverage tests.
  8312. *
  8313. * LCOV_EXCL_START
  8314. */
  8315. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8316. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8317. }
  8318. return int32(_XML_ERROR_UNEXPECTED_STATE)
  8319. /* LCOV_EXCL_STOP */
  8320. }
  8321. ptr = *(*uintptr)(unsafe.Pointer(bp))
  8322. goto _1
  8323. _1:
  8324. }
  8325. /* not reached */
  8326. return r
  8327. }
  8328. func _storeEntityValue(tls *libc.TLS, parser TXML_Parser, enc uintptr, entityTextPtr uintptr, entityTextEnd uintptr, account _XML_Account) (r _XML_Error) {
  8329. bp := tls.Alloc(16)
  8330. defer tls.Free(16)
  8331. var dtd, entity, name, pool, v2, v3, v5, v6 uintptr
  8332. var i, n, oldInEntityValue, tok int32
  8333. var result _XML_Error
  8334. var _ /* buf at bp+8 */ [4]TXML_Char
  8335. var _ /* next at bp+0 */ uintptr
  8336. _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, entity, i, n, name, oldInEntityValue, pool, result, tok, v2, v3, v5, v6
  8337. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  8338. pool = dtd + 208
  8339. result = int32(_XML_ERROR_NONE)
  8340. oldInEntityValue = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue
  8341. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue = int32(1)
  8342. /* never return Null for the value argument in EntityDeclHandler,
  8343. since this would indicate an external entity; therefore we
  8344. have to make sure that entityValuePool.start is not null */
  8345. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks != 0) {
  8346. if !(_poolGrow(tls, pool) != 0) {
  8347. return int32(_XML_ERROR_NO_MEMORY)
  8348. }
  8349. }
  8350. for {
  8351. *(*uintptr)(unsafe.Pointer(bp)) = entityTextPtr /* XmlEntityValueTok doesn't always set the last arg */
  8352. 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)
  8353. if !(_accountingDiffTolerated(tls, parser, tok, entityTextPtr, *(*uintptr)(unsafe.Pointer(bp)), int32(6109), account) != 0) {
  8354. _accountingOnAbort(tls, parser)
  8355. result = int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  8356. goto endEntityValue
  8357. }
  8358. switch tok {
  8359. case int32(m_XML_TOK_PARAM_ENTITY_REF):
  8360. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0 || enc != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8361. name = _poolStoreString(tls, parser+784, enc, entityTextPtr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  8362. if !(name != 0) {
  8363. result = int32(_XML_ERROR_NO_MEMORY)
  8364. goto endEntityValue
  8365. }
  8366. entity = _lookup(tls, parser, dtd+264, name, uint64(0))
  8367. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  8368. if !(entity != 0) {
  8369. /* not a well-formedness error - see XML 1.0: WFC Entity Declared */
  8370. /* cannot report skipped entity here - see comments on
  8371. parser->m_skippedEntityHandler
  8372. if (parser->m_skippedEntityHandler)
  8373. parser->m_skippedEntityHandler(parser->m_handlerArg, name, 0);
  8374. */
  8375. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  8376. goto endEntityValue
  8377. }
  8378. if (*TENTITY)(unsafe.Pointer(entity)).Fopen != 0 {
  8379. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8380. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8381. }
  8382. result = int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  8383. goto endEntityValue
  8384. }
  8385. if (*TENTITY)(unsafe.Pointer(entity)).FsystemId != 0 {
  8386. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  8387. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  8388. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  8389. _entityTrackingOnOpen(tls, parser, entity, int32(6152))
  8390. 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) {
  8391. _entityTrackingOnClose(tls, parser, entity, int32(6156))
  8392. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8393. result = int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  8394. goto endEntityValue
  8395. }
  8396. _entityTrackingOnClose(tls, parser, entity, int32(6161))
  8397. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8398. if !((*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0) {
  8399. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  8400. }
  8401. } else {
  8402. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  8403. }
  8404. } else {
  8405. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  8406. _entityTrackingOnOpen(tls, parser, entity, int32(6169))
  8407. 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))
  8408. _entityTrackingOnClose(tls, parser, entity, int32(6174))
  8409. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8410. if result != 0 {
  8411. goto endEntityValue
  8412. }
  8413. }
  8414. break
  8415. }
  8416. /* In the internal subset, PE references are not legal
  8417. within markup declarations, e.g entity values in this case. */
  8418. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8419. result = int32(_XML_ERROR_PARAM_ENTITY_REF)
  8420. goto endEntityValue
  8421. case -int32(4):
  8422. result = int32(_XML_ERROR_NONE)
  8423. goto endEntityValue
  8424. case int32(m_XML_TOK_ENTITY_REF):
  8425. fallthrough
  8426. case int32(m_XML_TOK_DATA_CHARS):
  8427. if !(_poolAppend(tls, pool, enc, entityTextPtr, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  8428. result = int32(_XML_ERROR_NO_MEMORY)
  8429. goto endEntityValue
  8430. }
  8431. case -int32(3):
  8432. *(*uintptr)(unsafe.Pointer(bp)) = entityTextPtr + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  8433. /* fall through */
  8434. fallthrough
  8435. case int32(m_XML_TOK_DATA_NEWLINE):
  8436. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr && !(_poolGrow(tls, pool) != 0) {
  8437. result = int32(_XML_ERROR_NO_MEMORY)
  8438. goto endEntityValue
  8439. }
  8440. v3 = pool + 24
  8441. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8442. *(*uintptr)(unsafe.Pointer(v3))++
  8443. *(*TXML_Char)(unsafe.Pointer(v2)) = int8(0xA)
  8444. case int32(m_XML_TOK_CHAR_REF):
  8445. n = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FcharRefNumber})))(tls, enc, entityTextPtr)
  8446. if n < 0 {
  8447. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8448. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8449. }
  8450. result = int32(_XML_ERROR_BAD_CHAR_REF)
  8451. goto endEntityValue
  8452. }
  8453. n = XXmlUtf8Encode(tls, n, bp+8)
  8454. /* The XmlEncode() functions can never return 0 here. That
  8455. * error return happens if the code point passed in is either
  8456. * negative or greater than or equal to 0x110000. The
  8457. * XmlCharRefNumber() functions will all return a number
  8458. * strictly less than 0x110000 or a negative value if an error
  8459. * occurred. The negative value is intercepted above, so
  8460. * XmlEncode() is never passed a value it might return an
  8461. * error for.
  8462. */
  8463. i = 0
  8464. for {
  8465. if !(i < n) {
  8466. break
  8467. }
  8468. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr && !(_poolGrow(tls, pool) != 0) {
  8469. result = int32(_XML_ERROR_NO_MEMORY)
  8470. goto endEntityValue
  8471. }
  8472. v6 = pool + 24
  8473. v5 = *(*uintptr)(unsafe.Pointer(v6))
  8474. *(*uintptr)(unsafe.Pointer(v6))++
  8475. *(*TXML_Char)(unsafe.Pointer(v5)) = (*(*[4]TXML_Char)(unsafe.Pointer(bp + 8)))[i]
  8476. goto _4
  8477. _4:
  8478. ;
  8479. i++
  8480. }
  8481. case -int32(1):
  8482. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8483. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8484. }
  8485. result = int32(_XML_ERROR_INVALID_TOKEN)
  8486. goto endEntityValue
  8487. case m_XML_TOK_INVALID:
  8488. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8489. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  8490. }
  8491. result = int32(_XML_ERROR_INVALID_TOKEN)
  8492. goto endEntityValue
  8493. default:
  8494. /* This default case should be unnecessary -- all the tokens
  8495. * that XmlEntityValueTok() can return have their own explicit
  8496. * cases -- but should be retained for safety. We do however
  8497. * exclude it from the coverage statistics.
  8498. *
  8499. * LCOV_EXCL_START
  8500. */
  8501. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8502. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8503. }
  8504. result = int32(_XML_ERROR_UNEXPECTED_STATE)
  8505. goto endEntityValue
  8506. /* LCOV_EXCL_STOP */
  8507. }
  8508. entityTextPtr = *(*uintptr)(unsafe.Pointer(bp))
  8509. goto _1
  8510. _1:
  8511. }
  8512. goto endEntityValue
  8513. endEntityValue:
  8514. ;
  8515. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue = oldInEntityValue
  8516. return result
  8517. }
  8518. func _normalizeLines(tls *libc.TLS, s uintptr) {
  8519. var p, v2, v3, v4, v5 uintptr
  8520. _, _, _, _, _ = p, v2, v3, v4, v5
  8521. for {
  8522. if int32(*(*TXML_Char)(unsafe.Pointer(s))) == int32('\000') {
  8523. return
  8524. }
  8525. if int32(*(*TXML_Char)(unsafe.Pointer(s))) == int32(0xD) {
  8526. break
  8527. }
  8528. goto _1
  8529. _1:
  8530. ;
  8531. s++
  8532. }
  8533. p = s
  8534. for cond := true; cond; cond = *(*TXML_Char)(unsafe.Pointer(s)) != 0 {
  8535. if int32(*(*TXML_Char)(unsafe.Pointer(s))) == int32(0xD) {
  8536. v2 = p
  8537. p++
  8538. *(*TXML_Char)(unsafe.Pointer(v2)) = int8(0xA)
  8539. s++
  8540. v3 = s
  8541. if int32(*(*TXML_Char)(unsafe.Pointer(v3))) == int32(0xA) {
  8542. s++
  8543. }
  8544. } else {
  8545. v4 = p
  8546. p++
  8547. v5 = s
  8548. s++
  8549. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(v5))
  8550. }
  8551. }
  8552. *(*TXML_Char)(unsafe.Pointer(p)) = int8('\000')
  8553. }
  8554. func _reportProcessingInstruction(tls *libc.TLS, parser TXML_Parser, enc uintptr, start uintptr, end uintptr) (r int32) {
  8555. var data, target, tem uintptr
  8556. _, _, _ = data, target, tem
  8557. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler != 0) {
  8558. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  8559. _reportDefault(tls, parser, enc, start, end)
  8560. }
  8561. return int32(1)
  8562. }
  8563. start += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar * int32(2))
  8564. tem = start + uintptr((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameLength})))(tls, enc, start))
  8565. target = _poolStoreString(tls, parser+784, enc, start, tem)
  8566. if !(target != 0) {
  8567. return 0
  8568. }
  8569. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  8570. 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)))
  8571. if !(data != 0) {
  8572. return 0
  8573. }
  8574. _normalizeLines(tls, data)
  8575. (*(*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)
  8576. _poolClear(tls, parser+784)
  8577. return int32(1)
  8578. }
  8579. func _reportComment(tls *libc.TLS, parser TXML_Parser, enc uintptr, start uintptr, end uintptr) (r int32) {
  8580. var data uintptr
  8581. _ = data
  8582. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler != 0) {
  8583. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  8584. _reportDefault(tls, parser, enc, start, end)
  8585. }
  8586. return int32(1)
  8587. }
  8588. data = _poolStoreString(tls, parser+784, enc, start+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(4)), end-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(3)))
  8589. if !(data != 0) {
  8590. return 0
  8591. }
  8592. _normalizeLines(tls, data)
  8593. (*(*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)
  8594. _poolClear(tls, parser+784)
  8595. return int32(1)
  8596. }
  8597. func _reportDefault(tls *libc.TLS, parser TXML_Parser, enc uintptr, _s uintptr, end uintptr) {
  8598. bp := tls.Alloc(16)
  8599. defer tls.Free(16)
  8600. *(*uintptr)(unsafe.Pointer(bp)) = _s
  8601. var convert_res _XML_Convert_Result
  8602. var eventEndPP, eventPP uintptr
  8603. var _ /* dataPtr at bp+8 */ uintptr
  8604. _, _, _ = convert_res, eventEndPP, eventPP
  8605. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  8606. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8607. eventPP = parser + 544
  8608. eventEndPP = parser + 552
  8609. } else {
  8610. /* To get here, two things must be true; the parser must be
  8611. * using a character encoding that is not the same as the
  8612. * encoding passed in, and the encoding passed in must need
  8613. * conversion to the internal format (UTF-8 unless XML_UNICODE
  8614. * is defined). The only occasions on which the encoding passed
  8615. * in is not the same as the parser's encoding are when it is
  8616. * the internal encoding (e.g. a previously defined parameter
  8617. * entity, already converted to internal format). This by
  8618. * definition doesn't need conversion, so the whole branch never
  8619. * gets executed.
  8620. *
  8621. * For safety's sake we don't delete these lines and merely
  8622. * exclude them from coverage statistics.
  8623. *
  8624. * LCOV_EXCL_START
  8625. */
  8626. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  8627. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  8628. /* LCOV_EXCL_STOP */
  8629. }
  8630. for cond := true; cond; cond = convert_res != int32(_XML_CONVERT_COMPLETED) && convert_res != int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  8631. *(*uintptr)(unsafe.Pointer(bp + 8)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  8632. 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)
  8633. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  8634. (*(*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)))
  8635. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  8636. }
  8637. } else {
  8638. (*(*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)))))
  8639. }
  8640. }
  8641. func _defineAttribute(tls *libc.TLS, type1 uintptr, attId uintptr, isCdata TXML_Bool, isId TXML_Bool, value uintptr, parser TXML_Parser) (r int32) {
  8642. var att, temp uintptr
  8643. var count, i int32
  8644. _, _, _, _ = att, count, i, temp
  8645. if value != 0 || isId != 0 {
  8646. i = 0
  8647. for {
  8648. if !(i < (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FnDefaultAtts) {
  8649. break
  8650. }
  8651. if attId == (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts + uintptr(i)*24))).Fid {
  8652. return int32(1)
  8653. }
  8654. goto _1
  8655. _1:
  8656. ;
  8657. i++
  8658. }
  8659. if isId != 0 && !((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FidAtt != 0) && !((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fxmlns != 0) {
  8660. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FidAtt = attId
  8661. }
  8662. }
  8663. if (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FnDefaultAtts == (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts {
  8664. if (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts == 0 {
  8665. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts = int32(8)
  8666. (*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))
  8667. if !((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts != 0) {
  8668. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts = 0
  8669. return 0
  8670. }
  8671. } else {
  8672. /* Detect and prevent integer overflow */
  8673. if (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts > libc.Int32FromInt32(m_INT_MAX)/libc.Int32FromInt32(2) {
  8674. return 0
  8675. }
  8676. count = (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts * int32(2)
  8677. /* Detect and prevent integer overflow.
  8678. * The preprocessor guard addresses the "always false" warning
  8679. * from -Wtype-limits on platforms where
  8680. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  8681. 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))
  8682. if temp == libc.UintptrFromInt32(0) {
  8683. return 0
  8684. }
  8685. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts = count
  8686. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts = temp
  8687. }
  8688. }
  8689. att = (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts + uintptr((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FnDefaultAtts)*24
  8690. (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(att)).Fid = attId
  8691. (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(att)).Fvalue = value
  8692. (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(att)).FisCdata = isCdata
  8693. if !(isCdata != 0) {
  8694. (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).FmaybeTokenized = libc.Uint8FromInt32(1)
  8695. }
  8696. *(*int32)(unsafe.Pointer(type1 + 24)) += int32(1)
  8697. return int32(1)
  8698. }
  8699. func _setElementTypePrefix(tls *libc.TLS, parser TXML_Parser, elementType uintptr) (r int32) {
  8700. var dtd, name, prefix, s, v4, v5, v7, v8 uintptr
  8701. var v3, v6 int32
  8702. _, _, _, _, _, _, _, _, _, _ = dtd, name, prefix, s, v3, v4, v5, v6, v7, v8
  8703. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  8704. name = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fname
  8705. for {
  8706. if !(*(*TXML_Char)(unsafe.Pointer(name)) != 0) {
  8707. break
  8708. }
  8709. if int32(*(*TXML_Char)(unsafe.Pointer(name))) == int32(m_ASCII_COLON) {
  8710. s = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fname
  8711. for {
  8712. if !(s != name) {
  8713. break
  8714. }
  8715. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8716. v3 = 0
  8717. } else {
  8718. v5 = dtd + 160 + 24
  8719. v4 = *(*uintptr)(unsafe.Pointer(v5))
  8720. *(*uintptr)(unsafe.Pointer(v5))++
  8721. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(s))
  8722. v3 = libc.Int32FromInt32(1)
  8723. }
  8724. if !(v3 != 0) {
  8725. return 0
  8726. }
  8727. goto _2
  8728. _2:
  8729. ;
  8730. s++
  8731. }
  8732. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8733. v6 = 0
  8734. } else {
  8735. v8 = dtd + 160 + 24
  8736. v7 = *(*uintptr)(unsafe.Pointer(v8))
  8737. *(*uintptr)(unsafe.Pointer(v8))++
  8738. *(*TXML_Char)(unsafe.Pointer(v7)) = int8('\000')
  8739. v6 = libc.Int32FromInt32(1)
  8740. }
  8741. if !(v6 != 0) {
  8742. return 0
  8743. }
  8744. prefix = _lookup(tls, parser, dtd+120, (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fstart, uint64(16))
  8745. if !(prefix != 0) {
  8746. return 0
  8747. }
  8748. if (*TPREFIX)(unsafe.Pointer(prefix)).Fname == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fstart {
  8749. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  8750. } else {
  8751. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  8752. }
  8753. (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fprefix = prefix
  8754. break
  8755. }
  8756. goto _1
  8757. _1:
  8758. ;
  8759. name++
  8760. }
  8761. return int32(1)
  8762. }
  8763. func _getAttributeId(tls *libc.TLS, parser TXML_Parser, enc uintptr, start uintptr, end uintptr) (r uintptr) {
  8764. var dtd, id, name, v10, v11, v2, v3, v7, v8 uintptr
  8765. var i, j, v1, v6, v9 int32
  8766. _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, i, id, j, name, v1, v10, v11, v2, v3, v6, v7, v8, v9
  8767. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  8768. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8769. v1 = 0
  8770. } else {
  8771. v3 = dtd + 160 + 24
  8772. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8773. *(*uintptr)(unsafe.Pointer(v3))++
  8774. *(*TXML_Char)(unsafe.Pointer(v2)) = int8('\000')
  8775. v1 = libc.Int32FromInt32(1)
  8776. }
  8777. if !(v1 != 0) {
  8778. return libc.UintptrFromInt32(0)
  8779. }
  8780. name = _poolStoreString(tls, dtd+160, enc, start, end)
  8781. if !(name != 0) {
  8782. return libc.UintptrFromInt32(0)
  8783. }
  8784. /* skip quotation mark - its storage will be re-used (like in name[-1]) */
  8785. name++
  8786. id = _lookup(tls, parser, dtd+80, name, uint64(24))
  8787. if !(id != 0) {
  8788. return libc.UintptrFromInt32(0)
  8789. }
  8790. if (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fname != name {
  8791. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  8792. } else {
  8793. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  8794. if !!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0) {
  8795. if int32(*(*TXML_Char)(unsafe.Pointer(name))) == int32(m_ASCII_x) && int32(*(*TXML_Char)(unsafe.Pointer(name + 1))) == int32(m_ASCII_m) && int32(*(*TXML_Char)(unsafe.Pointer(name + 2))) == int32(m_ASCII_l) && int32(*(*TXML_Char)(unsafe.Pointer(name + 3))) == int32(m_ASCII_n) && int32(*(*TXML_Char)(unsafe.Pointer(name + 4))) == int32(m_ASCII_s) && (int32(*(*TXML_Char)(unsafe.Pointer(name + 5))) == int32('\000') || int32(*(*TXML_Char)(unsafe.Pointer(name + 5))) == int32(m_ASCII_COLON)) {
  8796. if int32(*(*TXML_Char)(unsafe.Pointer(name + 5))) == int32('\000') {
  8797. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix = dtd + 304
  8798. } else {
  8799. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix = _lookup(tls, parser, dtd+120, name+uintptr(6), uint64(16))
  8800. }
  8801. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fxmlns = libc.Uint8FromInt32(1)
  8802. } else {
  8803. i = 0
  8804. for {
  8805. if !(*(*TXML_Char)(unsafe.Pointer(name + uintptr(i))) != 0) {
  8806. break
  8807. }
  8808. /* attributes without prefix are *not* in the default namespace */
  8809. if int32(*(*TXML_Char)(unsafe.Pointer(name + uintptr(i)))) == int32(m_ASCII_COLON) {
  8810. j = 0
  8811. for {
  8812. if !(j < i) {
  8813. break
  8814. }
  8815. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8816. v6 = 0
  8817. } else {
  8818. v8 = dtd + 160 + 24
  8819. v7 = *(*uintptr)(unsafe.Pointer(v8))
  8820. *(*uintptr)(unsafe.Pointer(v8))++
  8821. *(*TXML_Char)(unsafe.Pointer(v7)) = *(*TXML_Char)(unsafe.Pointer(name + uintptr(j)))
  8822. v6 = libc.Int32FromInt32(1)
  8823. }
  8824. if !(v6 != 0) {
  8825. return libc.UintptrFromInt32(0)
  8826. }
  8827. goto _5
  8828. _5:
  8829. ;
  8830. j++
  8831. }
  8832. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8833. v9 = 0
  8834. } else {
  8835. v11 = dtd + 160 + 24
  8836. v10 = *(*uintptr)(unsafe.Pointer(v11))
  8837. *(*uintptr)(unsafe.Pointer(v11))++
  8838. *(*TXML_Char)(unsafe.Pointer(v10)) = int8('\000')
  8839. v9 = libc.Int32FromInt32(1)
  8840. }
  8841. if !(v9 != 0) {
  8842. return libc.UintptrFromInt32(0)
  8843. }
  8844. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix = _lookup(tls, parser, dtd+120, (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fstart, uint64(16))
  8845. if !((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix != 0) {
  8846. return libc.UintptrFromInt32(0)
  8847. }
  8848. if (*TPREFIX)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix)).Fname == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fstart {
  8849. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  8850. } else {
  8851. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  8852. }
  8853. break
  8854. }
  8855. goto _4
  8856. _4:
  8857. ;
  8858. i++
  8859. }
  8860. }
  8861. }
  8862. }
  8863. return id
  8864. }
  8865. func _getContext(tls *libc.TLS, parser TXML_Parser) (r uintptr) {
  8866. bp := tls.Alloc(16)
  8867. defer tls.Free(16)
  8868. 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
  8869. var i, i1, len1, len11, v1, v14, v17, v21, v25, v30, v33, v5, v9 int32
  8870. var needSep TXML_Bool
  8871. var v12, v28 bool
  8872. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  8873. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  8874. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  8875. needSep = libc.Uint8FromInt32(0)
  8876. if (*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding != 0 {
  8877. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8878. v1 = 0
  8879. } else {
  8880. v3 = parser + 784 + 24
  8881. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8882. *(*uintptr)(unsafe.Pointer(v3))++
  8883. *(*TXML_Char)(unsafe.Pointer(v2)) = int8(m_ASCII_EQUALS)
  8884. v1 = libc.Int32FromInt32(1)
  8885. }
  8886. if !(v1 != 0) {
  8887. return libc.UintptrFromInt32(0)
  8888. }
  8889. len1 = (*TBINDING)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding)).FuriLen
  8890. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  8891. len1--
  8892. }
  8893. i = 0
  8894. for {
  8895. if !(i < len1) {
  8896. break
  8897. }
  8898. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8899. v5 = 0
  8900. } else {
  8901. v7 = parser + 784 + 24
  8902. v6 = *(*uintptr)(unsafe.Pointer(v7))
  8903. *(*uintptr)(unsafe.Pointer(v7))++
  8904. *(*TXML_Char)(unsafe.Pointer(v6)) = *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding)).Furi + uintptr(i)))
  8905. v5 = libc.Int32FromInt32(1)
  8906. }
  8907. if !(v5 != 0) {
  8908. /* Because of memory caching, I don't believe this line can be
  8909. * executed.
  8910. *
  8911. * This is part of a loop copying the default prefix binding
  8912. * URI into the parser's temporary string pool. Previously,
  8913. * that URI was copied into the same string pool, with a
  8914. * terminating NUL character, as part of setContext(). When
  8915. * the pool was cleared, that leaves a block definitely big
  8916. * enough to hold the URI on the free block list of the pool.
  8917. * The URI copy in getContext() therefore cannot run out of
  8918. * memory.
  8919. *
  8920. * If the pool is used between the setContext() and
  8921. * getContext() calls, the worst it can do is leave a bigger
  8922. * block on the front of the free list. Given that this is
  8923. * all somewhat inobvious and program logic can be changed, we
  8924. * don't delete the line but we do exclude it from the test
  8925. * coverage statistics.
  8926. */
  8927. return libc.UintptrFromInt32(0) /* LCOV_EXCL_LINE */
  8928. }
  8929. goto _4
  8930. _4:
  8931. ;
  8932. i++
  8933. }
  8934. needSep = libc.Uint8FromInt32(1)
  8935. }
  8936. _hashTableIterInit(tls, bp, dtd+120)
  8937. for {
  8938. prefix = _hashTableIterNext(tls, bp)
  8939. if !(prefix != 0) {
  8940. break
  8941. }
  8942. if !((*TPREFIX)(unsafe.Pointer(prefix)).Fbinding != 0) {
  8943. /* This test appears to be (justifiable) paranoia. There does
  8944. * not seem to be a way of injecting a prefix without a binding
  8945. * that doesn't get errored long before this function is called.
  8946. * The test should remain for safety's sake, so we instead
  8947. * exclude the following line from the coverage statistics.
  8948. */
  8949. goto _8 /* LCOV_EXCL_LINE */
  8950. }
  8951. if v12 = needSep != 0; v12 {
  8952. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8953. v9 = 0
  8954. } else {
  8955. v11 = parser + 784 + 24
  8956. v10 = *(*uintptr)(unsafe.Pointer(v11))
  8957. *(*uintptr)(unsafe.Pointer(v11))++
  8958. *(*TXML_Char)(unsafe.Pointer(v10)) = int8(m_ASCII_FF)
  8959. v9 = libc.Int32FromInt32(1)
  8960. }
  8961. }
  8962. if v12 && !(v9 != 0) {
  8963. return libc.UintptrFromInt32(0)
  8964. }
  8965. s = (*TPREFIX)(unsafe.Pointer(prefix)).Fname
  8966. for {
  8967. if !(*(*TXML_Char)(unsafe.Pointer(s)) != 0) {
  8968. break
  8969. }
  8970. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8971. v14 = 0
  8972. } else {
  8973. v16 = parser + 784 + 24
  8974. v15 = *(*uintptr)(unsafe.Pointer(v16))
  8975. *(*uintptr)(unsafe.Pointer(v16))++
  8976. *(*TXML_Char)(unsafe.Pointer(v15)) = *(*TXML_Char)(unsafe.Pointer(s))
  8977. v14 = libc.Int32FromInt32(1)
  8978. }
  8979. if !(v14 != 0) {
  8980. return libc.UintptrFromInt32(0)
  8981. }
  8982. goto _13
  8983. _13:
  8984. ;
  8985. s++
  8986. }
  8987. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8988. v17 = 0
  8989. } else {
  8990. v19 = parser + 784 + 24
  8991. v18 = *(*uintptr)(unsafe.Pointer(v19))
  8992. *(*uintptr)(unsafe.Pointer(v19))++
  8993. *(*TXML_Char)(unsafe.Pointer(v18)) = int8(m_ASCII_EQUALS)
  8994. v17 = libc.Int32FromInt32(1)
  8995. }
  8996. if !(v17 != 0) {
  8997. return libc.UintptrFromInt32(0)
  8998. }
  8999. len11 = (*TBINDING)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fbinding)).FuriLen
  9000. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  9001. len11--
  9002. }
  9003. i1 = 0
  9004. for {
  9005. if !(i1 < len11) {
  9006. break
  9007. }
  9008. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9009. v21 = 0
  9010. } else {
  9011. v23 = parser + 784 + 24
  9012. v22 = *(*uintptr)(unsafe.Pointer(v23))
  9013. *(*uintptr)(unsafe.Pointer(v23))++
  9014. *(*TXML_Char)(unsafe.Pointer(v22)) = *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fbinding)).Furi + uintptr(i1)))
  9015. v21 = libc.Int32FromInt32(1)
  9016. }
  9017. if !(v21 != 0) {
  9018. return libc.UintptrFromInt32(0)
  9019. }
  9020. goto _20
  9021. _20:
  9022. ;
  9023. i1++
  9024. }
  9025. needSep = libc.Uint8FromInt32(1)
  9026. goto _8
  9027. _8:
  9028. }
  9029. _hashTableIterInit(tls, bp, dtd)
  9030. for {
  9031. e = _hashTableIterNext(tls, bp)
  9032. if !(e != 0) {
  9033. break
  9034. }
  9035. if !((*TENTITY)(unsafe.Pointer(e)).Fopen != 0) {
  9036. goto _24
  9037. }
  9038. if v28 = needSep != 0; v28 {
  9039. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9040. v25 = 0
  9041. } else {
  9042. v27 = parser + 784 + 24
  9043. v26 = *(*uintptr)(unsafe.Pointer(v27))
  9044. *(*uintptr)(unsafe.Pointer(v27))++
  9045. *(*TXML_Char)(unsafe.Pointer(v26)) = int8(m_ASCII_FF)
  9046. v25 = libc.Int32FromInt32(1)
  9047. }
  9048. }
  9049. if v28 && !(v25 != 0) {
  9050. return libc.UintptrFromInt32(0)
  9051. }
  9052. s1 = (*TENTITY)(unsafe.Pointer(e)).Fname
  9053. for {
  9054. if !(*(*TXML_Char)(unsafe.Pointer(s1)) != 0) {
  9055. break
  9056. }
  9057. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9058. v30 = 0
  9059. } else {
  9060. v32 = parser + 784 + 24
  9061. v31 = *(*uintptr)(unsafe.Pointer(v32))
  9062. *(*uintptr)(unsafe.Pointer(v32))++
  9063. *(*TXML_Char)(unsafe.Pointer(v31)) = *(*TXML_Char)(unsafe.Pointer(s1))
  9064. v30 = libc.Int32FromInt32(1)
  9065. }
  9066. if !(v30 != 0) {
  9067. return uintptr(0)
  9068. }
  9069. goto _29
  9070. _29:
  9071. ;
  9072. s1++
  9073. }
  9074. needSep = libc.Uint8FromInt32(1)
  9075. goto _24
  9076. _24:
  9077. }
  9078. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9079. v33 = 0
  9080. } else {
  9081. v35 = parser + 784 + 24
  9082. v34 = *(*uintptr)(unsafe.Pointer(v35))
  9083. *(*uintptr)(unsafe.Pointer(v35))++
  9084. *(*TXML_Char)(unsafe.Pointer(v34)) = int8('\000')
  9085. v33 = libc.Int32FromInt32(1)
  9086. }
  9087. if !(v33 != 0) {
  9088. return libc.UintptrFromInt32(0)
  9089. }
  9090. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  9091. }
  9092. func _setContext(tls *libc.TLS, parser TXML_Parser, context uintptr) (r TXML_Bool) {
  9093. var dtd, e, prefix, s, v10, v12, v13, v15, v16, v2, v3, v5, v6, v9 uintptr
  9094. var v1, v11, v14, v4, v8 int32
  9095. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, e, prefix, s, v1, v10, v11, v12, v13, v14, v15, v16, v2, v3, v4, v5, v6, v8, v9
  9096. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  9097. s = context
  9098. for int32(*(*TXML_Char)(unsafe.Pointer(context))) != int32('\000') {
  9099. if int32(*(*TXML_Char)(unsafe.Pointer(s))) == int32(m_ASCII_FF) || int32(*(*TXML_Char)(unsafe.Pointer(s))) == int32('\000') {
  9100. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9101. v1 = 0
  9102. } else {
  9103. v3 = parser + 784 + 24
  9104. v2 = *(*uintptr)(unsafe.Pointer(v3))
  9105. *(*uintptr)(unsafe.Pointer(v3))++
  9106. *(*TXML_Char)(unsafe.Pointer(v2)) = int8('\000')
  9107. v1 = libc.Int32FromInt32(1)
  9108. }
  9109. if !(v1 != 0) {
  9110. return libc.Uint8FromInt32(0)
  9111. }
  9112. e = _lookup(tls, parser, dtd, (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart, uint64(0))
  9113. if e != 0 {
  9114. (*TENTITY)(unsafe.Pointer(e)).Fopen = libc.Uint8FromInt32(1)
  9115. }
  9116. if int32(*(*TXML_Char)(unsafe.Pointer(s))) != int32('\000') {
  9117. s++
  9118. }
  9119. context = s
  9120. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  9121. } else {
  9122. if int32(*(*TXML_Char)(unsafe.Pointer(s))) == int32(m_ASCII_EQUALS) {
  9123. if int64((*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart) == 0 {
  9124. prefix = dtd + 304
  9125. } else {
  9126. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9127. v4 = 0
  9128. } else {
  9129. v6 = parser + 784 + 24
  9130. v5 = *(*uintptr)(unsafe.Pointer(v6))
  9131. *(*uintptr)(unsafe.Pointer(v6))++
  9132. *(*TXML_Char)(unsafe.Pointer(v5)) = int8('\000')
  9133. v4 = libc.Int32FromInt32(1)
  9134. }
  9135. if !(v4 != 0) {
  9136. return libc.Uint8FromInt32(0)
  9137. }
  9138. prefix = _lookup(tls, parser, dtd+120, (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart, uint64(16))
  9139. if !(prefix != 0) {
  9140. return libc.Uint8FromInt32(0)
  9141. }
  9142. if (*TPREFIX)(unsafe.Pointer(prefix)).Fname == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart {
  9143. (*TPREFIX)(unsafe.Pointer(prefix)).Fname = _poolCopyString(tls, dtd+160, (*TPREFIX)(unsafe.Pointer(prefix)).Fname)
  9144. if !((*TPREFIX)(unsafe.Pointer(prefix)).Fname != 0) {
  9145. return libc.Uint8FromInt32(0)
  9146. }
  9147. }
  9148. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  9149. }
  9150. context = s + uintptr(1)
  9151. for {
  9152. if !(int32(*(*TXML_Char)(unsafe.Pointer(context))) != int32(m_ASCII_FF) && int32(*(*TXML_Char)(unsafe.Pointer(context))) != int32('\000')) {
  9153. break
  9154. }
  9155. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9156. v8 = 0
  9157. } else {
  9158. v10 = parser + 784 + 24
  9159. v9 = *(*uintptr)(unsafe.Pointer(v10))
  9160. *(*uintptr)(unsafe.Pointer(v10))++
  9161. *(*TXML_Char)(unsafe.Pointer(v9)) = *(*TXML_Char)(unsafe.Pointer(context))
  9162. v8 = libc.Int32FromInt32(1)
  9163. }
  9164. if !(v8 != 0) {
  9165. return libc.Uint8FromInt32(0)
  9166. }
  9167. goto _7
  9168. _7:
  9169. ;
  9170. context++
  9171. }
  9172. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9173. v11 = 0
  9174. } else {
  9175. v13 = parser + 784 + 24
  9176. v12 = *(*uintptr)(unsafe.Pointer(v13))
  9177. *(*uintptr)(unsafe.Pointer(v13))++
  9178. *(*TXML_Char)(unsafe.Pointer(v12)) = int8('\000')
  9179. v11 = libc.Int32FromInt32(1)
  9180. }
  9181. if !(v11 != 0) {
  9182. return libc.Uint8FromInt32(0)
  9183. }
  9184. if _addBinding(tls, parser, prefix, libc.UintptrFromInt32(0), (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart, parser+704) != int32(_XML_ERROR_NONE) {
  9185. return libc.Uint8FromInt32(0)
  9186. }
  9187. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  9188. if int32(*(*TXML_Char)(unsafe.Pointer(context))) != int32('\000') {
  9189. context++
  9190. }
  9191. s = context
  9192. } else {
  9193. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9194. v14 = 0
  9195. } else {
  9196. v16 = parser + 784 + 24
  9197. v15 = *(*uintptr)(unsafe.Pointer(v16))
  9198. *(*uintptr)(unsafe.Pointer(v16))++
  9199. *(*TXML_Char)(unsafe.Pointer(v15)) = *(*TXML_Char)(unsafe.Pointer(s))
  9200. v14 = libc.Int32FromInt32(1)
  9201. }
  9202. if !(v14 != 0) {
  9203. return libc.Uint8FromInt32(0)
  9204. }
  9205. s++
  9206. }
  9207. }
  9208. }
  9209. return libc.Uint8FromInt32(1)
  9210. }
  9211. func _normalizePublicId(tls *libc.TLS, publicId uintptr) {
  9212. var p, s, v2, v3 uintptr
  9213. _, _, _, _ = p, s, v2, v3
  9214. p = publicId
  9215. s = publicId
  9216. for {
  9217. if !(*(*TXML_Char)(unsafe.Pointer(s)) != 0) {
  9218. break
  9219. }
  9220. switch int32(*(*TXML_Char)(unsafe.Pointer(s))) {
  9221. case int32(0x20):
  9222. fallthrough
  9223. case int32(0xD):
  9224. fallthrough
  9225. case int32(0xA):
  9226. if p != publicId && int32(*(*TXML_Char)(unsafe.Pointer(p + uintptr(-libc.Int32FromInt32(1))))) != int32(0x20) {
  9227. v2 = p
  9228. p++
  9229. *(*TXML_Char)(unsafe.Pointer(v2)) = int8(0x20)
  9230. }
  9231. default:
  9232. v3 = p
  9233. p++
  9234. *(*TXML_Char)(unsafe.Pointer(v3)) = *(*TXML_Char)(unsafe.Pointer(s))
  9235. }
  9236. goto _1
  9237. _1:
  9238. ;
  9239. s++
  9240. }
  9241. if p != publicId && int32(*(*TXML_Char)(unsafe.Pointer(p + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20) {
  9242. p--
  9243. }
  9244. *(*TXML_Char)(unsafe.Pointer(p)) = int8('\000')
  9245. }
  9246. func _dtdCreate(tls *libc.TLS, ms uintptr) (r uintptr) {
  9247. var p uintptr
  9248. _ = p
  9249. p = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Fmalloc_fcn})))(tls, uint64(360))
  9250. if p == libc.UintptrFromInt32(0) {
  9251. return p
  9252. }
  9253. _poolInit(tls, p+160, ms)
  9254. _poolInit(tls, p+208, ms)
  9255. _hashTableInit(tls, p, ms)
  9256. _hashTableInit(tls, p+40, ms)
  9257. _hashTableInit(tls, p+80, ms)
  9258. _hashTableInit(tls, p+120, ms)
  9259. (*TDTD)(unsafe.Pointer(p)).FparamEntityRead = libc.Uint8FromInt32(0)
  9260. _hashTableInit(tls, p+264, ms)
  9261. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fname = libc.UintptrFromInt32(0)
  9262. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fbinding = libc.UintptrFromInt32(0)
  9263. (*TDTD)(unsafe.Pointer(p)).Fin_eldecl = libc.Uint8FromInt32(0)
  9264. (*TDTD)(unsafe.Pointer(p)).FscaffIndex = libc.UintptrFromInt32(0)
  9265. (*TDTD)(unsafe.Pointer(p)).Fscaffold = libc.UintptrFromInt32(0)
  9266. (*TDTD)(unsafe.Pointer(p)).FscaffLevel = 0
  9267. (*TDTD)(unsafe.Pointer(p)).FscaffSize = uint32(0)
  9268. (*TDTD)(unsafe.Pointer(p)).FscaffCount = uint32(0)
  9269. (*TDTD)(unsafe.Pointer(p)).FcontentStringLen = uint32(0)
  9270. (*TDTD)(unsafe.Pointer(p)).FkeepProcessing = libc.Uint8FromInt32(1)
  9271. (*TDTD)(unsafe.Pointer(p)).FhasParamEntityRefs = libc.Uint8FromInt32(0)
  9272. (*TDTD)(unsafe.Pointer(p)).Fstandalone = libc.Uint8FromInt32(0)
  9273. return p
  9274. }
  9275. func _dtdReset(tls *libc.TLS, p uintptr, ms uintptr) {
  9276. bp := tls.Alloc(16)
  9277. defer tls.Free(16)
  9278. var e uintptr
  9279. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  9280. _ = e
  9281. _hashTableIterInit(tls, bp, p+40)
  9282. for {
  9283. e = _hashTableIterNext(tls, bp)
  9284. if !(e != 0) {
  9285. break
  9286. }
  9287. if (*TELEMENT_TYPE)(unsafe.Pointer(e)).FallocDefaultAtts != 0 {
  9288. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TELEMENT_TYPE)(unsafe.Pointer(e)).FdefaultAtts)
  9289. }
  9290. goto _1
  9291. _1:
  9292. }
  9293. _hashTableClear(tls, p)
  9294. (*TDTD)(unsafe.Pointer(p)).FparamEntityRead = libc.Uint8FromInt32(0)
  9295. _hashTableClear(tls, p+264)
  9296. _hashTableClear(tls, p+40)
  9297. _hashTableClear(tls, p+80)
  9298. _hashTableClear(tls, p+120)
  9299. _poolClear(tls, p+160)
  9300. _poolClear(tls, p+208)
  9301. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fname = libc.UintptrFromInt32(0)
  9302. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fbinding = libc.UintptrFromInt32(0)
  9303. (*TDTD)(unsafe.Pointer(p)).Fin_eldecl = libc.Uint8FromInt32(0)
  9304. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).FscaffIndex)
  9305. (*TDTD)(unsafe.Pointer(p)).FscaffIndex = libc.UintptrFromInt32(0)
  9306. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).Fscaffold)
  9307. (*TDTD)(unsafe.Pointer(p)).Fscaffold = libc.UintptrFromInt32(0)
  9308. (*TDTD)(unsafe.Pointer(p)).FscaffLevel = 0
  9309. (*TDTD)(unsafe.Pointer(p)).FscaffSize = uint32(0)
  9310. (*TDTD)(unsafe.Pointer(p)).FscaffCount = uint32(0)
  9311. (*TDTD)(unsafe.Pointer(p)).FcontentStringLen = uint32(0)
  9312. (*TDTD)(unsafe.Pointer(p)).FkeepProcessing = libc.Uint8FromInt32(1)
  9313. (*TDTD)(unsafe.Pointer(p)).FhasParamEntityRefs = libc.Uint8FromInt32(0)
  9314. (*TDTD)(unsafe.Pointer(p)).Fstandalone = libc.Uint8FromInt32(0)
  9315. }
  9316. func _dtdDestroy(tls *libc.TLS, p uintptr, isDocEntity TXML_Bool, ms uintptr) {
  9317. bp := tls.Alloc(16)
  9318. defer tls.Free(16)
  9319. var e uintptr
  9320. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  9321. _ = e
  9322. _hashTableIterInit(tls, bp, p+40)
  9323. for {
  9324. e = _hashTableIterNext(tls, bp)
  9325. if !(e != 0) {
  9326. break
  9327. }
  9328. if (*TELEMENT_TYPE)(unsafe.Pointer(e)).FallocDefaultAtts != 0 {
  9329. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TELEMENT_TYPE)(unsafe.Pointer(e)).FdefaultAtts)
  9330. }
  9331. goto _1
  9332. _1:
  9333. }
  9334. _hashTableDestroy(tls, p)
  9335. _hashTableDestroy(tls, p+264)
  9336. _hashTableDestroy(tls, p+40)
  9337. _hashTableDestroy(tls, p+80)
  9338. _hashTableDestroy(tls, p+120)
  9339. _poolDestroy(tls, p+160)
  9340. _poolDestroy(tls, p+208)
  9341. if isDocEntity != 0 {
  9342. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).FscaffIndex)
  9343. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).Fscaffold)
  9344. }
  9345. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, p)
  9346. }
  9347. // C documentation
  9348. //
  9349. // /* Do a deep copy of the DTD. Return 0 for out of memory, non-zero otherwise.
  9350. // The new DTD has already been initialized.
  9351. // */
  9352. func _dtdCopy(tls *libc.TLS, oldParser TXML_Parser, newDtd uintptr, oldDtd uintptr, ms uintptr) (r int32) {
  9353. bp := tls.Alloc(16)
  9354. defer tls.Free(16)
  9355. var i, v3, v7 int32
  9356. var name, name1, name2, newA, newE, oldA, oldE, oldP, v4, v5 uintptr
  9357. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  9358. _, _, _, _, _, _, _, _, _, _, _, _, _ = i, name, name1, name2, newA, newE, oldA, oldE, oldP, v3, v4, v5, v7
  9359. /* Copy the prefix table. */
  9360. _hashTableIterInit(tls, bp, oldDtd+120)
  9361. for {
  9362. oldP = _hashTableIterNext(tls, bp)
  9363. if !(oldP != 0) {
  9364. break
  9365. }
  9366. name = _poolCopyString(tls, newDtd+160, (*TPREFIX)(unsafe.Pointer(oldP)).Fname)
  9367. if !(name != 0) {
  9368. return 0
  9369. }
  9370. if !(_lookup(tls, oldParser, newDtd+120, name, uint64(16)) != 0) {
  9371. return 0
  9372. }
  9373. goto _1
  9374. _1:
  9375. }
  9376. _hashTableIterInit(tls, bp, oldDtd+80)
  9377. /* Copy the attribute id table. */
  9378. for {
  9379. oldA = _hashTableIterNext(tls, bp)
  9380. if !(oldA != 0) {
  9381. break
  9382. }
  9383. /* Remember to allocate the scratch byte before the name. */
  9384. if (*TSTRING_POOL)(unsafe.Pointer(newDtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(newDtd+160)).Fend && !(_poolGrow(tls, newDtd+160) != 0) {
  9385. v3 = 0
  9386. } else {
  9387. v5 = newDtd + 160 + 24
  9388. v4 = *(*uintptr)(unsafe.Pointer(v5))
  9389. *(*uintptr)(unsafe.Pointer(v5))++
  9390. *(*TXML_Char)(unsafe.Pointer(v4)) = int8('\000')
  9391. v3 = libc.Int32FromInt32(1)
  9392. }
  9393. if !(v3 != 0) {
  9394. return 0
  9395. }
  9396. name1 = _poolCopyString(tls, newDtd+160, (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fname)
  9397. if !(name1 != 0) {
  9398. return 0
  9399. }
  9400. name1++
  9401. newA = _lookup(tls, oldParser, newDtd+80, name1, uint64(24))
  9402. if !(newA != 0) {
  9403. return 0
  9404. }
  9405. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).FmaybeTokenized = (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).FmaybeTokenized
  9406. if (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fprefix != 0 {
  9407. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).Fxmlns = (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fxmlns
  9408. if (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fprefix == oldDtd+304 {
  9409. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).Fprefix = newDtd + 304
  9410. } else {
  9411. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).Fprefix = _lookup(tls, oldParser, newDtd+120, (*TPREFIX)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fprefix)).Fname, uint64(0))
  9412. }
  9413. }
  9414. goto _2
  9415. _2:
  9416. }
  9417. /* Copy the element type table. */
  9418. _hashTableIterInit(tls, bp, oldDtd+40)
  9419. for {
  9420. oldE = _hashTableIterNext(tls, bp)
  9421. if !(oldE != 0) {
  9422. break
  9423. }
  9424. name2 = _poolCopyString(tls, newDtd+160, (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).Fname)
  9425. if !(name2 != 0) {
  9426. return 0
  9427. }
  9428. newE = _lookup(tls, oldParser, newDtd+40, name2, uint64(40))
  9429. if !(newE != 0) {
  9430. return 0
  9431. }
  9432. if (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FnDefaultAtts != 0 {
  9433. (*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))
  9434. if !((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts != 0) {
  9435. return 0
  9436. }
  9437. }
  9438. if (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FidAtt != 0 {
  9439. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FidAtt = _lookup(tls, oldParser, newDtd+80, (*TATTRIBUTE_ID)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FidAtt)).Fname, uint64(0))
  9440. }
  9441. v7 = (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FnDefaultAtts
  9442. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FnDefaultAtts = v7
  9443. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FallocDefaultAtts = v7
  9444. if (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).Fprefix != 0 {
  9445. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).Fprefix = _lookup(tls, oldParser, newDtd+120, (*TPREFIX)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).Fprefix)).Fname, uint64(0))
  9446. }
  9447. i = 0
  9448. for {
  9449. if !(i < (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FnDefaultAtts) {
  9450. break
  9451. }
  9452. (*(*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))
  9453. (*(*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
  9454. if (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FdefaultAtts + uintptr(i)*24))).Fvalue != 0 {
  9455. (*(*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)
  9456. if !((*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*24))).Fvalue != 0) {
  9457. return 0
  9458. }
  9459. } else {
  9460. (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*24))).Fvalue = libc.UintptrFromInt32(0)
  9461. }
  9462. goto _8
  9463. _8:
  9464. ;
  9465. i++
  9466. }
  9467. goto _6
  9468. _6:
  9469. }
  9470. /* Copy the entity tables. */
  9471. if !(_copyEntityTable(tls, oldParser, newDtd, newDtd+160, oldDtd) != 0) {
  9472. return 0
  9473. }
  9474. if !(_copyEntityTable(tls, oldParser, newDtd+264, newDtd+160, oldDtd+264) != 0) {
  9475. return 0
  9476. }
  9477. (*TDTD)(unsafe.Pointer(newDtd)).FparamEntityRead = (*TDTD)(unsafe.Pointer(oldDtd)).FparamEntityRead
  9478. (*TDTD)(unsafe.Pointer(newDtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(oldDtd)).FkeepProcessing
  9479. (*TDTD)(unsafe.Pointer(newDtd)).FhasParamEntityRefs = (*TDTD)(unsafe.Pointer(oldDtd)).FhasParamEntityRefs
  9480. (*TDTD)(unsafe.Pointer(newDtd)).Fstandalone = (*TDTD)(unsafe.Pointer(oldDtd)).Fstandalone
  9481. /* Don't want deep copying for scaffolding */
  9482. (*TDTD)(unsafe.Pointer(newDtd)).Fin_eldecl = (*TDTD)(unsafe.Pointer(oldDtd)).Fin_eldecl
  9483. (*TDTD)(unsafe.Pointer(newDtd)).Fscaffold = (*TDTD)(unsafe.Pointer(oldDtd)).Fscaffold
  9484. (*TDTD)(unsafe.Pointer(newDtd)).FcontentStringLen = (*TDTD)(unsafe.Pointer(oldDtd)).FcontentStringLen
  9485. (*TDTD)(unsafe.Pointer(newDtd)).FscaffSize = (*TDTD)(unsafe.Pointer(oldDtd)).FscaffSize
  9486. (*TDTD)(unsafe.Pointer(newDtd)).FscaffLevel = (*TDTD)(unsafe.Pointer(oldDtd)).FscaffLevel
  9487. (*TDTD)(unsafe.Pointer(newDtd)).FscaffIndex = (*TDTD)(unsafe.Pointer(oldDtd)).FscaffIndex
  9488. return int32(1)
  9489. }
  9490. /* End dtdCopy */
  9491. func _copyEntityTable(tls *libc.TLS, oldParser TXML_Parser, newTable uintptr, newPool uintptr, oldTable uintptr) (r int32) {
  9492. bp := tls.Alloc(16)
  9493. defer tls.Free(16)
  9494. var cachedNewBase, cachedOldBase, name, newE, oldE, tem, tem1, tem2, v2 uintptr
  9495. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  9496. _, _, _, _, _, _, _, _, _ = cachedNewBase, cachedOldBase, name, newE, oldE, tem, tem1, tem2, v2
  9497. cachedOldBase = libc.UintptrFromInt32(0)
  9498. cachedNewBase = libc.UintptrFromInt32(0)
  9499. _hashTableIterInit(tls, bp, oldTable)
  9500. for {
  9501. oldE = _hashTableIterNext(tls, bp)
  9502. if !(oldE != 0) {
  9503. break
  9504. }
  9505. name = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).Fname)
  9506. if !(name != 0) {
  9507. return 0
  9508. }
  9509. newE = _lookup(tls, oldParser, newTable, name, uint64(64))
  9510. if !(newE != 0) {
  9511. return 0
  9512. }
  9513. if (*TENTITY)(unsafe.Pointer(oldE)).FsystemId != 0 {
  9514. tem = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).FsystemId)
  9515. if !(tem != 0) {
  9516. return 0
  9517. }
  9518. (*TENTITY)(unsafe.Pointer(newE)).FsystemId = tem
  9519. if (*TENTITY)(unsafe.Pointer(oldE)).Fbase != 0 {
  9520. if (*TENTITY)(unsafe.Pointer(oldE)).Fbase == cachedOldBase {
  9521. (*TENTITY)(unsafe.Pointer(newE)).Fbase = cachedNewBase
  9522. } else {
  9523. cachedOldBase = (*TENTITY)(unsafe.Pointer(oldE)).Fbase
  9524. tem = _poolCopyString(tls, newPool, cachedOldBase)
  9525. if !(tem != 0) {
  9526. return 0
  9527. }
  9528. v2 = tem
  9529. (*TENTITY)(unsafe.Pointer(newE)).Fbase = v2
  9530. cachedNewBase = v2
  9531. }
  9532. }
  9533. if (*TENTITY)(unsafe.Pointer(oldE)).FpublicId != 0 {
  9534. tem = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).FpublicId)
  9535. if !(tem != 0) {
  9536. return 0
  9537. }
  9538. (*TENTITY)(unsafe.Pointer(newE)).FpublicId = tem
  9539. }
  9540. } else {
  9541. tem1 = _poolCopyStringN(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).FtextPtr, (*TENTITY)(unsafe.Pointer(oldE)).FtextLen)
  9542. if !(tem1 != 0) {
  9543. return 0
  9544. }
  9545. (*TENTITY)(unsafe.Pointer(newE)).FtextPtr = tem1
  9546. (*TENTITY)(unsafe.Pointer(newE)).FtextLen = (*TENTITY)(unsafe.Pointer(oldE)).FtextLen
  9547. }
  9548. if (*TENTITY)(unsafe.Pointer(oldE)).Fnotation != 0 {
  9549. tem2 = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).Fnotation)
  9550. if !(tem2 != 0) {
  9551. return 0
  9552. }
  9553. (*TENTITY)(unsafe.Pointer(newE)).Fnotation = tem2
  9554. }
  9555. (*TENTITY)(unsafe.Pointer(newE)).Fis_param = (*TENTITY)(unsafe.Pointer(oldE)).Fis_param
  9556. (*TENTITY)(unsafe.Pointer(newE)).Fis_internal = (*TENTITY)(unsafe.Pointer(oldE)).Fis_internal
  9557. goto _1
  9558. _1:
  9559. }
  9560. return int32(1)
  9561. }
  9562. func _keyeq(tls *libc.TLS, s1 TKEY, s2 TKEY) (r TXML_Bool) {
  9563. for {
  9564. if !(int32(*(*TXML_Char)(unsafe.Pointer(s1))) == int32(*(*TXML_Char)(unsafe.Pointer(s2)))) {
  9565. break
  9566. }
  9567. if int32(*(*TXML_Char)(unsafe.Pointer(s1))) == 0 {
  9568. return libc.Uint8FromInt32(1)
  9569. }
  9570. goto _1
  9571. _1:
  9572. ;
  9573. s1++
  9574. s2++
  9575. }
  9576. return libc.Uint8FromInt32(0)
  9577. }
  9578. func _keylen(tls *libc.TLS, s TKEY) (r Tsize_t) {
  9579. var len1 Tsize_t
  9580. _ = len1
  9581. len1 = uint64(0)
  9582. for {
  9583. if !(*(*TXML_Char)(unsafe.Pointer(s)) != 0) {
  9584. break
  9585. }
  9586. goto _1
  9587. _1:
  9588. ;
  9589. s++
  9590. len1++
  9591. }
  9592. return len1
  9593. }
  9594. func _copy_salt_to_sipkey(tls *libc.TLS, parser TXML_Parser, key uintptr) {
  9595. *(*Tuint64_t)(unsafe.Pointer(key)) = uint64(0)
  9596. *(*Tuint64_t)(unsafe.Pointer(key + 1*8)) = _get_hash_secret_salt(tls, parser)
  9597. }
  9598. func _hash(tls *libc.TLS, parser TXML_Parser, s TKEY) (r uint64) {
  9599. bp := tls.Alloc(80)
  9600. defer tls.Free(80)
  9601. var _ /* key at bp+56 */ Tsipkey
  9602. var _ /* state at bp+0 */ Tsiphash
  9603. _ = __ccgo_fp(_sip24_valid)
  9604. _copy_salt_to_sipkey(tls, parser, bp+56)
  9605. _sip24_init(tls, bp, bp+56)
  9606. _sip24_update(tls, bp, s, _keylen(tls, s)*uint64(1))
  9607. return _sip24_final(tls, bp)
  9608. }
  9609. func _lookup(tls *libc.TLS, parser TXML_Parser, table uintptr, name TKEY, createSize Tsize_t) (r uintptr) {
  9610. var h, mask, newHash, newMask uint64
  9611. var i, j, newSize, tsize, tsize1 Tsize_t
  9612. var newPower, step uint8
  9613. var newV uintptr
  9614. _, _, _, _, _, _, _, _, _, _, _, _ = h, i, j, mask, newHash, newMask, newPower, newSize, newV, step, tsize, tsize1
  9615. if (*THASH_TABLE)(unsafe.Pointer(table)).Fsize == uint64(0) {
  9616. if !(createSize != 0) {
  9617. return libc.UintptrFromInt32(0)
  9618. }
  9619. (*THASH_TABLE)(unsafe.Pointer(table)).Fpower = uint8(m_INIT_POWER)
  9620. /* table->size is a power of 2 */
  9621. (*THASH_TABLE)(unsafe.Pointer(table)).Fsize = libc.Uint64FromInt32(1) << libc.Int32FromInt32(m_INIT_POWER)
  9622. tsize = (*THASH_TABLE)(unsafe.Pointer(table)).Fsize * uint64(8)
  9623. (*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)
  9624. if !((*THASH_TABLE)(unsafe.Pointer(table)).Fv != 0) {
  9625. (*THASH_TABLE)(unsafe.Pointer(table)).Fsize = uint64(0)
  9626. return libc.UintptrFromInt32(0)
  9627. }
  9628. libc.Xmemset(tls, (*THASH_TABLE)(unsafe.Pointer(table)).Fv, 0, tsize)
  9629. i = _hash(tls, parser, name) & ((*THASH_TABLE)(unsafe.Pointer(table)).Fsize - uint64(1))
  9630. } else {
  9631. h = _hash(tls, parser, name)
  9632. mask = (*THASH_TABLE)(unsafe.Pointer(table)).Fsize - uint64(1)
  9633. step = uint8(0)
  9634. i = h & mask
  9635. for *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0 {
  9636. if _keyeq(tls, name, (*TNAMED)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))).Fname) != 0 {
  9637. return *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8))
  9638. }
  9639. if !(step != 0) {
  9640. step = uint8(h & ^mask >> (libc.Int32FromUint8((*THASH_TABLE)(unsafe.Pointer(table)).Fpower)-libc.Int32FromInt32(1)) & (mask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  9641. }
  9642. if i < uint64(step) {
  9643. i += (*THASH_TABLE)(unsafe.Pointer(table)).Fsize - uint64(step)
  9644. } else {
  9645. i -= uint64(step)
  9646. }
  9647. }
  9648. if !(createSize != 0) {
  9649. return libc.UintptrFromInt32(0)
  9650. }
  9651. /* check for overflow (table is half full) */
  9652. if (*THASH_TABLE)(unsafe.Pointer(table)).Fused>>(libc.Int32FromUint8((*THASH_TABLE)(unsafe.Pointer(table)).Fpower)-int32(1)) != 0 {
  9653. newPower = libc.Uint8FromInt32(libc.Int32FromUint8((*THASH_TABLE)(unsafe.Pointer(table)).Fpower) + int32(1))
  9654. /* Detect and prevent invalid shift */
  9655. if uint64(newPower) >= libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8) {
  9656. return libc.UintptrFromInt32(0)
  9657. }
  9658. newSize = libc.Uint64FromInt32(1) << newPower
  9659. newMask = newSize - uint64(1)
  9660. /* Detect and prevent integer overflow */
  9661. if newSize > libc.Uint64FromInt32(-libc.Int32FromInt32(1))/libc.Uint64FromInt64(8) {
  9662. return libc.UintptrFromInt32(0)
  9663. }
  9664. tsize1 = newSize * uint64(8)
  9665. 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)
  9666. if !(newV != 0) {
  9667. return libc.UintptrFromInt32(0)
  9668. }
  9669. libc.Xmemset(tls, newV, 0, tsize1)
  9670. i = uint64(0)
  9671. for {
  9672. if !(i < (*THASH_TABLE)(unsafe.Pointer(table)).Fsize) {
  9673. break
  9674. }
  9675. if *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0 {
  9676. newHash = _hash(tls, parser, (*TNAMED)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))).Fname)
  9677. j = newHash & newMask
  9678. step = uint8(0)
  9679. for *(*uintptr)(unsafe.Pointer(newV + uintptr(j)*8)) != 0 {
  9680. if !(step != 0) {
  9681. step = uint8(newHash & ^newMask >> (libc.Int32FromUint8(newPower)-libc.Int32FromInt32(1)) & (newMask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  9682. }
  9683. if j < uint64(step) {
  9684. j += newSize - uint64(step)
  9685. } else {
  9686. j -= uint64(step)
  9687. }
  9688. }
  9689. *(*uintptr)(unsafe.Pointer(newV + uintptr(j)*8)) = *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8))
  9690. }
  9691. goto _2
  9692. _2:
  9693. ;
  9694. i++
  9695. }
  9696. (*(*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)
  9697. (*THASH_TABLE)(unsafe.Pointer(table)).Fv = newV
  9698. (*THASH_TABLE)(unsafe.Pointer(table)).Fpower = newPower
  9699. (*THASH_TABLE)(unsafe.Pointer(table)).Fsize = newSize
  9700. i = h & newMask
  9701. step = uint8(0)
  9702. for *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0 {
  9703. if !(step != 0) {
  9704. step = uint8(h & ^newMask >> (libc.Int32FromUint8(newPower)-libc.Int32FromInt32(1)) & (newMask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  9705. }
  9706. if i < uint64(step) {
  9707. i += newSize - uint64(step)
  9708. } else {
  9709. i -= uint64(step)
  9710. }
  9711. }
  9712. }
  9713. }
  9714. *(*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)
  9715. if !(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0) {
  9716. return libc.UintptrFromInt32(0)
  9717. }
  9718. libc.Xmemset(tls, *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)), 0, createSize)
  9719. (*TNAMED)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))).Fname = name
  9720. (*THASH_TABLE)(unsafe.Pointer(table)).Fused++
  9721. return *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8))
  9722. }
  9723. func _hashTableClear(tls *libc.TLS, table uintptr) {
  9724. var i Tsize_t
  9725. _ = i
  9726. i = uint64(0)
  9727. for {
  9728. if !(i < (*THASH_TABLE)(unsafe.Pointer(table)).Fsize) {
  9729. break
  9730. }
  9731. (*(*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)))
  9732. *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) = libc.UintptrFromInt32(0)
  9733. goto _1
  9734. _1:
  9735. ;
  9736. i++
  9737. }
  9738. (*THASH_TABLE)(unsafe.Pointer(table)).Fused = uint64(0)
  9739. }
  9740. func _hashTableDestroy(tls *libc.TLS, table uintptr) {
  9741. var i Tsize_t
  9742. _ = i
  9743. i = uint64(0)
  9744. for {
  9745. if !(i < (*THASH_TABLE)(unsafe.Pointer(table)).Fsize) {
  9746. break
  9747. }
  9748. (*(*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)))
  9749. goto _1
  9750. _1:
  9751. ;
  9752. i++
  9753. }
  9754. (*(*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)
  9755. }
  9756. func _hashTableInit(tls *libc.TLS, p uintptr, ms uintptr) {
  9757. (*THASH_TABLE)(unsafe.Pointer(p)).Fpower = uint8(0)
  9758. (*THASH_TABLE)(unsafe.Pointer(p)).Fsize = uint64(0)
  9759. (*THASH_TABLE)(unsafe.Pointer(p)).Fused = uint64(0)
  9760. (*THASH_TABLE)(unsafe.Pointer(p)).Fv = libc.UintptrFromInt32(0)
  9761. (*THASH_TABLE)(unsafe.Pointer(p)).Fmem = ms
  9762. }
  9763. func _hashTableIterInit(tls *libc.TLS, iter uintptr, table uintptr) {
  9764. var v1 uintptr
  9765. _ = v1
  9766. (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp = (*THASH_TABLE)(unsafe.Pointer(table)).Fv
  9767. if (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp != 0 {
  9768. v1 = (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp + uintptr((*THASH_TABLE)(unsafe.Pointer(table)).Fsize)*8
  9769. } else {
  9770. v1 = libc.UintptrFromInt32(0)
  9771. }
  9772. (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fend = v1
  9773. }
  9774. func _hashTableIterNext(tls *libc.TLS, iter uintptr) (r uintptr) {
  9775. var tem, v1, v2 uintptr
  9776. _, _, _ = tem, v1, v2
  9777. for (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp != (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fend {
  9778. v2 = iter
  9779. v1 = *(*uintptr)(unsafe.Pointer(v2))
  9780. *(*uintptr)(unsafe.Pointer(v2)) += 8
  9781. tem = *(*uintptr)(unsafe.Pointer(v1))
  9782. if tem != 0 {
  9783. return tem
  9784. }
  9785. }
  9786. return libc.UintptrFromInt32(0)
  9787. }
  9788. func _poolInit(tls *libc.TLS, pool uintptr, ms uintptr) {
  9789. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = libc.UintptrFromInt32(0)
  9790. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = libc.UintptrFromInt32(0)
  9791. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = libc.UintptrFromInt32(0)
  9792. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = libc.UintptrFromInt32(0)
  9793. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = libc.UintptrFromInt32(0)
  9794. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem = ms
  9795. }
  9796. func _poolClear(tls *libc.TLS, pool uintptr) {
  9797. var p, tem uintptr
  9798. _, _ = p, tem
  9799. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks != 0) {
  9800. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  9801. } else {
  9802. p = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  9803. for p != 0 {
  9804. tem = (*TBLOCK)(unsafe.Pointer(p)).Fnext
  9805. (*TBLOCK)(unsafe.Pointer(p)).Fnext = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  9806. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = p
  9807. p = tem
  9808. }
  9809. }
  9810. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = libc.UintptrFromInt32(0)
  9811. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = libc.UintptrFromInt32(0)
  9812. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = libc.UintptrFromInt32(0)
  9813. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = libc.UintptrFromInt32(0)
  9814. }
  9815. func _poolDestroy(tls *libc.TLS, pool uintptr) {
  9816. var p, tem, tem1 uintptr
  9817. _, _, _ = p, tem, tem1
  9818. p = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  9819. for p != 0 {
  9820. tem = (*TBLOCK)(unsafe.Pointer(p)).Fnext
  9821. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem)).Ffree_fcn})))(tls, p)
  9822. p = tem
  9823. }
  9824. p = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  9825. for p != 0 {
  9826. tem1 = (*TBLOCK)(unsafe.Pointer(p)).Fnext
  9827. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem)).Ffree_fcn})))(tls, p)
  9828. p = tem1
  9829. }
  9830. }
  9831. func _poolAppend(tls *libc.TLS, pool uintptr, enc uintptr, _ptr uintptr, end uintptr) (r uintptr) {
  9832. bp := tls.Alloc(16)
  9833. defer tls.Free(16)
  9834. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  9835. var convert_res _XML_Convert_Result
  9836. _ = convert_res
  9837. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr != 0) && !(_poolGrow(tls, pool) != 0) {
  9838. return libc.UintptrFromInt32(0)
  9839. }
  9840. for {
  9841. 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)
  9842. if convert_res == int32(_XML_CONVERT_COMPLETED) || convert_res == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  9843. break
  9844. }
  9845. if !(_poolGrow(tls, pool) != 0) {
  9846. return libc.UintptrFromInt32(0)
  9847. }
  9848. goto _1
  9849. _1:
  9850. }
  9851. return (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9852. }
  9853. func _poolCopyString(tls *libc.TLS, pool uintptr, s uintptr) (r uintptr) {
  9854. var v1, v4, v5 uintptr
  9855. var v3 int32
  9856. _, _, _, _ = v1, v3, v4, v5
  9857. for {
  9858. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  9859. v3 = 0
  9860. } else {
  9861. v5 = pool + 24
  9862. v4 = *(*uintptr)(unsafe.Pointer(v5))
  9863. *(*uintptr)(unsafe.Pointer(v5))++
  9864. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(s))
  9865. v3 = libc.Int32FromInt32(1)
  9866. }
  9867. if !(v3 != 0) {
  9868. return libc.UintptrFromInt32(0)
  9869. }
  9870. goto _2
  9871. _2:
  9872. ;
  9873. v1 = s
  9874. s++
  9875. if !(*(*TXML_Char)(unsafe.Pointer(v1)) != 0) {
  9876. break
  9877. }
  9878. }
  9879. s = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9880. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr
  9881. return s
  9882. }
  9883. func _poolCopyStringN(tls *libc.TLS, pool uintptr, s uintptr, n int32) (r uintptr) {
  9884. var v2 int32
  9885. var v3, v4 uintptr
  9886. _, _, _ = v2, v3, v4
  9887. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr != 0) && !(_poolGrow(tls, pool) != 0) {
  9888. /* The following line is unreachable given the current usage of
  9889. * poolCopyStringN(). Currently it is called from exactly one
  9890. * place to copy the text of a simple general entity. By that
  9891. * point, the name of the entity is already stored in the pool, so
  9892. * pool->ptr cannot be NULL.
  9893. *
  9894. * If poolCopyStringN() is used elsewhere as it well might be,
  9895. * this line may well become executable again. Regardless, this
  9896. * sort of check shouldn't be removed lightly, so we just exclude
  9897. * it from the coverage statistics.
  9898. */
  9899. return libc.UintptrFromInt32(0) /* LCOV_EXCL_LINE */
  9900. }
  9901. for {
  9902. if !(n > 0) {
  9903. break
  9904. }
  9905. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  9906. v2 = 0
  9907. } else {
  9908. v4 = pool + 24
  9909. v3 = *(*uintptr)(unsafe.Pointer(v4))
  9910. *(*uintptr)(unsafe.Pointer(v4))++
  9911. *(*TXML_Char)(unsafe.Pointer(v3)) = *(*TXML_Char)(unsafe.Pointer(s))
  9912. v2 = libc.Int32FromInt32(1)
  9913. }
  9914. if !(v2 != 0) {
  9915. return libc.UintptrFromInt32(0)
  9916. }
  9917. goto _1
  9918. _1:
  9919. ;
  9920. n--
  9921. s++
  9922. }
  9923. s = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9924. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr
  9925. return s
  9926. }
  9927. func _poolAppendString(tls *libc.TLS, pool uintptr, s uintptr) (r uintptr) {
  9928. var v1 int32
  9929. var v2, v3 uintptr
  9930. _, _, _ = v1, v2, v3
  9931. for *(*TXML_Char)(unsafe.Pointer(s)) != 0 {
  9932. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  9933. v1 = 0
  9934. } else {
  9935. v3 = pool + 24
  9936. v2 = *(*uintptr)(unsafe.Pointer(v3))
  9937. *(*uintptr)(unsafe.Pointer(v3))++
  9938. *(*TXML_Char)(unsafe.Pointer(v2)) = *(*TXML_Char)(unsafe.Pointer(s))
  9939. v1 = libc.Int32FromInt32(1)
  9940. }
  9941. if !(v1 != 0) {
  9942. return libc.UintptrFromInt32(0)
  9943. }
  9944. s++
  9945. }
  9946. return (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9947. }
  9948. func _poolStoreString(tls *libc.TLS, pool uintptr, enc uintptr, ptr uintptr, end uintptr) (r uintptr) {
  9949. var v1, v2 uintptr
  9950. _, _ = v1, v2
  9951. if !(_poolAppend(tls, pool, enc, ptr, end) != 0) {
  9952. return libc.UintptrFromInt32(0)
  9953. }
  9954. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  9955. return libc.UintptrFromInt32(0)
  9956. }
  9957. v2 = pool + 24
  9958. v1 = *(*uintptr)(unsafe.Pointer(v2))
  9959. *(*uintptr)(unsafe.Pointer(v2))++
  9960. *(*TXML_Char)(unsafe.Pointer(v1)) = 0
  9961. return (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9962. }
  9963. func _poolBytesToAllocateFor(tls *libc.TLS, blockSize int32) (r Tsize_t) {
  9964. var bytesToAllocate, stretchedBlockSize int32
  9965. var stretch Tsize_t
  9966. _, _, _ = bytesToAllocate, stretch, stretchedBlockSize
  9967. /* Unprotected math would be:
  9968. ** return offsetof(BLOCK, s) + blockSize * sizeof(XML_Char);
  9969. **
  9970. ** Detect overflow, avoiding _signed_ overflow undefined behavior
  9971. ** For a + b * c we check b * c in isolation first, so that addition of a
  9972. ** on top has no chance of making us accept a small non-negative number
  9973. */
  9974. stretch = uint64(1) /* can be 4 bytes */
  9975. if blockSize <= 0 {
  9976. return uint64(0)
  9977. }
  9978. if blockSize > libc.Int32FromUint64(libc.Uint64FromInt32(m_INT_MAX)/stretch) {
  9979. return uint64(0)
  9980. }
  9981. stretchedBlockSize = blockSize * libc.Int32FromUint64(stretch)
  9982. bytesToAllocate = libc.Int32FromUint64(uint64(libc.UintptrFromInt32(0)+12) + uint64(libc.Uint32FromInt32(stretchedBlockSize)))
  9983. if bytesToAllocate < 0 {
  9984. return uint64(0)
  9985. }
  9986. return libc.Uint64FromInt32(bytesToAllocate)
  9987. return r
  9988. }
  9989. func _poolGrow(tls *libc.TLS, pool uintptr) (r TXML_Bool) {
  9990. var blockSize, blockSize1 int32
  9991. var bytesToAllocate, bytesToAllocate1 Tsize_t
  9992. var offsetInsideBlock Tptrdiff_t
  9993. var tem, tem1, temp uintptr
  9994. _, _, _, _, _, _, _, _ = blockSize, blockSize1, bytesToAllocate, bytesToAllocate1, offsetInsideBlock, tem, tem1, temp
  9995. if (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks != 0 {
  9996. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart == uintptr(0) {
  9997. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  9998. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fnext
  9999. (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fnext = libc.UintptrFromInt32(0)
  10000. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12
  10001. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart + uintptr((*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fsize)
  10002. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  10003. return libc.Uint8FromInt32(1)
  10004. }
  10005. 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) {
  10006. tem = (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fnext
  10007. (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fnext = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  10008. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  10009. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = tem
  10010. 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))
  10011. (*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))
  10012. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12
  10013. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart + uintptr((*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fsize)
  10014. return libc.Uint8FromInt32(1)
  10015. }
  10016. }
  10017. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks != 0 && (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks+12 {
  10018. blockSize = libc.Int32FromUint32(libc.Uint32FromInt64(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart)) * libc.Uint32FromUint32(2))
  10019. /* NOTE: Needs to be calculated prior to calling `realloc`
  10020. to avoid dangling pointers: */
  10021. offsetInsideBlock = int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr) - int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart)
  10022. if blockSize < 0 {
  10023. /* This condition traps a situation where either more than
  10024. * INT_MAX/2 bytes have already been allocated. This isn't
  10025. * readily testable, since it is unlikely that an average
  10026. * machine will have that much memory, so we exclude it from the
  10027. * coverage statistics.
  10028. */
  10029. return libc.Uint8FromInt32(0) /* LCOV_EXCL_LINE */
  10030. }
  10031. bytesToAllocate = _poolBytesToAllocateFor(tls, blockSize)
  10032. if bytesToAllocate == uint64(0) {
  10033. return libc.Uint8FromInt32(0)
  10034. }
  10035. 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)))
  10036. if temp == libc.UintptrFromInt32(0) {
  10037. return libc.Uint8FromInt32(0)
  10038. }
  10039. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = temp
  10040. (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fsize = blockSize
  10041. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12 + uintptr(offsetInsideBlock)
  10042. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12
  10043. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart + uintptr(blockSize)
  10044. } else {
  10045. blockSize1 = int32(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend) - int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))
  10046. if blockSize1 < 0 {
  10047. /* This condition traps a situation where either more than
  10048. * INT_MAX bytes have already been allocated (which is prevented
  10049. * by various pieces of program logic, not least this one, never
  10050. * mind the unlikelihood of actually having that much memory) or
  10051. * the pool control fields have been corrupted (which could
  10052. * conceivably happen in an extremely buggy user handler
  10053. * function). Either way it isn't readily testable, so we
  10054. * exclude it from the coverage statistics.
  10055. */
  10056. return libc.Uint8FromInt32(0) /* LCOV_EXCL_LINE */
  10057. }
  10058. if blockSize1 < int32(m_INIT_BLOCK_SIZE) {
  10059. blockSize1 = int32(m_INIT_BLOCK_SIZE)
  10060. } else {
  10061. /* Detect overflow, avoiding _signed_ overflow undefined behavior */
  10062. if libc.Int32FromUint32(libc.Uint32FromInt32(blockSize1)*libc.Uint32FromUint32(2)) < 0 {
  10063. return libc.Uint8FromInt32(0)
  10064. }
  10065. blockSize1 *= int32(2)
  10066. }
  10067. bytesToAllocate1 = _poolBytesToAllocateFor(tls, blockSize1)
  10068. if bytesToAllocate1 == uint64(0) {
  10069. return libc.Uint8FromInt32(0)
  10070. }
  10071. 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)
  10072. if !(tem1 != 0) {
  10073. return libc.Uint8FromInt32(0)
  10074. }
  10075. (*TBLOCK)(unsafe.Pointer(tem1)).Fsize = blockSize1
  10076. (*TBLOCK)(unsafe.Pointer(tem1)).Fnext = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  10077. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = tem1
  10078. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr != (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart {
  10079. 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))
  10080. }
  10081. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = tem1 + 12 + uintptr(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))
  10082. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = tem1 + 12
  10083. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = tem1 + 12 + uintptr(blockSize1)
  10084. }
  10085. return libc.Uint8FromInt32(1)
  10086. }
  10087. func _nextScaffoldPart(tls *libc.TLS, parser TXML_Parser) (r int32) {
  10088. var dtd, me, parent, temp, v2 uintptr
  10089. var next, v3, v4, v5 int32
  10090. var v1 uint32
  10091. _, _, _, _, _, _, _, _, _, _ = dtd, me, next, parent, temp, v1, v2, v3, v4, v5
  10092. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  10093. if !((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex != 0) {
  10094. (*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))
  10095. if !((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex != 0) {
  10096. return -int32(1)
  10097. }
  10098. *(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex)) = 0
  10099. }
  10100. if (*TDTD)(unsafe.Pointer(dtd)).FscaffCount >= (*TDTD)(unsafe.Pointer(dtd)).FscaffSize {
  10101. if (*TDTD)(unsafe.Pointer(dtd)).Fscaffold != 0 {
  10102. /* Detect and prevent integer overflow */
  10103. if (*TDTD)(unsafe.Pointer(dtd)).FscaffSize > libc.Uint32FromUint32(0xffffffff)/libc.Uint32FromUint32(2) {
  10104. return -int32(1)
  10105. }
  10106. /* Detect and prevent integer overflow.
  10107. * The preprocessor guard addresses the "always false" warning
  10108. * from -Wtype-limits on platforms where
  10109. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  10110. 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))
  10111. if temp == libc.UintptrFromInt32(0) {
  10112. return -int32(1)
  10113. }
  10114. *(*uint32)(unsafe.Pointer(dtd + 340)) *= uint32(2)
  10115. } else {
  10116. 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))
  10117. if temp == libc.UintptrFromInt32(0) {
  10118. return -int32(1)
  10119. }
  10120. (*TDTD)(unsafe.Pointer(dtd)).FscaffSize = uint32(m_INIT_SCAFFOLD_ELEMENTS)
  10121. }
  10122. (*TDTD)(unsafe.Pointer(dtd)).Fscaffold = temp
  10123. }
  10124. v2 = dtd + 344
  10125. v1 = *(*uint32)(unsafe.Pointer(v2))
  10126. *(*uint32)(unsafe.Pointer(v2))++
  10127. next = libc.Int32FromUint32(v1)
  10128. me = (*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(next)*32
  10129. if (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel != 0 {
  10130. 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
  10131. if (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Flastchild != 0 {
  10132. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr((*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Flastchild)*32))).Fnextsib = next
  10133. }
  10134. if !((*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Fchildcnt != 0) {
  10135. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Ffirstchild = next
  10136. }
  10137. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Flastchild = next
  10138. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Fchildcnt++
  10139. }
  10140. v5 = libc.Int32FromInt32(0)
  10141. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Fnextsib = v5
  10142. v4 = v5
  10143. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Fchildcnt = v4
  10144. v3 = v4
  10145. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Flastchild = v3
  10146. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Ffirstchild = v3
  10147. return next
  10148. }
  10149. func _build_model(tls *libc.TLS, parser TXML_Parser) (r uintptr) {
  10150. var allocsize Tsize_t
  10151. var cn, src_node int32
  10152. var dest, destLimit, dtd, jobDest, ret, src, str, v1, v4, v6 uintptr
  10153. var i uint32
  10154. _, _, _, _, _, _, _, _, _, _, _, _, _, _ = allocsize, cn, dest, destLimit, dtd, i, jobDest, ret, src, src_node, str, v1, v4, v6
  10155. /* Function build_model transforms the existing parser->m_dtd->scaffold
  10156. * array of CONTENT_SCAFFOLD tree nodes into a new array of
  10157. * XML_Content tree nodes followed by a gapless list of zero-terminated
  10158. * strings. */
  10159. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* the current string writing location */
  10160. /* Detect and prevent integer overflow.
  10161. * The preprocessor guard addresses the "always false" warning
  10162. * from -Wtype-limits on platforms where
  10163. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  10164. if uint64((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*uint64(32) > libc.Uint64FromInt32(-libc.Int32FromInt32(1))-uint64((*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen)*uint64(1) {
  10165. return libc.UintptrFromInt32(0)
  10166. }
  10167. allocsize = uint64((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*libc.Uint64FromInt64(32) + uint64((*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen)*libc.Uint64FromInt64(1)
  10168. ret = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, allocsize)
  10169. if !(ret != 0) {
  10170. return libc.UintptrFromInt32(0)
  10171. }
  10172. /* What follows is an iterative implementation (of what was previously done
  10173. * recursively in a dedicated function called "build_node". The old recursive
  10174. * build_node could be forced into stack exhaustion from input as small as a
  10175. * few megabyte, and so that was a security issue. Hence, a function call
  10176. * stack is avoided now by resolving recursion.)
  10177. *
  10178. * The iterative approach works as follows:
  10179. *
  10180. * - We have two writing pointers, both walking up the result array; one does
  10181. * the work, the other creates "jobs" for its colleague to do, and leads
  10182. * the way:
  10183. *
  10184. * - The faster one, pointer jobDest, always leads and writes "what job
  10185. * to do" by the other, once they reach that place in the
  10186. * array: leader "jobDest" stores the source node array index (relative
  10187. * to array dtd->scaffold) in field "numchildren".
  10188. *
  10189. * - The slower one, pointer dest, looks at the value stored in the
  10190. * "numchildren" field (which actually holds a source node array index
  10191. * at that time) and puts the real data from dtd->scaffold in.
  10192. *
  10193. * - Before the loop starts, jobDest writes source array index 0
  10194. * (where the root node is located) so that dest will have something to do
  10195. * when it starts operation.
  10196. *
  10197. * - Whenever nodes with children are encountered, jobDest appends
  10198. * them as new jobs, in order. As a result, tree node siblings are
  10199. * adjacent in the resulting array, for example:
  10200. *
  10201. * [0] root, has two children
  10202. * [1] first child of 0, has three children
  10203. * [3] first child of 1, does not have children
  10204. * [4] second child of 1, does not have children
  10205. * [5] third child of 1, does not have children
  10206. * [2] second child of 0, does not have children
  10207. *
  10208. * Or (the same data) presented in flat array view:
  10209. *
  10210. * [0] root, has two children
  10211. *
  10212. * [1] first child of 0, has three children
  10213. * [2] second child of 0, does not have children
  10214. *
  10215. * [3] first child of 1, does not have children
  10216. * [4] second child of 1, does not have children
  10217. * [5] third child of 1, does not have children
  10218. *
  10219. * - The algorithm repeats until all target array indices have been processed.
  10220. */
  10221. dest = ret /* tree node writing location, moves upwards */
  10222. destLimit = ret + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*32
  10223. jobDest = ret /* next free writing location in target array */
  10224. str = ret + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*32
  10225. /* Add the starting job, the root node (index 0) of the source tree */
  10226. v1 = jobDest
  10227. jobDest += 32
  10228. (*TXML_Content)(unsafe.Pointer(v1)).Fnumchildren = uint32(0)
  10229. for {
  10230. if !(dest < destLimit) {
  10231. break
  10232. }
  10233. /* Retrieve source tree array index from job storage */
  10234. src_node = libc.Int32FromUint32((*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren)
  10235. /* Convert item */
  10236. (*TXML_Content)(unsafe.Pointer(dest)).Ftype1 = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Ftype1
  10237. (*TXML_Content)(unsafe.Pointer(dest)).Fquant = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Fquant
  10238. if (*TXML_Content)(unsafe.Pointer(dest)).Ftype1 == int32(_XML_CTYPE_NAME) {
  10239. (*TXML_Content)(unsafe.Pointer(dest)).Fname = str
  10240. src = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Fname
  10241. for {
  10242. v4 = str
  10243. str++
  10244. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(src))
  10245. if !(*(*TXML_Char)(unsafe.Pointer(src)) != 0) {
  10246. break
  10247. }
  10248. src++
  10249. goto _3
  10250. _3:
  10251. }
  10252. (*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren = uint32(0)
  10253. (*TXML_Content)(unsafe.Pointer(dest)).Fchildren = libc.UintptrFromInt32(0)
  10254. } else {
  10255. (*TXML_Content)(unsafe.Pointer(dest)).Fname = libc.UintptrFromInt32(0)
  10256. (*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren = libc.Uint32FromInt32((*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Fchildcnt)
  10257. (*TXML_Content)(unsafe.Pointer(dest)).Fchildren = jobDest
  10258. /* Append scaffold indices of children to array */
  10259. i = uint32(0)
  10260. cn = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Ffirstchild
  10261. for {
  10262. if !(i < (*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren) {
  10263. break
  10264. }
  10265. v6 = jobDest
  10266. jobDest += 32
  10267. (*TXML_Content)(unsafe.Pointer(v6)).Fnumchildren = libc.Uint32FromInt32(cn)
  10268. goto _5
  10269. _5:
  10270. ;
  10271. i++
  10272. cn = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(cn)*32))).Fnextsib
  10273. }
  10274. }
  10275. goto _2
  10276. _2:
  10277. ;
  10278. dest += 32
  10279. }
  10280. return ret
  10281. }
  10282. func _getElementType(tls *libc.TLS, parser TXML_Parser, enc uintptr, ptr uintptr, end uintptr) (r uintptr) {
  10283. var dtd, name, ret uintptr
  10284. _, _, _ = dtd, name, ret
  10285. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  10286. name = _poolStoreString(tls, dtd+160, enc, ptr, end)
  10287. if !(name != 0) {
  10288. return libc.UintptrFromInt32(0)
  10289. }
  10290. ret = _lookup(tls, parser, dtd+40, name, uint64(40))
  10291. if !(ret != 0) {
  10292. return libc.UintptrFromInt32(0)
  10293. }
  10294. if (*TELEMENT_TYPE)(unsafe.Pointer(ret)).Fname != name {
  10295. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  10296. } else {
  10297. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  10298. if !(_setElementTypePrefix(tls, parser, ret) != 0) {
  10299. return libc.UintptrFromInt32(0)
  10300. }
  10301. }
  10302. return ret
  10303. }
  10304. func _copyString(tls *libc.TLS, s uintptr, memsuite uintptr) (r uintptr) {
  10305. var charsRequired Tsize_t
  10306. var result uintptr
  10307. _, _ = charsRequired, result
  10308. charsRequired = uint64(0)
  10309. /* First determine how long the string is */
  10310. for int32(*(*TXML_Char)(unsafe.Pointer(s + uintptr(charsRequired)))) != 0 {
  10311. charsRequired++
  10312. }
  10313. /* Include the terminator */
  10314. charsRequired++
  10315. /* Now allocate space for the copy */
  10316. result = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Fmalloc_fcn})))(tls, charsRequired*uint64(1))
  10317. if result == libc.UintptrFromInt32(0) {
  10318. return libc.UintptrFromInt32(0)
  10319. }
  10320. /* Copy the original into place */
  10321. libc.Xmemcpy(tls, result, s, charsRequired*uint64(1))
  10322. return result
  10323. }
  10324. func _accountingGetCurrentAmplification(tls *libc.TLS, rootParser TXML_Parser) (r float32) {
  10325. var amplificationFactor, v1 float32
  10326. var countBytesOutput TXmlBigCount
  10327. _, _, _ = amplificationFactor, countBytesOutput, v1
  10328. countBytesOutput = (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect + (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesIndirect
  10329. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect != 0 {
  10330. v1 = float32(countBytesOutput) / float32((*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect)
  10331. } else {
  10332. v1 = libc.Float32FromFloat32(1)
  10333. }
  10334. amplificationFactor = v1
  10335. return amplificationFactor
  10336. }
  10337. func _accountingReportStats(tls *libc.TLS, originParser TXML_Parser, epilog uintptr) {
  10338. bp := tls.Alloc(48)
  10339. defer tls.Free(48)
  10340. var amplificationFactor float32
  10341. var rootParser TXML_Parser
  10342. _, _ = amplificationFactor, rootParser
  10343. rootParser = _getRootParserOf(tls, originParser, libc.UintptrFromInt32(0))
  10344. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FdebugLevel < int32(1) {
  10345. return
  10346. }
  10347. amplificationFactor = _accountingGetCurrentAmplification(tls, rootParser)
  10348. 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))
  10349. }
  10350. func _accountingOnAbort(tls *libc.TLS, originParser TXML_Parser) {
  10351. _accountingReportStats(tls, originParser, __ccgo_ts+1748)
  10352. }
  10353. func _accountingReportDiff(tls *libc.TLS, rootParser TXML_Parser, levelsAwayFromRootParser uint32, before uintptr, after uintptr, bytesMore Tptrdiff_t, source_line int32, account _XML_Account) {
  10354. bp := tls.Alloc(64)
  10355. defer tls.Free(64)
  10356. var contextLength uint32
  10357. var ellipsisLength Tsize_t
  10358. var walker, v1 uintptr
  10359. var _ /* ellipis at bp+0 */ [5]int8
  10360. _, _, _, _ = contextLength, ellipsisLength, walker, v1
  10361. if account == int32(_XML_ACCOUNT_DIRECT) {
  10362. v1 = __ccgo_ts + 1759
  10363. } else {
  10364. v1 = __ccgo_ts + 1763
  10365. }
  10366. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1767, libc.VaList(bp+16, bytesMore, v1, levelsAwayFromRootParser, source_line, int32(10), __ccgo_ts+1808))
  10367. *(*[5]int8)(unsafe.Pointer(bp)) = [5]int8{'[', '.', '.', ']'}
  10368. ellipsisLength = libc.Uint64FromInt64(5) - libc.Uint64FromInt32(1)
  10369. contextLength = uint32(10)
  10370. /* Note: Performance is of no concern here */
  10371. walker = before
  10372. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FdebugLevel >= int32(3) || int64(after)-int64(before) <= libc.Int64FromUint64(uint64(contextLength)+ellipsisLength+uint64(contextLength)) {
  10373. for {
  10374. if !(walker < after) {
  10375. break
  10376. }
  10377. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1809, libc.VaList(bp+16, XunsignedCharToPrintable(tls, libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(walker))))))
  10378. goto _2
  10379. _2:
  10380. ;
  10381. walker++
  10382. }
  10383. } else {
  10384. for {
  10385. if !(walker < before+uintptr(contextLength)) {
  10386. break
  10387. }
  10388. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1809, libc.VaList(bp+16, XunsignedCharToPrintable(tls, libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(walker))))))
  10389. goto _3
  10390. _3:
  10391. ;
  10392. walker++
  10393. }
  10394. libc.Xfprintf(tls, libc.Xstderr, bp, 0)
  10395. walker = after - uintptr(contextLength)
  10396. for {
  10397. if !(walker < after) {
  10398. break
  10399. }
  10400. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1809, libc.VaList(bp+16, XunsignedCharToPrintable(tls, libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(walker))))))
  10401. goto _4
  10402. _4:
  10403. ;
  10404. walker++
  10405. }
  10406. }
  10407. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1812, 0)
  10408. }
  10409. func _accountingDiffTolerated(tls *libc.TLS, originParser TXML_Parser, tok int32, before uintptr, after uintptr, source_line int32, account _XML_Account) (r TXML_Bool) {
  10410. bp := tls.Alloc(16)
  10411. defer tls.Free(16)
  10412. var additionTarget, v1 uintptr
  10413. var amplificationFactor float32
  10414. var bytesMore Tptrdiff_t
  10415. var countBytesOutput TXmlBigCount
  10416. var isDirect int32
  10417. var rootParser TXML_Parser
  10418. var tolerated TXML_Bool
  10419. var _ /* levelsAwayFromRootParser at bp+0 */ uint32
  10420. _, _, _, _, _, _, _, _ = additionTarget, amplificationFactor, bytesMore, countBytesOutput, isDirect, rootParser, tolerated, v1
  10421. /* Note: We need to check the token type *first* to be sure that
  10422. * we can even access variable <after>, safely.
  10423. * E.g. for XML_TOK_NONE <after> may hold an invalid pointer. */
  10424. switch tok {
  10425. case m_XML_TOK_INVALID:
  10426. fallthrough
  10427. case -int32(1):
  10428. fallthrough
  10429. case -int32(2):
  10430. fallthrough
  10431. case -int32(4):
  10432. return libc.Uint8FromInt32(1)
  10433. }
  10434. if account == int32(_XML_ACCOUNT_NONE) {
  10435. return libc.Uint8FromInt32(1)
  10436. }
  10437. rootParser = _getRootParserOf(tls, originParser, bp)
  10438. isDirect = libc.BoolInt32(account == int32(_XML_ACCOUNT_DIRECT) && originParser == rootParser)
  10439. bytesMore = int64(after) - int64(before)
  10440. if isDirect != 0 {
  10441. v1 = rootParser + 928
  10442. } else {
  10443. v1 = rootParser + 928 + 8
  10444. }
  10445. additionTarget = v1
  10446. /* Detect and avoid integer overflow */
  10447. if *(*TXmlBigCount)(unsafe.Pointer(additionTarget)) > libc.Uint64FromInt32(-libc.Int32FromInt32(1))-libc.Uint64FromInt64(bytesMore) {
  10448. return libc.Uint8FromInt32(0)
  10449. }
  10450. *(*TXmlBigCount)(unsafe.Pointer(additionTarget)) += libc.Uint64FromInt64(bytesMore)
  10451. countBytesOutput = (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect + (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesIndirect
  10452. amplificationFactor = _accountingGetCurrentAmplification(tls, rootParser)
  10453. tolerated = libc.BoolUint8(countBytesOutput < (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FactivationThresholdBytes || amplificationFactor <= (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FmaximumAmplificationFactor)
  10454. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FdebugLevel >= int32(2) {
  10455. _accountingReportStats(tls, rootParser, __ccgo_ts+1808)
  10456. _accountingReportDiff(tls, rootParser, *(*uint32)(unsafe.Pointer(bp)), before, after, bytesMore, source_line, account)
  10457. }
  10458. return tolerated
  10459. }
  10460. func XtestingAccountingGetCountBytesDirect(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  10461. if !(parser != 0) {
  10462. return uint64(0)
  10463. }
  10464. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FcountBytesDirect
  10465. }
  10466. func XtestingAccountingGetCountBytesIndirect(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  10467. if !(parser != 0) {
  10468. return uint64(0)
  10469. }
  10470. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FcountBytesIndirect
  10471. }
  10472. func _entityTrackingReportStats(tls *libc.TLS, rootParser TXML_Parser, entity uintptr, action uintptr, sourceLine int32) {
  10473. bp := tls.Alloc(96)
  10474. defer tls.Free(96)
  10475. var entityName, v1 uintptr
  10476. _, _ = entityName, v1
  10477. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FdebugLevel < int32(1) {
  10478. return
  10479. }
  10480. entityName = (*TENTITY)(unsafe.Pointer(entity)).Fname
  10481. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  10482. v1 = __ccgo_ts + 1815
  10483. } else {
  10484. v1 = __ccgo_ts + 1817
  10485. }
  10486. 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))
  10487. }
  10488. func _entityTrackingOnOpen(tls *libc.TLS, originParser TXML_Parser, entity uintptr, sourceLine int32) {
  10489. var rootParser TXML_Parser
  10490. _ = rootParser
  10491. rootParser = _getRootParserOf(tls, originParser, libc.UintptrFromInt32(0))
  10492. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcountEverOpened++
  10493. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcurrentDepth++
  10494. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcurrentDepth > (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FmaximumDepthSeen {
  10495. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FmaximumDepthSeen++
  10496. }
  10497. _entityTrackingReportStats(tls, rootParser, entity, __ccgo_ts+1904, sourceLine)
  10498. }
  10499. func _entityTrackingOnClose(tls *libc.TLS, originParser TXML_Parser, entity uintptr, sourceLine int32) {
  10500. var rootParser TXML_Parser
  10501. _ = rootParser
  10502. rootParser = _getRootParserOf(tls, originParser, libc.UintptrFromInt32(0))
  10503. _entityTrackingReportStats(tls, rootParser, entity, __ccgo_ts+1910, sourceLine)
  10504. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcurrentDepth--
  10505. }
  10506. func _getRootParserOf(tls *libc.TLS, parser TXML_Parser, outLevelDiff uintptr) (r TXML_Parser) {
  10507. var rootParser TXML_Parser
  10508. var stepsTakenUpwards uint32
  10509. _, _ = rootParser, stepsTakenUpwards
  10510. rootParser = parser
  10511. stepsTakenUpwards = uint32(0)
  10512. for (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_parentParser != 0 {
  10513. rootParser = (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_parentParser
  10514. stepsTakenUpwards++
  10515. }
  10516. if outLevelDiff != libc.UintptrFromInt32(0) {
  10517. *(*uint32)(unsafe.Pointer(outLevelDiff)) = stepsTakenUpwards
  10518. }
  10519. return rootParser
  10520. }
  10521. func XunsignedCharToPrintable(tls *libc.TLS, c uint8) (r uintptr) {
  10522. switch libc.Int32FromUint8(c) {
  10523. case 0:
  10524. return __ccgo_ts + 1916
  10525. case int32(1):
  10526. return __ccgo_ts + 1919
  10527. case int32(2):
  10528. return __ccgo_ts + 1923
  10529. case int32(3):
  10530. return __ccgo_ts + 1927
  10531. case int32(4):
  10532. return __ccgo_ts + 1931
  10533. case int32(5):
  10534. return __ccgo_ts + 1935
  10535. case int32(6):
  10536. return __ccgo_ts + 1939
  10537. case int32(7):
  10538. return __ccgo_ts + 1943
  10539. case int32(8):
  10540. return __ccgo_ts + 1947
  10541. case int32(9):
  10542. return __ccgo_ts + 1951
  10543. case int32(10):
  10544. return __ccgo_ts + 1954
  10545. case int32(11):
  10546. return __ccgo_ts + 1957
  10547. case int32(12):
  10548. return __ccgo_ts + 1961
  10549. case int32(13):
  10550. return __ccgo_ts + 1965
  10551. case int32(14):
  10552. return __ccgo_ts + 1968
  10553. case int32(15):
  10554. return __ccgo_ts + 1972
  10555. case int32(16):
  10556. return __ccgo_ts + 1976
  10557. case int32(17):
  10558. return __ccgo_ts + 1981
  10559. case int32(18):
  10560. return __ccgo_ts + 1986
  10561. case int32(19):
  10562. return __ccgo_ts + 1991
  10563. case int32(20):
  10564. return __ccgo_ts + 1996
  10565. case int32(21):
  10566. return __ccgo_ts + 2001
  10567. case int32(22):
  10568. return __ccgo_ts + 2006
  10569. case int32(23):
  10570. return __ccgo_ts + 2011
  10571. case int32(24):
  10572. return __ccgo_ts + 2016
  10573. case int32(25):
  10574. return __ccgo_ts + 2021
  10575. case int32(26):
  10576. return __ccgo_ts + 2026
  10577. case int32(27):
  10578. return __ccgo_ts + 2031
  10579. case int32(28):
  10580. return __ccgo_ts + 2036
  10581. case int32(29):
  10582. return __ccgo_ts + 2041
  10583. case int32(30):
  10584. return __ccgo_ts + 2046
  10585. case int32(31):
  10586. return __ccgo_ts + 2051
  10587. case int32(32):
  10588. return __ccgo_ts + 2056
  10589. case int32(33):
  10590. return __ccgo_ts + 2058
  10591. case int32(34):
  10592. return __ccgo_ts + 2060
  10593. case int32(35):
  10594. return __ccgo_ts + 2063
  10595. case int32(36):
  10596. return __ccgo_ts + 2065
  10597. case int32(37):
  10598. return __ccgo_ts + 1815
  10599. case int32(38):
  10600. return __ccgo_ts + 1817
  10601. case int32(39):
  10602. return __ccgo_ts + 2067
  10603. case int32(40):
  10604. return __ccgo_ts + 2069
  10605. case int32(41):
  10606. return __ccgo_ts + 2071
  10607. case int32(42):
  10608. return __ccgo_ts + 2073
  10609. case int32(43):
  10610. return __ccgo_ts + 2075
  10611. case int32(44):
  10612. return __ccgo_ts + 2077
  10613. case int32(45):
  10614. return __ccgo_ts + 2079
  10615. case int32(46):
  10616. return __ccgo_ts + 2081
  10617. case int32(47):
  10618. return __ccgo_ts + 2083
  10619. case int32(48):
  10620. return __ccgo_ts + 2085
  10621. case int32(49):
  10622. return __ccgo_ts + 2087
  10623. case int32(50):
  10624. return __ccgo_ts + 2089
  10625. case int32(51):
  10626. return __ccgo_ts + 2091
  10627. case int32(52):
  10628. return __ccgo_ts + 2093
  10629. case int32(53):
  10630. return __ccgo_ts + 2095
  10631. case int32(54):
  10632. return __ccgo_ts + 2097
  10633. case int32(55):
  10634. return __ccgo_ts + 2099
  10635. case int32(56):
  10636. return __ccgo_ts + 2101
  10637. case int32(57):
  10638. return __ccgo_ts + 2103
  10639. case int32(58):
  10640. return __ccgo_ts + 2105
  10641. case int32(59):
  10642. return __ccgo_ts + 2107
  10643. case int32(60):
  10644. return __ccgo_ts + 2109
  10645. case int32(61):
  10646. return __ccgo_ts + 2111
  10647. case int32(62):
  10648. return __ccgo_ts + 2113
  10649. case int32(63):
  10650. return __ccgo_ts + 2115
  10651. case int32(64):
  10652. return __ccgo_ts + 2117
  10653. case int32(65):
  10654. return __ccgo_ts + 2119
  10655. case int32(66):
  10656. return __ccgo_ts + 2121
  10657. case int32(67):
  10658. return __ccgo_ts + 2123
  10659. case int32(68):
  10660. return __ccgo_ts + 2125
  10661. case int32(69):
  10662. return __ccgo_ts + 2127
  10663. case int32(70):
  10664. return __ccgo_ts + 2129
  10665. case int32(71):
  10666. return __ccgo_ts + 2131
  10667. case int32(72):
  10668. return __ccgo_ts + 2133
  10669. case int32(73):
  10670. return __ccgo_ts + 2135
  10671. case int32(74):
  10672. return __ccgo_ts + 2137
  10673. case int32(75):
  10674. return __ccgo_ts + 2139
  10675. case int32(76):
  10676. return __ccgo_ts + 2141
  10677. case int32(77):
  10678. return __ccgo_ts + 2143
  10679. case int32(78):
  10680. return __ccgo_ts + 2145
  10681. case int32(79):
  10682. return __ccgo_ts + 2147
  10683. case int32(80):
  10684. return __ccgo_ts + 2149
  10685. case int32(81):
  10686. return __ccgo_ts + 2151
  10687. case int32(82):
  10688. return __ccgo_ts + 2153
  10689. case int32(83):
  10690. return __ccgo_ts + 2155
  10691. case int32(84):
  10692. return __ccgo_ts + 2157
  10693. case int32(85):
  10694. return __ccgo_ts + 2159
  10695. case int32(86):
  10696. return __ccgo_ts + 2161
  10697. case int32(87):
  10698. return __ccgo_ts + 2163
  10699. case int32(88):
  10700. return __ccgo_ts + 2165
  10701. case int32(89):
  10702. return __ccgo_ts + 2167
  10703. case int32(90):
  10704. return __ccgo_ts + 2169
  10705. case int32(91):
  10706. return __ccgo_ts + 2171
  10707. case int32(92):
  10708. return __ccgo_ts + 2173
  10709. case int32(93):
  10710. return __ccgo_ts + 2176
  10711. case int32(94):
  10712. return __ccgo_ts + 2178
  10713. case int32(95):
  10714. return __ccgo_ts + 2180
  10715. case int32(96):
  10716. return __ccgo_ts + 2182
  10717. case int32(97):
  10718. return __ccgo_ts + 2184
  10719. case int32(98):
  10720. return __ccgo_ts + 2186
  10721. case int32(99):
  10722. return __ccgo_ts + 2188
  10723. case int32(100):
  10724. return __ccgo_ts + 2190
  10725. case int32(101):
  10726. return __ccgo_ts + 2192
  10727. case int32(102):
  10728. return __ccgo_ts + 2194
  10729. case int32(103):
  10730. return __ccgo_ts + 2196
  10731. case int32(104):
  10732. return __ccgo_ts + 2198
  10733. case int32(105):
  10734. return __ccgo_ts + 2200
  10735. case int32(106):
  10736. return __ccgo_ts + 2202
  10737. case int32(107):
  10738. return __ccgo_ts + 2204
  10739. case int32(108):
  10740. return __ccgo_ts + 2206
  10741. case int32(109):
  10742. return __ccgo_ts + 2208
  10743. case int32(110):
  10744. return __ccgo_ts + 2210
  10745. case int32(111):
  10746. return __ccgo_ts + 2212
  10747. case int32(112):
  10748. return __ccgo_ts + 2214
  10749. case int32(113):
  10750. return __ccgo_ts + 2216
  10751. case int32(114):
  10752. return __ccgo_ts + 2218
  10753. case int32(115):
  10754. return __ccgo_ts + 2220
  10755. case int32(116):
  10756. return __ccgo_ts + 2222
  10757. case int32(117):
  10758. return __ccgo_ts + 2224
  10759. case int32(118):
  10760. return __ccgo_ts + 2226
  10761. case int32(119):
  10762. return __ccgo_ts + 2228
  10763. case int32(120):
  10764. return __ccgo_ts + 2230
  10765. case int32(121):
  10766. return __ccgo_ts + 2232
  10767. case int32(122):
  10768. return __ccgo_ts + 2234
  10769. case int32(123):
  10770. return __ccgo_ts + 2236
  10771. case int32(124):
  10772. return __ccgo_ts + 2238
  10773. case int32(125):
  10774. return __ccgo_ts + 2240
  10775. case int32(126):
  10776. return __ccgo_ts + 2242
  10777. case int32(127):
  10778. return __ccgo_ts + 2244
  10779. case int32(128):
  10780. return __ccgo_ts + 2249
  10781. case int32(129):
  10782. return __ccgo_ts + 2254
  10783. case int32(130):
  10784. return __ccgo_ts + 2259
  10785. case int32(131):
  10786. return __ccgo_ts + 2264
  10787. case int32(132):
  10788. return __ccgo_ts + 2269
  10789. case int32(133):
  10790. return __ccgo_ts + 2274
  10791. case int32(134):
  10792. return __ccgo_ts + 2279
  10793. case int32(135):
  10794. return __ccgo_ts + 2284
  10795. case int32(136):
  10796. return __ccgo_ts + 2289
  10797. case int32(137):
  10798. return __ccgo_ts + 2294
  10799. case int32(138):
  10800. return __ccgo_ts + 2299
  10801. case int32(139):
  10802. return __ccgo_ts + 2304
  10803. case int32(140):
  10804. return __ccgo_ts + 2309
  10805. case int32(141):
  10806. return __ccgo_ts + 2314
  10807. case int32(142):
  10808. return __ccgo_ts + 2319
  10809. case int32(143):
  10810. return __ccgo_ts + 2324
  10811. case int32(144):
  10812. return __ccgo_ts + 2329
  10813. case int32(145):
  10814. return __ccgo_ts + 2334
  10815. case int32(146):
  10816. return __ccgo_ts + 2339
  10817. case int32(147):
  10818. return __ccgo_ts + 2344
  10819. case int32(148):
  10820. return __ccgo_ts + 2349
  10821. case int32(149):
  10822. return __ccgo_ts + 2354
  10823. case int32(150):
  10824. return __ccgo_ts + 2359
  10825. case int32(151):
  10826. return __ccgo_ts + 2364
  10827. case int32(152):
  10828. return __ccgo_ts + 2369
  10829. case int32(153):
  10830. return __ccgo_ts + 2374
  10831. case int32(154):
  10832. return __ccgo_ts + 2379
  10833. case int32(155):
  10834. return __ccgo_ts + 2384
  10835. case int32(156):
  10836. return __ccgo_ts + 2389
  10837. case int32(157):
  10838. return __ccgo_ts + 2394
  10839. case int32(158):
  10840. return __ccgo_ts + 2399
  10841. case int32(159):
  10842. return __ccgo_ts + 2404
  10843. case int32(160):
  10844. return __ccgo_ts + 2409
  10845. case int32(161):
  10846. return __ccgo_ts + 2414
  10847. case int32(162):
  10848. return __ccgo_ts + 2419
  10849. case int32(163):
  10850. return __ccgo_ts + 2424
  10851. case int32(164):
  10852. return __ccgo_ts + 2429
  10853. case int32(165):
  10854. return __ccgo_ts + 2434
  10855. case int32(166):
  10856. return __ccgo_ts + 2439
  10857. case int32(167):
  10858. return __ccgo_ts + 2444
  10859. case int32(168):
  10860. return __ccgo_ts + 2449
  10861. case int32(169):
  10862. return __ccgo_ts + 2454
  10863. case int32(170):
  10864. return __ccgo_ts + 2459
  10865. case int32(171):
  10866. return __ccgo_ts + 2464
  10867. case int32(172):
  10868. return __ccgo_ts + 2469
  10869. case int32(173):
  10870. return __ccgo_ts + 2474
  10871. case int32(174):
  10872. return __ccgo_ts + 2479
  10873. case int32(175):
  10874. return __ccgo_ts + 2484
  10875. case int32(176):
  10876. return __ccgo_ts + 2489
  10877. case int32(177):
  10878. return __ccgo_ts + 2494
  10879. case int32(178):
  10880. return __ccgo_ts + 2499
  10881. case int32(179):
  10882. return __ccgo_ts + 2504
  10883. case int32(180):
  10884. return __ccgo_ts + 2509
  10885. case int32(181):
  10886. return __ccgo_ts + 2514
  10887. case int32(182):
  10888. return __ccgo_ts + 2519
  10889. case int32(183):
  10890. return __ccgo_ts + 2524
  10891. case int32(184):
  10892. return __ccgo_ts + 2529
  10893. case int32(185):
  10894. return __ccgo_ts + 2534
  10895. case int32(186):
  10896. return __ccgo_ts + 2539
  10897. case int32(187):
  10898. return __ccgo_ts + 2544
  10899. case int32(188):
  10900. return __ccgo_ts + 2549
  10901. case int32(189):
  10902. return __ccgo_ts + 2554
  10903. case int32(190):
  10904. return __ccgo_ts + 2559
  10905. case int32(191):
  10906. return __ccgo_ts + 2564
  10907. case int32(192):
  10908. return __ccgo_ts + 2569
  10909. case int32(193):
  10910. return __ccgo_ts + 2574
  10911. case int32(194):
  10912. return __ccgo_ts + 2579
  10913. case int32(195):
  10914. return __ccgo_ts + 2584
  10915. case int32(196):
  10916. return __ccgo_ts + 2589
  10917. case int32(197):
  10918. return __ccgo_ts + 2594
  10919. case int32(198):
  10920. return __ccgo_ts + 2599
  10921. case int32(199):
  10922. return __ccgo_ts + 2604
  10923. case int32(200):
  10924. return __ccgo_ts + 2609
  10925. case int32(201):
  10926. return __ccgo_ts + 2614
  10927. case int32(202):
  10928. return __ccgo_ts + 2619
  10929. case int32(203):
  10930. return __ccgo_ts + 2624
  10931. case int32(204):
  10932. return __ccgo_ts + 2629
  10933. case int32(205):
  10934. return __ccgo_ts + 2634
  10935. case int32(206):
  10936. return __ccgo_ts + 2639
  10937. case int32(207):
  10938. return __ccgo_ts + 2644
  10939. case int32(208):
  10940. return __ccgo_ts + 2649
  10941. case int32(209):
  10942. return __ccgo_ts + 2654
  10943. case int32(210):
  10944. return __ccgo_ts + 2659
  10945. case int32(211):
  10946. return __ccgo_ts + 2664
  10947. case int32(212):
  10948. return __ccgo_ts + 2669
  10949. case int32(213):
  10950. return __ccgo_ts + 2674
  10951. case int32(214):
  10952. return __ccgo_ts + 2679
  10953. case int32(215):
  10954. return __ccgo_ts + 2684
  10955. case int32(216):
  10956. return __ccgo_ts + 2689
  10957. case int32(217):
  10958. return __ccgo_ts + 2694
  10959. case int32(218):
  10960. return __ccgo_ts + 2699
  10961. case int32(219):
  10962. return __ccgo_ts + 2704
  10963. case int32(220):
  10964. return __ccgo_ts + 2709
  10965. case int32(221):
  10966. return __ccgo_ts + 2714
  10967. case int32(222):
  10968. return __ccgo_ts + 2719
  10969. case int32(223):
  10970. return __ccgo_ts + 2724
  10971. case int32(224):
  10972. return __ccgo_ts + 2729
  10973. case int32(225):
  10974. return __ccgo_ts + 2734
  10975. case int32(226):
  10976. return __ccgo_ts + 2739
  10977. case int32(227):
  10978. return __ccgo_ts + 2744
  10979. case int32(228):
  10980. return __ccgo_ts + 2749
  10981. case int32(229):
  10982. return __ccgo_ts + 2754
  10983. case int32(230):
  10984. return __ccgo_ts + 2759
  10985. case int32(231):
  10986. return __ccgo_ts + 2764
  10987. case int32(232):
  10988. return __ccgo_ts + 2769
  10989. case int32(233):
  10990. return __ccgo_ts + 2774
  10991. case int32(234):
  10992. return __ccgo_ts + 2779
  10993. case int32(235):
  10994. return __ccgo_ts + 2784
  10995. case int32(236):
  10996. return __ccgo_ts + 2789
  10997. case int32(237):
  10998. return __ccgo_ts + 2794
  10999. case int32(238):
  11000. return __ccgo_ts + 2799
  11001. case int32(239):
  11002. return __ccgo_ts + 2804
  11003. case int32(240):
  11004. return __ccgo_ts + 2809
  11005. case int32(241):
  11006. return __ccgo_ts + 2814
  11007. case int32(242):
  11008. return __ccgo_ts + 2819
  11009. case int32(243):
  11010. return __ccgo_ts + 2824
  11011. case int32(244):
  11012. return __ccgo_ts + 2829
  11013. case int32(245):
  11014. return __ccgo_ts + 2834
  11015. case int32(246):
  11016. return __ccgo_ts + 2839
  11017. case int32(247):
  11018. return __ccgo_ts + 2844
  11019. case int32(248):
  11020. return __ccgo_ts + 2849
  11021. case int32(249):
  11022. return __ccgo_ts + 2854
  11023. case int32(250):
  11024. return __ccgo_ts + 2859
  11025. case int32(251):
  11026. return __ccgo_ts + 2864
  11027. case int32(252):
  11028. return __ccgo_ts + 2869
  11029. case int32(253):
  11030. return __ccgo_ts + 2874
  11031. case int32(254):
  11032. return __ccgo_ts + 2879
  11033. case int32(255):
  11034. return __ccgo_ts + 2884
  11035. default:
  11036. /* never gets here */
  11037. return __ccgo_ts + 2889
  11038. }
  11039. /* never gets here */
  11040. return r
  11041. }
  11042. func _getDebugLevel(tls *libc.TLS, variableName uintptr, defaultDebugLevel uint64) (r uint64) {
  11043. bp := tls.Alloc(16)
  11044. defer tls.Free(16)
  11045. var debugLevel uint64
  11046. var value, valueOrNull uintptr
  11047. var _ /* afterValue at bp+0 */ uintptr
  11048. _, _, _ = debugLevel, value, valueOrNull
  11049. valueOrNull = libc.Xgetenv(tls, variableName)
  11050. if valueOrNull == libc.UintptrFromInt32(0) {
  11051. return defaultDebugLevel
  11052. }
  11053. value = valueOrNull
  11054. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = 0
  11055. *(*uintptr)(unsafe.Pointer(bp)) = value
  11056. debugLevel = libc.Xstrtoul(tls, value, bp, int32(10))
  11057. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) != 0 || int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) != int32('\000') {
  11058. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = 0
  11059. return defaultDebugLevel
  11060. }
  11061. return debugLevel
  11062. }
  11063. const m_ASCII_01 = 0x30
  11064. const m_ASCII_11 = 0x31
  11065. const m_ASCII_21 = 0x32
  11066. const m_ASCII_31 = 0x33
  11067. const m_ASCII_81 = 0x38
  11068. const m_ASCII_91 = 0x39
  11069. const m_ASCII_B1 = 66
  11070. const m_ASCII_COLON1 = 0x3A
  11071. const m_ASCII_COMMA1 = 0x2C
  11072. const m_ASCII_EQUALS1 = 0x3D
  11073. const m_ASCII_EXCL1 = 0x21
  11074. const m_ASCII_FF1 = 0x0C
  11075. const m_ASCII_G1 = 71
  11076. const m_ASCII_HASH1 = 0x23
  11077. const m_ASCII_LPAREN1 = 0x28
  11078. const m_ASCII_P1 = 80
  11079. const m_ASCII_PERIOD1 = 0x2E
  11080. const m_ASCII_PIPE1 = 0x7C
  11081. const m_ASCII_Q1 = 81
  11082. const m_ASCII_RPAREN1 = 0x29
  11083. const m_ASCII_SLASH1 = 0x2F
  11084. const m_ASCII_U1 = 85
  11085. const m_ASCII_a1 = 0x61
  11086. const m_ASCII_c1 = 0x63
  11087. const m_ASCII_e1 = 0x65
  11088. const m_ASCII_g1 = 0x67
  11089. const m_ASCII_h1 = 0x68
  11090. const m_ASCII_l1 = 0x6C
  11091. const m_ASCII_m1 = 0x6D
  11092. const m_ASCII_n1 = 0x6E
  11093. const m_ASCII_o1 = 0x6F
  11094. const m_ASCII_p1 = 0x70
  11095. const m_ASCII_r1 = 0x72
  11096. const m_ASCII_s1 = 0x73
  11097. const m_ASCII_t1 = 0x74
  11098. const m_ASCII_w1 = 0x77
  11099. const m_ASCII_x1 = 0x78
  11100. const m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT1 = "100.0f"
  11101. const m_INT_MAX1 = 0x7fffffff
  11102. const m_UINT_MAX1 = 0xffffffff
  11103. /*
  11104. __ __ _
  11105. ___\ \/ /_ __ __ _| |_
  11106. / _ \\ /| '_ \ / _` | __|
  11107. | __// \| |_) | (_| | |_
  11108. \___/_/\_\ .__/ \__,_|\__|
  11109. |_| XML parser
  11110. Copyright (c) 1999-2000 Thai Open Source Software Center Ltd
  11111. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  11112. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  11113. Copyright (c) 2007 Karl Waclawek <karl@waclawek.net>
  11114. Copyright (c) 2017 Sebastian Pipping <sebastian@pipping.org>
  11115. Licensed under the MIT license:
  11116. Permission is hereby granted, free of charge, to any person obtaining
  11117. a copy of this software and associated documentation files (the
  11118. "Software"), to deal in the Software without restriction, including
  11119. without limitation the rights to use, copy, modify, merge, publish,
  11120. distribute, sublicense, and/or sell copies of the Software, and to permit
  11121. persons to whom the Software is furnished to do so, subject to the
  11122. following conditions:
  11123. The above copyright notice and this permission notice shall be included
  11124. in all copies or substantial portions of the Software.
  11125. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  11126. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  11127. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  11128. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  11129. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  11130. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  11131. USE OR OTHER DEALINGS IN THE SOFTWARE.
  11132. */
  11133. /* Doesn't check:
  11134. that ,| are not mixed in a model group
  11135. content of literals
  11136. */
  11137. var _KW_ANY = [4]int8{
  11138. 0: int8(m_ASCII_A),
  11139. 1: int8(m_ASCII_N),
  11140. 2: int8(m_ASCII_Y),
  11141. }
  11142. var _KW_ATTLIST = [8]int8{
  11143. 0: int8(m_ASCII_A),
  11144. 1: int8(m_ASCII_T),
  11145. 2: int8(m_ASCII_T),
  11146. 3: int8(m_ASCII_L),
  11147. 4: int8(m_ASCII_I),
  11148. 5: int8(m_ASCII_S),
  11149. 6: int8(m_ASCII_T),
  11150. }
  11151. var _KW_CDATA = [6]int8{
  11152. 0: int8(m_ASCII_C),
  11153. 1: int8(m_ASCII_D),
  11154. 2: int8(m_ASCII_A),
  11155. 3: int8(m_ASCII_T),
  11156. 4: int8(m_ASCII_A),
  11157. }
  11158. var _KW_DOCTYPE = [8]int8{
  11159. 0: int8(m_ASCII_D),
  11160. 1: int8(m_ASCII_O),
  11161. 2: int8(m_ASCII_C),
  11162. 3: int8(m_ASCII_T),
  11163. 4: int8(m_ASCII_Y),
  11164. 5: int8(m_ASCII_P1),
  11165. 6: int8(m_ASCII_E),
  11166. }
  11167. var _KW_ELEMENT = [8]int8{
  11168. 0: int8(m_ASCII_E),
  11169. 1: int8(m_ASCII_L),
  11170. 2: int8(m_ASCII_E),
  11171. 3: int8(m_ASCII_M),
  11172. 4: int8(m_ASCII_E),
  11173. 5: int8(m_ASCII_N),
  11174. 6: int8(m_ASCII_T),
  11175. }
  11176. var _KW_EMPTY = [6]int8{
  11177. 0: int8(m_ASCII_E),
  11178. 1: int8(m_ASCII_M),
  11179. 2: int8(m_ASCII_P1),
  11180. 3: int8(m_ASCII_T),
  11181. 4: int8(m_ASCII_Y),
  11182. }
  11183. var _KW_ENTITIES = [9]int8{
  11184. 0: int8(m_ASCII_E),
  11185. 1: int8(m_ASCII_N),
  11186. 2: int8(m_ASCII_T),
  11187. 3: int8(m_ASCII_I),
  11188. 4: int8(m_ASCII_T),
  11189. 5: int8(m_ASCII_I),
  11190. 6: int8(m_ASCII_E),
  11191. 7: int8(m_ASCII_S),
  11192. }
  11193. var _KW_ENTITY = [7]int8{
  11194. 0: int8(m_ASCII_E),
  11195. 1: int8(m_ASCII_N),
  11196. 2: int8(m_ASCII_T),
  11197. 3: int8(m_ASCII_I),
  11198. 4: int8(m_ASCII_T),
  11199. 5: int8(m_ASCII_Y),
  11200. }
  11201. var _KW_FIXED = [6]int8{
  11202. 0: int8(m_ASCII_F),
  11203. 1: int8(m_ASCII_I),
  11204. 2: int8(m_ASCII_X),
  11205. 3: int8(m_ASCII_E),
  11206. 4: int8(m_ASCII_D),
  11207. }
  11208. var _KW_ID = [3]int8{
  11209. 0: int8(m_ASCII_I),
  11210. 1: int8(m_ASCII_D),
  11211. }
  11212. var _KW_IDREF = [6]int8{
  11213. 0: int8(m_ASCII_I),
  11214. 1: int8(m_ASCII_D),
  11215. 2: int8(m_ASCII_R),
  11216. 3: int8(m_ASCII_E),
  11217. 4: int8(m_ASCII_F),
  11218. }
  11219. var _KW_IDREFS = [7]int8{
  11220. 0: int8(m_ASCII_I),
  11221. 1: int8(m_ASCII_D),
  11222. 2: int8(m_ASCII_R),
  11223. 3: int8(m_ASCII_E),
  11224. 4: int8(m_ASCII_F),
  11225. 5: int8(m_ASCII_S),
  11226. }
  11227. var _KW_IGNORE = [7]int8{
  11228. 0: int8(m_ASCII_I),
  11229. 1: int8(m_ASCII_G1),
  11230. 2: int8(m_ASCII_N),
  11231. 3: int8(m_ASCII_O),
  11232. 4: int8(m_ASCII_R),
  11233. 5: int8(m_ASCII_E),
  11234. }
  11235. var _KW_IMPLIED = [8]int8{
  11236. 0: int8(m_ASCII_I),
  11237. 1: int8(m_ASCII_M),
  11238. 2: int8(m_ASCII_P1),
  11239. 3: int8(m_ASCII_L),
  11240. 4: int8(m_ASCII_I),
  11241. 5: int8(m_ASCII_E),
  11242. 6: int8(m_ASCII_D),
  11243. }
  11244. var _KW_INCLUDE = [8]int8{
  11245. 0: int8(m_ASCII_I),
  11246. 1: int8(m_ASCII_N),
  11247. 2: int8(m_ASCII_C),
  11248. 3: int8(m_ASCII_L),
  11249. 4: int8(m_ASCII_U1),
  11250. 5: int8(m_ASCII_D),
  11251. 6: int8(m_ASCII_E),
  11252. }
  11253. var _KW_NDATA = [6]int8{
  11254. 0: int8(m_ASCII_N),
  11255. 1: int8(m_ASCII_D),
  11256. 2: int8(m_ASCII_A),
  11257. 3: int8(m_ASCII_T),
  11258. 4: int8(m_ASCII_A),
  11259. }
  11260. var _KW_NMTOKEN = [8]int8{
  11261. 0: int8(m_ASCII_N),
  11262. 1: int8(m_ASCII_M),
  11263. 2: int8(m_ASCII_T),
  11264. 3: int8(m_ASCII_O),
  11265. 4: int8(m_ASCII_K),
  11266. 5: int8(m_ASCII_E),
  11267. 6: int8(m_ASCII_N),
  11268. }
  11269. var _KW_NMTOKENS = [9]int8{
  11270. 0: int8(m_ASCII_N),
  11271. 1: int8(m_ASCII_M),
  11272. 2: int8(m_ASCII_T),
  11273. 3: int8(m_ASCII_O),
  11274. 4: int8(m_ASCII_K),
  11275. 5: int8(m_ASCII_E),
  11276. 6: int8(m_ASCII_N),
  11277. 7: int8(m_ASCII_S),
  11278. }
  11279. var _KW_NOTATION = [9]int8{
  11280. 0: int8(m_ASCII_N),
  11281. 1: int8(m_ASCII_O),
  11282. 2: int8(m_ASCII_T),
  11283. 3: int8(m_ASCII_A),
  11284. 4: int8(m_ASCII_T),
  11285. 5: int8(m_ASCII_I),
  11286. 6: int8(m_ASCII_O),
  11287. 7: int8(m_ASCII_N),
  11288. }
  11289. var _KW_PCDATA = [7]int8{
  11290. 0: int8(m_ASCII_P1),
  11291. 1: int8(m_ASCII_C),
  11292. 2: int8(m_ASCII_D),
  11293. 3: int8(m_ASCII_A),
  11294. 4: int8(m_ASCII_T),
  11295. 5: int8(m_ASCII_A),
  11296. }
  11297. var _KW_PUBLIC = [7]int8{
  11298. 0: int8(m_ASCII_P1),
  11299. 1: int8(m_ASCII_U1),
  11300. 2: int8(m_ASCII_B1),
  11301. 3: int8(m_ASCII_L),
  11302. 4: int8(m_ASCII_I),
  11303. 5: int8(m_ASCII_C),
  11304. }
  11305. var _KW_REQUIRED = [9]int8{
  11306. 0: int8(m_ASCII_R),
  11307. 1: int8(m_ASCII_E),
  11308. 2: int8(m_ASCII_Q1),
  11309. 3: int8(m_ASCII_U1),
  11310. 4: int8(m_ASCII_I),
  11311. 5: int8(m_ASCII_R),
  11312. 6: int8(m_ASCII_E),
  11313. 7: int8(m_ASCII_D),
  11314. }
  11315. var _KW_SYSTEM = [7]int8{
  11316. 0: int8(m_ASCII_S),
  11317. 1: int8(m_ASCII_Y),
  11318. 2: int8(m_ASCII_S),
  11319. 3: int8(m_ASCII_T),
  11320. 4: int8(m_ASCII_E),
  11321. 5: int8(m_ASCII_M),
  11322. }
  11323. func _prolog0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11324. switch tok {
  11325. case int32(m_XML_TOK_PROLOG_S):
  11326. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  11327. return int32(_XML_ROLE_NONE)
  11328. case int32(m_XML_TOK_XML_DECL):
  11329. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  11330. return int32(_XML_ROLE_XML_DECL)
  11331. case int32(m_XML_TOK_PI):
  11332. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  11333. return int32(_XML_ROLE_PI)
  11334. case int32(m_XML_TOK_COMMENT):
  11335. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  11336. return int32(_XML_ROLE_COMMENT)
  11337. case int32(m_XML_TOK_BOM):
  11338. return int32(_XML_ROLE_NONE)
  11339. case int32(m_XML_TOK_DECL_OPEN):
  11340. 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) {
  11341. break
  11342. }
  11343. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype0)
  11344. return int32(_XML_ROLE_DOCTYPE_NONE)
  11345. case int32(m_XML_TOK_INSTANCE_START):
  11346. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  11347. return int32(_XML_ROLE_INSTANCE_START)
  11348. }
  11349. return _common(tls, state, tok)
  11350. }
  11351. func _prolog1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11352. switch tok {
  11353. case int32(m_XML_TOK_PROLOG_S):
  11354. return int32(_XML_ROLE_NONE)
  11355. case int32(m_XML_TOK_PI):
  11356. return int32(_XML_ROLE_PI)
  11357. case int32(m_XML_TOK_COMMENT):
  11358. return int32(_XML_ROLE_COMMENT)
  11359. case int32(m_XML_TOK_BOM):
  11360. /* This case can never arise. To reach this role function, the
  11361. * parse must have passed through prolog0 and therefore have had
  11362. * some form of input, even if only a space. At that point, a
  11363. * byte order mark is no longer a valid character (though
  11364. * technically it should be interpreted as a non-breaking space),
  11365. * so will be rejected by the tokenizing stages.
  11366. */
  11367. return int32(_XML_ROLE_NONE) /* LCOV_EXCL_LINE */
  11368. case int32(m_XML_TOK_DECL_OPEN):
  11369. 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) {
  11370. break
  11371. }
  11372. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype0)
  11373. return int32(_XML_ROLE_DOCTYPE_NONE)
  11374. case int32(m_XML_TOK_INSTANCE_START):
  11375. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  11376. return int32(_XML_ROLE_INSTANCE_START)
  11377. }
  11378. return _common(tls, state, tok)
  11379. }
  11380. func _prolog2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11381. _ = ptr
  11382. _ = end
  11383. _ = enc
  11384. switch tok {
  11385. case int32(m_XML_TOK_PROLOG_S):
  11386. return int32(_XML_ROLE_NONE)
  11387. case int32(m_XML_TOK_PI):
  11388. return int32(_XML_ROLE_PI)
  11389. case int32(m_XML_TOK_COMMENT):
  11390. return int32(_XML_ROLE_COMMENT)
  11391. case int32(m_XML_TOK_INSTANCE_START):
  11392. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  11393. return int32(_XML_ROLE_INSTANCE_START)
  11394. }
  11395. return _common(tls, state, tok)
  11396. }
  11397. func _doctype0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11398. _ = ptr
  11399. _ = end
  11400. _ = enc
  11401. switch tok {
  11402. case int32(m_XML_TOK_PROLOG_S):
  11403. return int32(_XML_ROLE_DOCTYPE_NONE)
  11404. case int32(m_XML_TOK_NAME):
  11405. fallthrough
  11406. case int32(m_XML_TOK_PREFIXED_NAME):
  11407. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype1)
  11408. return int32(_XML_ROLE_DOCTYPE_NAME)
  11409. }
  11410. return _common(tls, state, tok)
  11411. }
  11412. func _doctype1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11413. switch tok {
  11414. case int32(m_XML_TOK_PROLOG_S):
  11415. return int32(_XML_ROLE_DOCTYPE_NONE)
  11416. case int32(m_XML_TOK_OPEN_BRACKET):
  11417. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_internalSubset)
  11418. return int32(_XML_ROLE_DOCTYPE_INTERNAL_SUBSET)
  11419. case int32(m_XML_TOK_DECL_CLOSE):
  11420. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog2)
  11421. return int32(_XML_ROLE_DOCTYPE_CLOSE)
  11422. case int32(m_XML_TOK_NAME):
  11423. 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 {
  11424. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype3)
  11425. return int32(_XML_ROLE_DOCTYPE_NONE)
  11426. }
  11427. 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 {
  11428. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype2)
  11429. return int32(_XML_ROLE_DOCTYPE_NONE)
  11430. }
  11431. break
  11432. }
  11433. return _common(tls, state, tok)
  11434. }
  11435. func _doctype2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11436. _ = ptr
  11437. _ = end
  11438. _ = enc
  11439. switch tok {
  11440. case int32(m_XML_TOK_PROLOG_S):
  11441. return int32(_XML_ROLE_DOCTYPE_NONE)
  11442. case int32(m_XML_TOK_LITERAL):
  11443. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype3)
  11444. return int32(_XML_ROLE_DOCTYPE_PUBLIC_ID)
  11445. }
  11446. return _common(tls, state, tok)
  11447. }
  11448. func _doctype3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11449. _ = ptr
  11450. _ = end
  11451. _ = enc
  11452. switch tok {
  11453. case int32(m_XML_TOK_PROLOG_S):
  11454. return int32(_XML_ROLE_DOCTYPE_NONE)
  11455. case int32(m_XML_TOK_LITERAL):
  11456. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype4)
  11457. return int32(_XML_ROLE_DOCTYPE_SYSTEM_ID)
  11458. }
  11459. return _common(tls, state, tok)
  11460. }
  11461. func _doctype4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11462. _ = ptr
  11463. _ = end
  11464. _ = enc
  11465. switch tok {
  11466. case int32(m_XML_TOK_PROLOG_S):
  11467. return int32(_XML_ROLE_DOCTYPE_NONE)
  11468. case int32(m_XML_TOK_OPEN_BRACKET):
  11469. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_internalSubset)
  11470. return int32(_XML_ROLE_DOCTYPE_INTERNAL_SUBSET)
  11471. case int32(m_XML_TOK_DECL_CLOSE):
  11472. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog2)
  11473. return int32(_XML_ROLE_DOCTYPE_CLOSE)
  11474. }
  11475. return _common(tls, state, tok)
  11476. }
  11477. func _doctype5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11478. _ = ptr
  11479. _ = end
  11480. _ = enc
  11481. switch tok {
  11482. case int32(m_XML_TOK_PROLOG_S):
  11483. return int32(_XML_ROLE_DOCTYPE_NONE)
  11484. case int32(m_XML_TOK_DECL_CLOSE):
  11485. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog2)
  11486. return int32(_XML_ROLE_DOCTYPE_CLOSE)
  11487. }
  11488. return _common(tls, state, tok)
  11489. }
  11490. func _internalSubset(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11491. switch tok {
  11492. case int32(m_XML_TOK_PROLOG_S):
  11493. return int32(_XML_ROLE_NONE)
  11494. case int32(m_XML_TOK_DECL_OPEN):
  11495. 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 {
  11496. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity0)
  11497. return int32(_XML_ROLE_ENTITY_NONE)
  11498. }
  11499. 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 {
  11500. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist0)
  11501. return int32(_XML_ROLE_ATTLIST_NONE)
  11502. }
  11503. 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 {
  11504. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element0)
  11505. return int32(_XML_ROLE_ELEMENT_NONE)
  11506. }
  11507. 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 {
  11508. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation0)
  11509. return int32(_XML_ROLE_NOTATION_NONE)
  11510. }
  11511. case int32(m_XML_TOK_PI):
  11512. return int32(_XML_ROLE_PI)
  11513. case int32(m_XML_TOK_COMMENT):
  11514. return int32(_XML_ROLE_COMMENT)
  11515. case int32(m_XML_TOK_PARAM_ENTITY_REF):
  11516. return int32(_XML_ROLE_PARAM_ENTITY_REF)
  11517. case int32(m_XML_TOK_CLOSE_BRACKET):
  11518. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype5)
  11519. return int32(_XML_ROLE_DOCTYPE_NONE)
  11520. case -int32(4):
  11521. return int32(_XML_ROLE_NONE)
  11522. }
  11523. return _common(tls, state, tok)
  11524. }
  11525. func _externalSubset0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11526. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset1)
  11527. if tok == int32(m_XML_TOK_XML_DECL) {
  11528. return int32(_XML_ROLE_TEXT_DECL)
  11529. }
  11530. return _externalSubset1(tls, state, tok, ptr, end, enc)
  11531. }
  11532. func _externalSubset1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11533. switch tok {
  11534. case int32(m_XML_TOK_COND_SECT_OPEN):
  11535. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_condSect0)
  11536. return int32(_XML_ROLE_NONE)
  11537. case int32(m_XML_TOK_COND_SECT_CLOSE):
  11538. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel == uint32(0) {
  11539. break
  11540. }
  11541. *(*uint32)(unsafe.Pointer(state + 16)) -= uint32(1)
  11542. return int32(_XML_ROLE_NONE)
  11543. case int32(m_XML_TOK_PROLOG_S):
  11544. return int32(_XML_ROLE_NONE)
  11545. case int32(m_XML_TOK_CLOSE_BRACKET):
  11546. case -int32(4):
  11547. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel != 0 {
  11548. break
  11549. }
  11550. return int32(_XML_ROLE_NONE)
  11551. default:
  11552. return _internalSubset(tls, state, tok, ptr, end, enc)
  11553. }
  11554. return _common(tls, state, tok)
  11555. }
  11556. func _entity0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11557. _ = ptr
  11558. _ = end
  11559. _ = enc
  11560. switch tok {
  11561. case int32(m_XML_TOK_PROLOG_S):
  11562. return int32(_XML_ROLE_ENTITY_NONE)
  11563. case int32(m_XML_TOK_PERCENT):
  11564. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity1)
  11565. return int32(_XML_ROLE_ENTITY_NONE)
  11566. case int32(m_XML_TOK_NAME):
  11567. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity2)
  11568. return int32(_XML_ROLE_GENERAL_ENTITY_NAME)
  11569. }
  11570. return _common(tls, state, tok)
  11571. }
  11572. func _entity1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11573. _ = ptr
  11574. _ = end
  11575. _ = enc
  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. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity7)
  11581. return int32(_XML_ROLE_PARAM_ENTITY_NAME)
  11582. }
  11583. return _common(tls, state, tok)
  11584. }
  11585. func _entity2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11586. switch tok {
  11587. case int32(m_XML_TOK_PROLOG_S):
  11588. return int32(_XML_ROLE_ENTITY_NONE)
  11589. case int32(m_XML_TOK_NAME):
  11590. 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 {
  11591. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity4)
  11592. return int32(_XML_ROLE_ENTITY_NONE)
  11593. }
  11594. 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 {
  11595. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity3)
  11596. return int32(_XML_ROLE_ENTITY_NONE)
  11597. }
  11598. case int32(m_XML_TOK_LITERAL):
  11599. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11600. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ENTITY_NONE)
  11601. return int32(_XML_ROLE_ENTITY_VALUE)
  11602. }
  11603. return _common(tls, state, tok)
  11604. }
  11605. func _entity3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11606. _ = ptr
  11607. _ = end
  11608. _ = enc
  11609. switch tok {
  11610. case int32(m_XML_TOK_PROLOG_S):
  11611. return int32(_XML_ROLE_ENTITY_NONE)
  11612. case int32(m_XML_TOK_LITERAL):
  11613. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity4)
  11614. return int32(_XML_ROLE_ENTITY_PUBLIC_ID)
  11615. }
  11616. return _common(tls, state, tok)
  11617. }
  11618. func _entity4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11619. _ = ptr
  11620. _ = end
  11621. _ = enc
  11622. switch tok {
  11623. case int32(m_XML_TOK_PROLOG_S):
  11624. return int32(_XML_ROLE_ENTITY_NONE)
  11625. case int32(m_XML_TOK_LITERAL):
  11626. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity5)
  11627. return int32(_XML_ROLE_ENTITY_SYSTEM_ID)
  11628. }
  11629. return _common(tls, state, tok)
  11630. }
  11631. func _entity5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11632. var v1 uintptr
  11633. _ = v1
  11634. switch tok {
  11635. case int32(m_XML_TOK_PROLOG_S):
  11636. return int32(_XML_ROLE_ENTITY_NONE)
  11637. case int32(m_XML_TOK_DECL_CLOSE):
  11638. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  11639. v1 = __ccgo_fp(_internalSubset)
  11640. } else {
  11641. v1 = __ccgo_fp(_externalSubset1)
  11642. }
  11643. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  11644. return int32(_XML_ROLE_ENTITY_COMPLETE)
  11645. case int32(m_XML_TOK_NAME):
  11646. 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 {
  11647. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity6)
  11648. return int32(_XML_ROLE_ENTITY_NONE)
  11649. }
  11650. break
  11651. }
  11652. return _common(tls, state, tok)
  11653. }
  11654. func _entity6(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11655. _ = ptr
  11656. _ = end
  11657. _ = enc
  11658. switch tok {
  11659. case int32(m_XML_TOK_PROLOG_S):
  11660. return int32(_XML_ROLE_ENTITY_NONE)
  11661. case int32(m_XML_TOK_NAME):
  11662. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11663. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ENTITY_NONE)
  11664. return int32(_XML_ROLE_ENTITY_NOTATION_NAME)
  11665. }
  11666. return _common(tls, state, tok)
  11667. }
  11668. func _entity7(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11669. switch tok {
  11670. case int32(m_XML_TOK_PROLOG_S):
  11671. return int32(_XML_ROLE_ENTITY_NONE)
  11672. case int32(m_XML_TOK_NAME):
  11673. 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 {
  11674. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity9)
  11675. return int32(_XML_ROLE_ENTITY_NONE)
  11676. }
  11677. 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 {
  11678. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity8)
  11679. return int32(_XML_ROLE_ENTITY_NONE)
  11680. }
  11681. case int32(m_XML_TOK_LITERAL):
  11682. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11683. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ENTITY_NONE)
  11684. return int32(_XML_ROLE_ENTITY_VALUE)
  11685. }
  11686. return _common(tls, state, tok)
  11687. }
  11688. func _entity8(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11689. _ = ptr
  11690. _ = end
  11691. _ = enc
  11692. switch tok {
  11693. case int32(m_XML_TOK_PROLOG_S):
  11694. return int32(_XML_ROLE_ENTITY_NONE)
  11695. case int32(m_XML_TOK_LITERAL):
  11696. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity9)
  11697. return int32(_XML_ROLE_ENTITY_PUBLIC_ID)
  11698. }
  11699. return _common(tls, state, tok)
  11700. }
  11701. func _entity9(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11702. _ = ptr
  11703. _ = end
  11704. _ = enc
  11705. switch tok {
  11706. case int32(m_XML_TOK_PROLOG_S):
  11707. return int32(_XML_ROLE_ENTITY_NONE)
  11708. case int32(m_XML_TOK_LITERAL):
  11709. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity10)
  11710. return int32(_XML_ROLE_ENTITY_SYSTEM_ID)
  11711. }
  11712. return _common(tls, state, tok)
  11713. }
  11714. func _entity10(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11715. var v1 uintptr
  11716. _ = v1
  11717. _ = ptr
  11718. _ = end
  11719. _ = enc
  11720. switch tok {
  11721. case int32(m_XML_TOK_PROLOG_S):
  11722. return int32(_XML_ROLE_ENTITY_NONE)
  11723. case int32(m_XML_TOK_DECL_CLOSE):
  11724. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  11725. v1 = __ccgo_fp(_internalSubset)
  11726. } else {
  11727. v1 = __ccgo_fp(_externalSubset1)
  11728. }
  11729. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  11730. return int32(_XML_ROLE_ENTITY_COMPLETE)
  11731. }
  11732. return _common(tls, state, tok)
  11733. }
  11734. func _notation0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11735. _ = ptr
  11736. _ = end
  11737. _ = enc
  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. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation1)
  11743. return int32(_XML_ROLE_NOTATION_NAME)
  11744. }
  11745. return _common(tls, state, tok)
  11746. }
  11747. func _notation1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11748. switch tok {
  11749. case int32(m_XML_TOK_PROLOG_S):
  11750. return int32(_XML_ROLE_NOTATION_NONE)
  11751. case int32(m_XML_TOK_NAME):
  11752. 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 {
  11753. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation3)
  11754. return int32(_XML_ROLE_NOTATION_NONE)
  11755. }
  11756. 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 {
  11757. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation2)
  11758. return int32(_XML_ROLE_NOTATION_NONE)
  11759. }
  11760. break
  11761. }
  11762. return _common(tls, state, tok)
  11763. }
  11764. func _notation2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11765. _ = ptr
  11766. _ = end
  11767. _ = enc
  11768. switch tok {
  11769. case int32(m_XML_TOK_PROLOG_S):
  11770. return int32(_XML_ROLE_NOTATION_NONE)
  11771. case int32(m_XML_TOK_LITERAL):
  11772. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation4)
  11773. return int32(_XML_ROLE_NOTATION_PUBLIC_ID)
  11774. }
  11775. return _common(tls, state, tok)
  11776. }
  11777. func _notation3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11778. _ = ptr
  11779. _ = end
  11780. _ = enc
  11781. switch tok {
  11782. case int32(m_XML_TOK_PROLOG_S):
  11783. return int32(_XML_ROLE_NOTATION_NONE)
  11784. case int32(m_XML_TOK_LITERAL):
  11785. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11786. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_NOTATION_NONE)
  11787. return int32(_XML_ROLE_NOTATION_SYSTEM_ID)
  11788. }
  11789. return _common(tls, state, tok)
  11790. }
  11791. func _notation4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11792. var v1 uintptr
  11793. _ = v1
  11794. _ = ptr
  11795. _ = end
  11796. _ = enc
  11797. switch tok {
  11798. case int32(m_XML_TOK_PROLOG_S):
  11799. return int32(_XML_ROLE_NOTATION_NONE)
  11800. case int32(m_XML_TOK_LITERAL):
  11801. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11802. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_NOTATION_NONE)
  11803. return int32(_XML_ROLE_NOTATION_SYSTEM_ID)
  11804. case int32(m_XML_TOK_DECL_CLOSE):
  11805. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  11806. v1 = __ccgo_fp(_internalSubset)
  11807. } else {
  11808. v1 = __ccgo_fp(_externalSubset1)
  11809. }
  11810. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  11811. return int32(_XML_ROLE_NOTATION_NO_SYSTEM_ID)
  11812. }
  11813. return _common(tls, state, tok)
  11814. }
  11815. func _attlist0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11816. _ = ptr
  11817. _ = end
  11818. _ = enc
  11819. switch tok {
  11820. case int32(m_XML_TOK_PROLOG_S):
  11821. return int32(_XML_ROLE_ATTLIST_NONE)
  11822. case int32(m_XML_TOK_NAME):
  11823. fallthrough
  11824. case int32(m_XML_TOK_PREFIXED_NAME):
  11825. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  11826. return int32(_XML_ROLE_ATTLIST_ELEMENT_NAME)
  11827. }
  11828. return _common(tls, state, tok)
  11829. }
  11830. func _attlist1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11831. var v1 uintptr
  11832. _ = v1
  11833. _ = ptr
  11834. _ = end
  11835. _ = enc
  11836. switch tok {
  11837. case int32(m_XML_TOK_PROLOG_S):
  11838. return int32(_XML_ROLE_ATTLIST_NONE)
  11839. case int32(m_XML_TOK_DECL_CLOSE):
  11840. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  11841. v1 = __ccgo_fp(_internalSubset)
  11842. } else {
  11843. v1 = __ccgo_fp(_externalSubset1)
  11844. }
  11845. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  11846. return int32(_XML_ROLE_ATTLIST_NONE)
  11847. case int32(m_XML_TOK_NAME):
  11848. fallthrough
  11849. case int32(m_XML_TOK_PREFIXED_NAME):
  11850. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist2)
  11851. return int32(_XML_ROLE_ATTRIBUTE_NAME)
  11852. }
  11853. return _common(tls, state, tok)
  11854. }
  11855. func _attlist2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11856. var i int32
  11857. _ = i
  11858. switch tok {
  11859. case int32(m_XML_TOK_PROLOG_S):
  11860. return int32(_XML_ROLE_ATTLIST_NONE)
  11861. case int32(m_XML_TOK_NAME):
  11862. i = 0
  11863. for {
  11864. if !(i < libc.Int32FromUint64(libc.Uint64FromInt64(64)/libc.Uint64FromInt64(8))) {
  11865. break
  11866. }
  11867. 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 {
  11868. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist8)
  11869. return int32(_XML_ROLE_ATTRIBUTE_TYPE_CDATA) + i
  11870. }
  11871. goto _1
  11872. _1:
  11873. ;
  11874. i++
  11875. }
  11876. 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 {
  11877. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist5)
  11878. return int32(_XML_ROLE_ATTLIST_NONE)
  11879. }
  11880. case int32(m_XML_TOK_OPEN_PAREN):
  11881. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist3)
  11882. return int32(_XML_ROLE_ATTLIST_NONE)
  11883. }
  11884. return _common(tls, state, tok)
  11885. }
  11886. var _types = [8]uintptr{
  11887. 0: uintptr(unsafe.Pointer(&_KW_CDATA)),
  11888. 1: uintptr(unsafe.Pointer(&_KW_ID)),
  11889. 2: uintptr(unsafe.Pointer(&_KW_IDREF)),
  11890. 3: uintptr(unsafe.Pointer(&_KW_IDREFS)),
  11891. 4: uintptr(unsafe.Pointer(&_KW_ENTITY)),
  11892. 5: uintptr(unsafe.Pointer(&_KW_ENTITIES)),
  11893. 6: uintptr(unsafe.Pointer(&_KW_NMTOKEN)),
  11894. 7: uintptr(unsafe.Pointer(&_KW_NMTOKENS)),
  11895. }
  11896. func _attlist3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11897. _ = ptr
  11898. _ = end
  11899. _ = enc
  11900. switch tok {
  11901. case int32(m_XML_TOK_PROLOG_S):
  11902. return int32(_XML_ROLE_ATTLIST_NONE)
  11903. case int32(m_XML_TOK_NMTOKEN):
  11904. fallthrough
  11905. case int32(m_XML_TOK_NAME):
  11906. fallthrough
  11907. case int32(m_XML_TOK_PREFIXED_NAME):
  11908. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist4)
  11909. return int32(_XML_ROLE_ATTRIBUTE_ENUM_VALUE)
  11910. }
  11911. return _common(tls, state, tok)
  11912. }
  11913. func _attlist4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11914. _ = ptr
  11915. _ = end
  11916. _ = enc
  11917. switch tok {
  11918. case int32(m_XML_TOK_PROLOG_S):
  11919. return int32(_XML_ROLE_ATTLIST_NONE)
  11920. case int32(m_XML_TOK_CLOSE_PAREN):
  11921. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist8)
  11922. return int32(_XML_ROLE_ATTLIST_NONE)
  11923. case int32(m_XML_TOK_OR):
  11924. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist3)
  11925. return int32(_XML_ROLE_ATTLIST_NONE)
  11926. }
  11927. return _common(tls, state, tok)
  11928. }
  11929. func _attlist5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11930. _ = ptr
  11931. _ = end
  11932. _ = enc
  11933. switch tok {
  11934. case int32(m_XML_TOK_PROLOG_S):
  11935. return int32(_XML_ROLE_ATTLIST_NONE)
  11936. case int32(m_XML_TOK_OPEN_PAREN):
  11937. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist6)
  11938. return int32(_XML_ROLE_ATTLIST_NONE)
  11939. }
  11940. return _common(tls, state, tok)
  11941. }
  11942. func _attlist6(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11943. _ = ptr
  11944. _ = end
  11945. _ = enc
  11946. switch tok {
  11947. case int32(m_XML_TOK_PROLOG_S):
  11948. return int32(_XML_ROLE_ATTLIST_NONE)
  11949. case int32(m_XML_TOK_NAME):
  11950. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist7)
  11951. return int32(_XML_ROLE_ATTRIBUTE_NOTATION_VALUE)
  11952. }
  11953. return _common(tls, state, tok)
  11954. }
  11955. func _attlist7(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11956. _ = ptr
  11957. _ = end
  11958. _ = enc
  11959. switch tok {
  11960. case int32(m_XML_TOK_PROLOG_S):
  11961. return int32(_XML_ROLE_ATTLIST_NONE)
  11962. case int32(m_XML_TOK_CLOSE_PAREN):
  11963. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist8)
  11964. return int32(_XML_ROLE_ATTLIST_NONE)
  11965. case int32(m_XML_TOK_OR):
  11966. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist6)
  11967. return int32(_XML_ROLE_ATTLIST_NONE)
  11968. }
  11969. return _common(tls, state, tok)
  11970. }
  11971. // C documentation
  11972. //
  11973. // /* default value */
  11974. func _attlist8(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11975. switch tok {
  11976. case int32(m_XML_TOK_PROLOG_S):
  11977. return int32(_XML_ROLE_ATTLIST_NONE)
  11978. case int32(m_XML_TOK_POUND_NAME):
  11979. 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 {
  11980. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  11981. return int32(_XML_ROLE_IMPLIED_ATTRIBUTE_VALUE)
  11982. }
  11983. 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 {
  11984. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  11985. return int32(_XML_ROLE_REQUIRED_ATTRIBUTE_VALUE)
  11986. }
  11987. 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 {
  11988. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist9)
  11989. return int32(_XML_ROLE_ATTLIST_NONE)
  11990. }
  11991. case int32(m_XML_TOK_LITERAL):
  11992. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  11993. return int32(_XML_ROLE_DEFAULT_ATTRIBUTE_VALUE)
  11994. }
  11995. return _common(tls, state, tok)
  11996. }
  11997. func _attlist9(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11998. _ = ptr
  11999. _ = end
  12000. _ = enc
  12001. switch tok {
  12002. case int32(m_XML_TOK_PROLOG_S):
  12003. return int32(_XML_ROLE_ATTLIST_NONE)
  12004. case int32(m_XML_TOK_LITERAL):
  12005. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  12006. return int32(_XML_ROLE_FIXED_ATTRIBUTE_VALUE)
  12007. }
  12008. return _common(tls, state, tok)
  12009. }
  12010. func _element0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12011. _ = ptr
  12012. _ = end
  12013. _ = enc
  12014. switch tok {
  12015. case int32(m_XML_TOK_PROLOG_S):
  12016. return int32(_XML_ROLE_ELEMENT_NONE)
  12017. case int32(m_XML_TOK_NAME):
  12018. fallthrough
  12019. case int32(m_XML_TOK_PREFIXED_NAME):
  12020. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element1)
  12021. return int32(_XML_ROLE_ELEMENT_NAME)
  12022. }
  12023. return _common(tls, state, tok)
  12024. }
  12025. func _element1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12026. switch tok {
  12027. case int32(m_XML_TOK_PROLOG_S):
  12028. return int32(_XML_ROLE_ELEMENT_NONE)
  12029. case int32(m_XML_TOK_NAME):
  12030. 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 {
  12031. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12032. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12033. return int32(_XML_ROLE_CONTENT_EMPTY)
  12034. }
  12035. 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 {
  12036. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12037. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12038. return int32(_XML_ROLE_CONTENT_ANY)
  12039. }
  12040. case int32(m_XML_TOK_OPEN_PAREN):
  12041. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element2)
  12042. (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel = uint32(1)
  12043. return int32(_XML_ROLE_GROUP_OPEN)
  12044. }
  12045. return _common(tls, state, tok)
  12046. }
  12047. func _element2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12048. switch tok {
  12049. case int32(m_XML_TOK_PROLOG_S):
  12050. return int32(_XML_ROLE_ELEMENT_NONE)
  12051. case int32(m_XML_TOK_POUND_NAME):
  12052. 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 {
  12053. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element3)
  12054. return int32(_XML_ROLE_CONTENT_PCDATA)
  12055. }
  12056. case int32(m_XML_TOK_OPEN_PAREN):
  12057. (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel = uint32(2)
  12058. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element6)
  12059. return int32(_XML_ROLE_GROUP_OPEN)
  12060. case int32(m_XML_TOK_NAME):
  12061. fallthrough
  12062. case int32(m_XML_TOK_PREFIXED_NAME):
  12063. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12064. return int32(_XML_ROLE_CONTENT_ELEMENT)
  12065. case int32(m_XML_TOK_NAME_QUESTION):
  12066. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12067. return int32(_XML_ROLE_CONTENT_ELEMENT_OPT)
  12068. case int32(m_XML_TOK_NAME_ASTERISK):
  12069. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12070. return int32(_XML_ROLE_CONTENT_ELEMENT_REP)
  12071. case int32(m_XML_TOK_NAME_PLUS):
  12072. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12073. return int32(_XML_ROLE_CONTENT_ELEMENT_PLUS)
  12074. }
  12075. return _common(tls, state, tok)
  12076. }
  12077. func _element3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12078. _ = ptr
  12079. _ = end
  12080. _ = enc
  12081. switch tok {
  12082. case int32(m_XML_TOK_PROLOG_S):
  12083. return int32(_XML_ROLE_ELEMENT_NONE)
  12084. case int32(m_XML_TOK_CLOSE_PAREN):
  12085. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12086. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12087. return int32(_XML_ROLE_GROUP_CLOSE)
  12088. case int32(m_XML_TOK_CLOSE_PAREN_ASTERISK):
  12089. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12090. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12091. return int32(_XML_ROLE_GROUP_CLOSE_REP)
  12092. case int32(m_XML_TOK_OR):
  12093. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element4)
  12094. return int32(_XML_ROLE_ELEMENT_NONE)
  12095. }
  12096. return _common(tls, state, tok)
  12097. }
  12098. func _element4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12099. _ = ptr
  12100. _ = end
  12101. _ = enc
  12102. switch tok {
  12103. case int32(m_XML_TOK_PROLOG_S):
  12104. return int32(_XML_ROLE_ELEMENT_NONE)
  12105. case int32(m_XML_TOK_NAME):
  12106. fallthrough
  12107. case int32(m_XML_TOK_PREFIXED_NAME):
  12108. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element5)
  12109. return int32(_XML_ROLE_CONTENT_ELEMENT)
  12110. }
  12111. return _common(tls, state, tok)
  12112. }
  12113. func _element5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12114. _ = ptr
  12115. _ = end
  12116. _ = enc
  12117. switch tok {
  12118. case int32(m_XML_TOK_PROLOG_S):
  12119. return int32(_XML_ROLE_ELEMENT_NONE)
  12120. case int32(m_XML_TOK_CLOSE_PAREN_ASTERISK):
  12121. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12122. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12123. return int32(_XML_ROLE_GROUP_CLOSE_REP)
  12124. case int32(m_XML_TOK_OR):
  12125. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element4)
  12126. return int32(_XML_ROLE_ELEMENT_NONE)
  12127. }
  12128. return _common(tls, state, tok)
  12129. }
  12130. func _element6(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12131. _ = ptr
  12132. _ = end
  12133. _ = enc
  12134. switch tok {
  12135. case int32(m_XML_TOK_PROLOG_S):
  12136. return int32(_XML_ROLE_ELEMENT_NONE)
  12137. case int32(m_XML_TOK_OPEN_PAREN):
  12138. *(*uint32)(unsafe.Pointer(state + 8)) += uint32(1)
  12139. return int32(_XML_ROLE_GROUP_OPEN)
  12140. case int32(m_XML_TOK_NAME):
  12141. fallthrough
  12142. case int32(m_XML_TOK_PREFIXED_NAME):
  12143. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12144. return int32(_XML_ROLE_CONTENT_ELEMENT)
  12145. case int32(m_XML_TOK_NAME_QUESTION):
  12146. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12147. return int32(_XML_ROLE_CONTENT_ELEMENT_OPT)
  12148. case int32(m_XML_TOK_NAME_ASTERISK):
  12149. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12150. return int32(_XML_ROLE_CONTENT_ELEMENT_REP)
  12151. case int32(m_XML_TOK_NAME_PLUS):
  12152. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12153. return int32(_XML_ROLE_CONTENT_ELEMENT_PLUS)
  12154. }
  12155. return _common(tls, state, tok)
  12156. }
  12157. func _element7(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12158. _ = ptr
  12159. _ = end
  12160. _ = enc
  12161. switch tok {
  12162. case int32(m_XML_TOK_PROLOG_S):
  12163. return int32(_XML_ROLE_ELEMENT_NONE)
  12164. case int32(m_XML_TOK_CLOSE_PAREN):
  12165. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  12166. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  12167. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12168. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12169. }
  12170. return int32(_XML_ROLE_GROUP_CLOSE)
  12171. case int32(m_XML_TOK_CLOSE_PAREN_ASTERISK):
  12172. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  12173. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  12174. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12175. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12176. }
  12177. return int32(_XML_ROLE_GROUP_CLOSE_REP)
  12178. case int32(m_XML_TOK_CLOSE_PAREN_QUESTION):
  12179. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  12180. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  12181. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12182. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12183. }
  12184. return int32(_XML_ROLE_GROUP_CLOSE_OPT)
  12185. case int32(m_XML_TOK_CLOSE_PAREN_PLUS):
  12186. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  12187. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  12188. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12189. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12190. }
  12191. return int32(_XML_ROLE_GROUP_CLOSE_PLUS)
  12192. case int32(m_XML_TOK_COMMA):
  12193. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element6)
  12194. return int32(_XML_ROLE_GROUP_SEQUENCE)
  12195. case int32(m_XML_TOK_OR):
  12196. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element6)
  12197. return int32(_XML_ROLE_GROUP_CHOICE)
  12198. }
  12199. return _common(tls, state, tok)
  12200. }
  12201. func _condSect0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12202. switch tok {
  12203. case int32(m_XML_TOK_PROLOG_S):
  12204. return int32(_XML_ROLE_NONE)
  12205. case int32(m_XML_TOK_NAME):
  12206. 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 {
  12207. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_condSect1)
  12208. return int32(_XML_ROLE_NONE)
  12209. }
  12210. 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 {
  12211. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_condSect2)
  12212. return int32(_XML_ROLE_NONE)
  12213. }
  12214. break
  12215. }
  12216. return _common(tls, state, tok)
  12217. }
  12218. func _condSect1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12219. _ = ptr
  12220. _ = end
  12221. _ = enc
  12222. switch tok {
  12223. case int32(m_XML_TOK_PROLOG_S):
  12224. return int32(_XML_ROLE_NONE)
  12225. case int32(m_XML_TOK_OPEN_BRACKET):
  12226. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset1)
  12227. *(*uint32)(unsafe.Pointer(state + 16)) += uint32(1)
  12228. return int32(_XML_ROLE_NONE)
  12229. }
  12230. return _common(tls, state, tok)
  12231. }
  12232. func _condSect2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12233. _ = ptr
  12234. _ = end
  12235. _ = enc
  12236. switch tok {
  12237. case int32(m_XML_TOK_PROLOG_S):
  12238. return int32(_XML_ROLE_NONE)
  12239. case int32(m_XML_TOK_OPEN_BRACKET):
  12240. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset1)
  12241. return int32(_XML_ROLE_IGNORE_SECT)
  12242. }
  12243. return _common(tls, state, tok)
  12244. }
  12245. func _declClose(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12246. var v1 uintptr
  12247. _ = v1
  12248. _ = ptr
  12249. _ = end
  12250. _ = enc
  12251. switch tok {
  12252. case int32(m_XML_TOK_PROLOG_S):
  12253. return (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none
  12254. case int32(m_XML_TOK_DECL_CLOSE):
  12255. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  12256. v1 = __ccgo_fp(_internalSubset)
  12257. } else {
  12258. v1 = __ccgo_fp(_externalSubset1)
  12259. }
  12260. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  12261. return (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none
  12262. }
  12263. return _common(tls, state, tok)
  12264. }
  12265. // C documentation
  12266. //
  12267. // /* This function will only be invoked if the internal logic of the
  12268. // * parser has broken down. It is used in two cases:
  12269. // *
  12270. // * 1: When the XML prolog has been finished. At this point the
  12271. // * processor (the parser level above these role handlers) should
  12272. // * switch from prologProcessor to contentProcessor and reinitialise
  12273. // * the handler function.
  12274. // *
  12275. // * 2: When an error has been detected (via common() below). At this
  12276. // * point again the processor should be switched to errorProcessor,
  12277. // * which will never call a handler.
  12278. // *
  12279. // * The result of this is that error() can only be called if the
  12280. // * processor switch failed to happen, which is an internal error and
  12281. // * therefore we shouldn't be able to provoke it simply by using the
  12282. // * library. It is a necessary backstop, however, so we merely exclude
  12283. // * it from the coverage statistics.
  12284. // *
  12285. // * LCOV_EXCL_START
  12286. // */
  12287. func _error(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12288. _ = state
  12289. _ = tok
  12290. _ = ptr
  12291. _ = end
  12292. _ = enc
  12293. return int32(_XML_ROLE_NONE)
  12294. }
  12295. /* LCOV_EXCL_STOP */
  12296. func _common(tls *libc.TLS, state uintptr, tok int32) (r int32) {
  12297. if !((*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0) && tok == int32(m_XML_TOK_PARAM_ENTITY_REF) {
  12298. return int32(_XML_ROLE_INNER_PARAM_ENTITY_REF)
  12299. }
  12300. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  12301. return int32(_XML_ROLE_ERROR)
  12302. }
  12303. func XXmlPrologStateInit(tls *libc.TLS, state uintptr) {
  12304. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog0)
  12305. (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity = int32(1)
  12306. (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel = uint32(0)
  12307. (*TPROLOG_STATE)(unsafe.Pointer(state)).FinEntityValue = 0
  12308. }
  12309. func XXmlPrologStateInitExternalEntity(tls *libc.TLS, state uintptr) {
  12310. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset0)
  12311. (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity = 0
  12312. (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel = uint32(0)
  12313. }
  12314. const m_ASCII_02 = 48
  12315. const m_ASCII_12 = 49
  12316. const m_ASCII_22 = 50
  12317. const m_ASCII_32 = 51
  12318. const m_ASCII_41 = 52
  12319. const m_ASCII_51 = 53
  12320. const m_ASCII_61 = 54
  12321. const m_ASCII_71 = 55
  12322. const m_ASCII_82 = 56
  12323. const m_ASCII_92 = 57
  12324. const m_ASCII_AMP1 = 38
  12325. const m_ASCII_APOS1 = 39
  12326. const m_ASCII_COLON2 = 58
  12327. const m_ASCII_EQUALS2 = 61
  12328. const m_ASCII_EXCL2 = 33
  12329. const m_ASCII_G2 = 0x47
  12330. const m_ASCII_GT1 = 62
  12331. const m_ASCII_K1 = 0x4B
  12332. const m_ASCII_LSQB1 = 91
  12333. const m_ASCII_LT1 = 60
  12334. const m_ASCII_MINUS1 = 45
  12335. const m_ASCII_N1 = 0x4E
  12336. const m_ASCII_P2 = 0x50
  12337. const m_ASCII_PERIOD2 = 46
  12338. const m_ASCII_Q2 = 0x51
  12339. const m_ASCII_QUOT1 = 34
  12340. const m_ASCII_R1 = 0x52
  12341. const m_ASCII_RSQB1 = 93
  12342. const m_ASCII_SEMI1 = 59
  12343. const m_ASCII_SPACE1 = 32
  12344. const m_ASCII_TAB1 = 9
  12345. const m_ASCII_UNDERSCORE1 = 95
  12346. const m_ASCII_Y1 = 0x59
  12347. const m_ASCII_Z1 = 90
  12348. const m_ASCII_a2 = 97
  12349. const m_ASCII_b1 = 98
  12350. const m_ASCII_c2 = 99
  12351. const m_ASCII_d1 = 100
  12352. const m_ASCII_e2 = 101
  12353. const m_ASCII_f1 = 102
  12354. const m_ASCII_g2 = 103
  12355. const m_ASCII_i1 = 105
  12356. const m_ASCII_l2 = 108
  12357. const m_ASCII_m2 = 109
  12358. const m_ASCII_n2 = 110
  12359. const m_ASCII_o2 = 111
  12360. const m_ASCII_p2 = 112
  12361. const m_ASCII_q1 = 113
  12362. const m_ASCII_r2 = 114
  12363. const m_ASCII_s2 = 115
  12364. const m_ASCII_t2 = 116
  12365. const m_ASCII_u1 = 117
  12366. const m_ASCII_v1 = 118
  12367. const m_ASCII_x2 = 120
  12368. const m_ASCII_y1 = 121
  12369. const m_ASCII_z1 = 122
  12370. const m_ENCODING_MAX = 128
  12371. const m___bool_true_false_are_defined = 1
  12372. const m_bool = "_Bool"
  12373. const m_false = 0
  12374. const m_true = 1
  12375. const m_utf8_isName4 = "isNever"
  12376. const m_utf8_isNmstrt4 = "isNever"
  12377. var _namingBitmap = [320]uint32{
  12378. 8: uint32(0xFFFFFFFF),
  12379. 9: uint32(0xFFFFFFFF),
  12380. 10: uint32(0xFFFFFFFF),
  12381. 11: uint32(0xFFFFFFFF),
  12382. 12: uint32(0xFFFFFFFF),
  12383. 13: uint32(0xFFFFFFFF),
  12384. 14: uint32(0xFFFFFFFF),
  12385. 15: uint32(0xFFFFFFFF),
  12386. 17: uint32(0x04000000),
  12387. 18: uint32(0x87FFFFFE),
  12388. 19: uint32(0x07FFFFFE),
  12389. 22: uint32(0xFF7FFFFF),
  12390. 23: uint32(0xFF7FFFFF),
  12391. 24: uint32(0xFFFFFFFF),
  12392. 25: uint32(0x7FF3FFFF),
  12393. 26: uint32(0xFFFFFDFE),
  12394. 27: uint32(0x7FFFFFFF),
  12395. 28: uint32(0xFFFFFFFF),
  12396. 29: uint32(0xFFFFFFFF),
  12397. 30: uint32(0xFFFFE00F),
  12398. 31: uint32(0xFC31FFFF),
  12399. 32: uint32(0x00FFFFFF),
  12400. 34: uint32(0xFFFF0000),
  12401. 35: uint32(0xFFFFFFFF),
  12402. 36: uint32(0xFFFFFFFF),
  12403. 37: uint32(0xF80001FF),
  12404. 38: uint32(0x00000003),
  12405. 44: uint32(0xFFFFD740),
  12406. 45: uint32(0xFFFFFFFB),
  12407. 46: uint32(0x547F7FFF),
  12408. 47: uint32(0x000FFFFD),
  12409. 48: uint32(0xFFFFDFFE),
  12410. 49: uint32(0xFFFFFFFF),
  12411. 50: uint32(0xDFFEFFFF),
  12412. 51: uint32(0xFFFFFFFF),
  12413. 52: uint32(0xFFFF0003),
  12414. 53: uint32(0xFFFFFFFF),
  12415. 54: uint32(0xFFFF199F),
  12416. 55: uint32(0x033FCFFF),
  12417. 57: uint32(0xFFFE0000),
  12418. 58: uint32(0x027FFFFF),
  12419. 59: uint32(0xFFFFFFFE),
  12420. 60: uint32(0x0000007F),
  12421. 62: uint32(0xFFFF0000),
  12422. 63: uint32(0x000707FF),
  12423. 65: uint32(0x07FFFFFE),
  12424. 66: uint32(0x000007FE),
  12425. 67: uint32(0xFFFE0000),
  12426. 68: uint32(0xFFFFFFFF),
  12427. 69: uint32(0x7CFFFFFF),
  12428. 70: uint32(0x002F7FFF),
  12429. 71: uint32(0x00000060),
  12430. 72: uint32(0xFFFFFFE0),
  12431. 73: uint32(0x23FFFFFF),
  12432. 74: uint32(0xFF000000),
  12433. 75: uint32(0x00000003),
  12434. 76: uint32(0xFFF99FE0),
  12435. 77: uint32(0x03C5FDFF),
  12436. 78: uint32(0xB0000000),
  12437. 79: uint32(0x00030003),
  12438. 80: uint32(0xFFF987E0),
  12439. 81: uint32(0x036DFDFF),
  12440. 82: uint32(0x5E000000),
  12441. 83: uint32(0x001C0000),
  12442. 84: uint32(0xFFFBAFE0),
  12443. 85: uint32(0x23EDFDFF),
  12444. 87: uint32(0x00000001),
  12445. 88: uint32(0xFFF99FE0),
  12446. 89: uint32(0x23CDFDFF),
  12447. 90: uint32(0xB0000000),
  12448. 91: uint32(0x00000003),
  12449. 92: uint32(0xD63DC7E0),
  12450. 93: uint32(0x03BFC718),
  12451. 96: uint32(0xFFFDDFE0),
  12452. 97: uint32(0x03EFFDFF),
  12453. 99: uint32(0x00000003),
  12454. 100: uint32(0xFFFDDFE0),
  12455. 101: uint32(0x03EFFDFF),
  12456. 102: uint32(0x40000000),
  12457. 103: uint32(0x00000003),
  12458. 104: uint32(0xFFFDDFE0),
  12459. 105: uint32(0x03FFFDFF),
  12460. 107: uint32(0x00000003),
  12461. 112: uint32(0xFFFFFFFE),
  12462. 113: uint32(0x000D7FFF),
  12463. 114: uint32(0x0000003F),
  12464. 116: uint32(0xFEF02596),
  12465. 117: uint32(0x200D6CAE),
  12466. 118: uint32(0x0000001F),
  12467. 122: uint32(0xFFFFFEFF),
  12468. 123: uint32(0x000003FF),
  12469. 133: uint32(0xFFFFFFFF),
  12470. 134: uint32(0xFFFF003F),
  12471. 135: uint32(0x007FFFFF),
  12472. 136: uint32(0x0007DAED),
  12473. 137: uint32(0x50000000),
  12474. 138: uint32(0x82315001),
  12475. 139: uint32(0x002C62AB),
  12476. 140: uint32(0x40000000),
  12477. 141: uint32(0xF580C900),
  12478. 142: uint32(0x00000007),
  12479. 143: uint32(0x02010800),
  12480. 144: uint32(0xFFFFFFFF),
  12481. 145: uint32(0xFFFFFFFF),
  12482. 146: uint32(0xFFFFFFFF),
  12483. 147: uint32(0xFFFFFFFF),
  12484. 148: uint32(0x0FFFFFFF),
  12485. 149: uint32(0xFFFFFFFF),
  12486. 150: uint32(0xFFFFFFFF),
  12487. 151: uint32(0x03FFFFFF),
  12488. 152: uint32(0x3F3FFFFF),
  12489. 153: uint32(0xFFFFFFFF),
  12490. 154: uint32(0xAAFF3F3F),
  12491. 155: uint32(0x3FFFFFFF),
  12492. 156: uint32(0xFFFFFFFF),
  12493. 157: uint32(0x5FDFFFFF),
  12494. 158: uint32(0x0FCF1FDC),
  12495. 159: uint32(0x1FDC1FFF),
  12496. 161: uint32(0x00004C40),
  12497. 164: uint32(0x00000007),
  12498. 168: uint32(0x00000080),
  12499. 169: uint32(0x000003FE),
  12500. 170: uint32(0xFFFFFFFE),
  12501. 171: uint32(0xFFFFFFFF),
  12502. 172: uint32(0x001FFFFF),
  12503. 173: uint32(0xFFFFFFFE),
  12504. 174: uint32(0xFFFFFFFF),
  12505. 175: uint32(0x07FFFFFF),
  12506. 176: uint32(0xFFFFFFE0),
  12507. 177: uint32(0x00001FFF),
  12508. 184: uint32(0xFFFFFFFF),
  12509. 185: uint32(0xFFFFFFFF),
  12510. 186: uint32(0xFFFFFFFF),
  12511. 187: uint32(0xFFFFFFFF),
  12512. 188: uint32(0xFFFFFFFF),
  12513. 189: uint32(0x0000003F),
  12514. 192: uint32(0xFFFFFFFF),
  12515. 193: uint32(0xFFFFFFFF),
  12516. 194: uint32(0xFFFFFFFF),
  12517. 195: uint32(0xFFFFFFFF),
  12518. 196: uint32(0xFFFFFFFF),
  12519. 197: uint32(0x0000000F),
  12520. 201: uint32(0x07FF6000),
  12521. 202: uint32(0x87FFFFFE),
  12522. 203: uint32(0x07FFFFFE),
  12523. 205: uint32(0x00800000),
  12524. 206: uint32(0xFF7FFFFF),
  12525. 207: uint32(0xFF7FFFFF),
  12526. 208: uint32(0x00FFFFFF),
  12527. 210: uint32(0xFFFF0000),
  12528. 211: uint32(0xFFFFFFFF),
  12529. 212: uint32(0xFFFFFFFF),
  12530. 213: uint32(0xF80001FF),
  12531. 214: uint32(0x00030003),
  12532. 216: uint32(0xFFFFFFFF),
  12533. 217: uint32(0xFFFFFFFF),
  12534. 218: uint32(0x0000003F),
  12535. 219: uint32(0x00000003),
  12536. 220: uint32(0xFFFFD7C0),
  12537. 221: uint32(0xFFFFFFFB),
  12538. 222: uint32(0x547F7FFF),
  12539. 223: uint32(0x000FFFFD),
  12540. 224: uint32(0xFFFFDFFE),
  12541. 225: uint32(0xFFFFFFFF),
  12542. 226: uint32(0xDFFEFFFF),
  12543. 227: uint32(0xFFFFFFFF),
  12544. 228: uint32(0xFFFF007B),
  12545. 229: uint32(0xFFFFFFFF),
  12546. 230: uint32(0xFFFF199F),
  12547. 231: uint32(0x033FCFFF),
  12548. 233: uint32(0xFFFE0000),
  12549. 234: uint32(0x027FFFFF),
  12550. 235: uint32(0xFFFFFFFE),
  12551. 236: uint32(0xFFFE007F),
  12552. 237: uint32(0xBBFFFFFB),
  12553. 238: uint32(0xFFFF0016),
  12554. 239: uint32(0x000707FF),
  12555. 241: uint32(0x07FFFFFE),
  12556. 242: uint32(0x0007FFFF),
  12557. 243: uint32(0xFFFF03FF),
  12558. 244: uint32(0xFFFFFFFF),
  12559. 245: uint32(0x7CFFFFFF),
  12560. 246: uint32(0xFFEF7FFF),
  12561. 247: uint32(0x03FF3DFF),
  12562. 248: uint32(0xFFFFFFEE),
  12563. 249: uint32(0xF3FFFFFF),
  12564. 250: uint32(0xFF1E3FFF),
  12565. 251: uint32(0x0000FFCF),
  12566. 252: uint32(0xFFF99FEE),
  12567. 253: uint32(0xD3C5FDFF),
  12568. 254: uint32(0xB080399F),
  12569. 255: uint32(0x0003FFCF),
  12570. 256: uint32(0xFFF987E4),
  12571. 257: uint32(0xD36DFDFF),
  12572. 258: uint32(0x5E003987),
  12573. 259: uint32(0x001FFFC0),
  12574. 260: uint32(0xFFFBAFEE),
  12575. 261: uint32(0xF3EDFDFF),
  12576. 262: uint32(0x00003BBF),
  12577. 263: uint32(0x0000FFC1),
  12578. 264: uint32(0xFFF99FEE),
  12579. 265: uint32(0xF3CDFDFF),
  12580. 266: uint32(0xB0C0398F),
  12581. 267: uint32(0x0000FFC3),
  12582. 268: uint32(0xD63DC7EC),
  12583. 269: uint32(0xC3BFC718),
  12584. 270: uint32(0x00803DC7),
  12585. 271: uint32(0x0000FF80),
  12586. 272: uint32(0xFFFDDFEE),
  12587. 273: uint32(0xC3EFFDFF),
  12588. 274: uint32(0x00603DDF),
  12589. 275: uint32(0x0000FFC3),
  12590. 276: uint32(0xFFFDDFEC),
  12591. 277: uint32(0xC3EFFDFF),
  12592. 278: uint32(0x40603DDF),
  12593. 279: uint32(0x0000FFC3),
  12594. 280: uint32(0xFFFDDFEC),
  12595. 281: uint32(0xC3FFFDFF),
  12596. 282: uint32(0x00803DCF),
  12597. 283: uint32(0x0000FFC3),
  12598. 288: uint32(0xFFFFFFFE),
  12599. 289: uint32(0x07FF7FFF),
  12600. 290: uint32(0x03FF7FFF),
  12601. 292: uint32(0xFEF02596),
  12602. 293: uint32(0x3BFF6CAE),
  12603. 294: uint32(0x03FF3F5F),
  12604. 296: uint32(0x03000000),
  12605. 297: uint32(0xC2A003FF),
  12606. 298: uint32(0xFFFFFEFF),
  12607. 299: uint32(0xFFFE03FF),
  12608. 300: uint32(0xFEBF0FDF),
  12609. 301: uint32(0x02FE3FFF),
  12610. 310: uint32(0x1FFF0000),
  12611. 311: uint32(0x00000002),
  12612. 312: uint32(0x000000A0),
  12613. 313: uint32(0x003EFFFE),
  12614. 314: uint32(0xFFFFFFFE),
  12615. 315: uint32(0xFFFFFFFF),
  12616. 316: uint32(0x661FFFFF),
  12617. 317: uint32(0xFFFFFFFE),
  12618. 318: uint32(0xFFFFFFFF),
  12619. 319: uint32(0x77FFFFFF),
  12620. }
  12621. var _nmstrtPages = [256]uint8{
  12622. 0: uint8(0x02),
  12623. 1: uint8(0x03),
  12624. 2: uint8(0x04),
  12625. 3: uint8(0x05),
  12626. 4: uint8(0x06),
  12627. 5: uint8(0x07),
  12628. 6: uint8(0x08),
  12629. 9: uint8(0x09),
  12630. 10: uint8(0x0A),
  12631. 11: uint8(0x0B),
  12632. 12: uint8(0x0C),
  12633. 13: uint8(0x0D),
  12634. 14: uint8(0x0E),
  12635. 15: uint8(0x0F),
  12636. 16: uint8(0x10),
  12637. 17: uint8(0x11),
  12638. 30: uint8(0x12),
  12639. 31: uint8(0x13),
  12640. 33: uint8(0x14),
  12641. 48: uint8(0x15),
  12642. 49: uint8(0x16),
  12643. 78: uint8(0x01),
  12644. 79: uint8(0x01),
  12645. 80: uint8(0x01),
  12646. 81: uint8(0x01),
  12647. 82: uint8(0x01),
  12648. 83: uint8(0x01),
  12649. 84: uint8(0x01),
  12650. 85: uint8(0x01),
  12651. 86: uint8(0x01),
  12652. 87: uint8(0x01),
  12653. 88: uint8(0x01),
  12654. 89: uint8(0x01),
  12655. 90: uint8(0x01),
  12656. 91: uint8(0x01),
  12657. 92: uint8(0x01),
  12658. 93: uint8(0x01),
  12659. 94: uint8(0x01),
  12660. 95: uint8(0x01),
  12661. 96: uint8(0x01),
  12662. 97: uint8(0x01),
  12663. 98: uint8(0x01),
  12664. 99: uint8(0x01),
  12665. 100: uint8(0x01),
  12666. 101: uint8(0x01),
  12667. 102: uint8(0x01),
  12668. 103: uint8(0x01),
  12669. 104: uint8(0x01),
  12670. 105: uint8(0x01),
  12671. 106: uint8(0x01),
  12672. 107: uint8(0x01),
  12673. 108: uint8(0x01),
  12674. 109: uint8(0x01),
  12675. 110: uint8(0x01),
  12676. 111: uint8(0x01),
  12677. 112: uint8(0x01),
  12678. 113: uint8(0x01),
  12679. 114: uint8(0x01),
  12680. 115: uint8(0x01),
  12681. 116: uint8(0x01),
  12682. 117: uint8(0x01),
  12683. 118: uint8(0x01),
  12684. 119: uint8(0x01),
  12685. 120: uint8(0x01),
  12686. 121: uint8(0x01),
  12687. 122: uint8(0x01),
  12688. 123: uint8(0x01),
  12689. 124: uint8(0x01),
  12690. 125: uint8(0x01),
  12691. 126: uint8(0x01),
  12692. 127: uint8(0x01),
  12693. 128: uint8(0x01),
  12694. 129: uint8(0x01),
  12695. 130: uint8(0x01),
  12696. 131: uint8(0x01),
  12697. 132: uint8(0x01),
  12698. 133: uint8(0x01),
  12699. 134: uint8(0x01),
  12700. 135: uint8(0x01),
  12701. 136: uint8(0x01),
  12702. 137: uint8(0x01),
  12703. 138: uint8(0x01),
  12704. 139: uint8(0x01),
  12705. 140: uint8(0x01),
  12706. 141: uint8(0x01),
  12707. 142: uint8(0x01),
  12708. 143: uint8(0x01),
  12709. 144: uint8(0x01),
  12710. 145: uint8(0x01),
  12711. 146: uint8(0x01),
  12712. 147: uint8(0x01),
  12713. 148: uint8(0x01),
  12714. 149: uint8(0x01),
  12715. 150: uint8(0x01),
  12716. 151: uint8(0x01),
  12717. 152: uint8(0x01),
  12718. 153: uint8(0x01),
  12719. 154: uint8(0x01),
  12720. 155: uint8(0x01),
  12721. 156: uint8(0x01),
  12722. 157: uint8(0x01),
  12723. 158: uint8(0x01),
  12724. 159: uint8(0x17),
  12725. 172: uint8(0x01),
  12726. 173: uint8(0x01),
  12727. 174: uint8(0x01),
  12728. 175: uint8(0x01),
  12729. 176: uint8(0x01),
  12730. 177: uint8(0x01),
  12731. 178: uint8(0x01),
  12732. 179: uint8(0x01),
  12733. 180: uint8(0x01),
  12734. 181: uint8(0x01),
  12735. 182: uint8(0x01),
  12736. 183: uint8(0x01),
  12737. 184: uint8(0x01),
  12738. 185: uint8(0x01),
  12739. 186: uint8(0x01),
  12740. 187: uint8(0x01),
  12741. 188: uint8(0x01),
  12742. 189: uint8(0x01),
  12743. 190: uint8(0x01),
  12744. 191: uint8(0x01),
  12745. 192: uint8(0x01),
  12746. 193: uint8(0x01),
  12747. 194: uint8(0x01),
  12748. 195: uint8(0x01),
  12749. 196: uint8(0x01),
  12750. 197: uint8(0x01),
  12751. 198: uint8(0x01),
  12752. 199: uint8(0x01),
  12753. 200: uint8(0x01),
  12754. 201: uint8(0x01),
  12755. 202: uint8(0x01),
  12756. 203: uint8(0x01),
  12757. 204: uint8(0x01),
  12758. 205: uint8(0x01),
  12759. 206: uint8(0x01),
  12760. 207: uint8(0x01),
  12761. 208: uint8(0x01),
  12762. 209: uint8(0x01),
  12763. 210: uint8(0x01),
  12764. 211: uint8(0x01),
  12765. 212: uint8(0x01),
  12766. 213: uint8(0x01),
  12767. 214: uint8(0x01),
  12768. 215: uint8(0x18),
  12769. }
  12770. var _namePages = [256]uint8{
  12771. 0: uint8(0x19),
  12772. 1: uint8(0x03),
  12773. 2: uint8(0x1A),
  12774. 3: uint8(0x1B),
  12775. 4: uint8(0x1C),
  12776. 5: uint8(0x1D),
  12777. 6: uint8(0x1E),
  12778. 9: uint8(0x1F),
  12779. 10: uint8(0x20),
  12780. 11: uint8(0x21),
  12781. 12: uint8(0x22),
  12782. 13: uint8(0x23),
  12783. 14: uint8(0x24),
  12784. 15: uint8(0x25),
  12785. 16: uint8(0x10),
  12786. 17: uint8(0x11),
  12787. 30: uint8(0x12),
  12788. 31: uint8(0x13),
  12789. 32: uint8(0x26),
  12790. 33: uint8(0x14),
  12791. 48: uint8(0x27),
  12792. 49: uint8(0x16),
  12793. 78: uint8(0x01),
  12794. 79: uint8(0x01),
  12795. 80: uint8(0x01),
  12796. 81: uint8(0x01),
  12797. 82: uint8(0x01),
  12798. 83: uint8(0x01),
  12799. 84: uint8(0x01),
  12800. 85: uint8(0x01),
  12801. 86: uint8(0x01),
  12802. 87: uint8(0x01),
  12803. 88: uint8(0x01),
  12804. 89: uint8(0x01),
  12805. 90: uint8(0x01),
  12806. 91: uint8(0x01),
  12807. 92: uint8(0x01),
  12808. 93: uint8(0x01),
  12809. 94: uint8(0x01),
  12810. 95: uint8(0x01),
  12811. 96: uint8(0x01),
  12812. 97: uint8(0x01),
  12813. 98: uint8(0x01),
  12814. 99: uint8(0x01),
  12815. 100: uint8(0x01),
  12816. 101: uint8(0x01),
  12817. 102: uint8(0x01),
  12818. 103: uint8(0x01),
  12819. 104: uint8(0x01),
  12820. 105: uint8(0x01),
  12821. 106: uint8(0x01),
  12822. 107: uint8(0x01),
  12823. 108: uint8(0x01),
  12824. 109: uint8(0x01),
  12825. 110: uint8(0x01),
  12826. 111: uint8(0x01),
  12827. 112: uint8(0x01),
  12828. 113: uint8(0x01),
  12829. 114: uint8(0x01),
  12830. 115: uint8(0x01),
  12831. 116: uint8(0x01),
  12832. 117: uint8(0x01),
  12833. 118: uint8(0x01),
  12834. 119: uint8(0x01),
  12835. 120: uint8(0x01),
  12836. 121: uint8(0x01),
  12837. 122: uint8(0x01),
  12838. 123: uint8(0x01),
  12839. 124: uint8(0x01),
  12840. 125: uint8(0x01),
  12841. 126: uint8(0x01),
  12842. 127: uint8(0x01),
  12843. 128: uint8(0x01),
  12844. 129: uint8(0x01),
  12845. 130: uint8(0x01),
  12846. 131: uint8(0x01),
  12847. 132: uint8(0x01),
  12848. 133: uint8(0x01),
  12849. 134: uint8(0x01),
  12850. 135: uint8(0x01),
  12851. 136: uint8(0x01),
  12852. 137: uint8(0x01),
  12853. 138: uint8(0x01),
  12854. 139: uint8(0x01),
  12855. 140: uint8(0x01),
  12856. 141: uint8(0x01),
  12857. 142: uint8(0x01),
  12858. 143: uint8(0x01),
  12859. 144: uint8(0x01),
  12860. 145: uint8(0x01),
  12861. 146: uint8(0x01),
  12862. 147: uint8(0x01),
  12863. 148: uint8(0x01),
  12864. 149: uint8(0x01),
  12865. 150: uint8(0x01),
  12866. 151: uint8(0x01),
  12867. 152: uint8(0x01),
  12868. 153: uint8(0x01),
  12869. 154: uint8(0x01),
  12870. 155: uint8(0x01),
  12871. 156: uint8(0x01),
  12872. 157: uint8(0x01),
  12873. 158: uint8(0x01),
  12874. 159: uint8(0x17),
  12875. 172: uint8(0x01),
  12876. 173: uint8(0x01),
  12877. 174: uint8(0x01),
  12878. 175: uint8(0x01),
  12879. 176: uint8(0x01),
  12880. 177: uint8(0x01),
  12881. 178: uint8(0x01),
  12882. 179: uint8(0x01),
  12883. 180: uint8(0x01),
  12884. 181: uint8(0x01),
  12885. 182: uint8(0x01),
  12886. 183: uint8(0x01),
  12887. 184: uint8(0x01),
  12888. 185: uint8(0x01),
  12889. 186: uint8(0x01),
  12890. 187: uint8(0x01),
  12891. 188: uint8(0x01),
  12892. 189: uint8(0x01),
  12893. 190: uint8(0x01),
  12894. 191: uint8(0x01),
  12895. 192: uint8(0x01),
  12896. 193: uint8(0x01),
  12897. 194: uint8(0x01),
  12898. 195: uint8(0x01),
  12899. 196: uint8(0x01),
  12900. 197: uint8(0x01),
  12901. 198: uint8(0x01),
  12902. 199: uint8(0x01),
  12903. 200: uint8(0x01),
  12904. 201: uint8(0x01),
  12905. 202: uint8(0x01),
  12906. 203: uint8(0x01),
  12907. 204: uint8(0x01),
  12908. 205: uint8(0x01),
  12909. 206: uint8(0x01),
  12910. 207: uint8(0x01),
  12911. 208: uint8(0x01),
  12912. 209: uint8(0x01),
  12913. 210: uint8(0x01),
  12914. 211: uint8(0x01),
  12915. 212: uint8(0x01),
  12916. 213: uint8(0x01),
  12917. 214: uint8(0x01),
  12918. 215: uint8(0x18),
  12919. }
  12920. /* A 2 byte UTF-8 representation splits the characters 11 bits between
  12921. the bottom 5 and 6 bits of the bytes. We need 8 bits to index into
  12922. pages, 3 bits to add to that index and 5 bits to generate the mask.
  12923. */
  12924. /* A 3 byte UTF-8 representation splits the characters 16 bits between
  12925. the bottom 4, 6 and 6 bits of the bytes. We need 8 bits to index
  12926. into pages, 3 bits to add to that index and 5 bits to generate the
  12927. mask.
  12928. */
  12929. /* Detection of invalid UTF-8 sequences is based on Table 3.1B
  12930. of Unicode 3.2: http://www.unicode.org/unicode/reports/tr28/
  12931. with the additional restriction of not allowing the Unicode
  12932. code points 0xFFFF and 0xFFFE (sequences EF,BF,BF and EF,BF,BE).
  12933. Implementation details:
  12934. (A & 0x80) == 0 means A < 0x80
  12935. and
  12936. (A & 0xC0) == 0xC0 means A > 0xBF
  12937. */
  12938. func _isNever(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  12939. _ = enc
  12940. _ = p
  12941. return 0
  12942. }
  12943. func _utf8_isName2(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  12944. _ = enc
  12945. 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))))
  12946. }
  12947. func _utf8_isName3(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  12948. _ = enc
  12949. 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))))
  12950. }
  12951. func _utf8_isNmstrt2(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  12952. _ = enc
  12953. 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))))
  12954. }
  12955. func _utf8_isNmstrt3(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  12956. _ = enc
  12957. 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))))
  12958. }
  12959. func _utf8_isInvalid2(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  12960. _ = enc
  12961. 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))
  12962. }
  12963. func _utf8_isInvalid3(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  12964. var v1, v3, v4 int32
  12965. var v2, v5, v6 bool
  12966. _, _, _, _, _, _ = v1, v2, v3, v4, v5, v6
  12967. _ = enc
  12968. if v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2)))&int32(0x80) == 0; !v2 {
  12969. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xEF) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) == int32(0xBF) {
  12970. v1 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2))) > int32(0xBD))
  12971. } else {
  12972. v1 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2)))&int32(0xC0) == int32(0xC0))
  12973. }
  12974. }
  12975. if v6 = v2 || v1 != 0; !v6 {
  12976. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xE0) {
  12977. v3 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) < int32(0xA0) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  12978. } else {
  12979. if v5 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0x80) == 0; !v5 {
  12980. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xED) {
  12981. v4 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) > int32(0x9F))
  12982. } else {
  12983. v4 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  12984. }
  12985. }
  12986. v3 = libc.BoolInt32(v5 || v4 != 0)
  12987. }
  12988. }
  12989. return libc.BoolInt32(v6 || v3 != 0)
  12990. }
  12991. func _utf8_isInvalid4(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  12992. var v1, v2 int32
  12993. var v3, v4 bool
  12994. _, _, _, _ = v1, v2, v3, v4
  12995. _ = enc
  12996. 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 {
  12997. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xF0) {
  12998. v1 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) < int32(0x90) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  12999. } else {
  13000. if v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0x80) == 0; !v3 {
  13001. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xF4) {
  13002. v2 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) > int32(0x8F))
  13003. } else {
  13004. v2 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  13005. }
  13006. }
  13007. v1 = libc.BoolInt32(v3 || v2 != 0)
  13008. }
  13009. }
  13010. return libc.BoolInt32(v4 || v1 != 0)
  13011. }
  13012. type Tnormal_encoding = struct {
  13013. Fenc TENCODING
  13014. Ftype1 [256]uint8
  13015. FisName2 uintptr
  13016. FisName3 uintptr
  13017. FisName4 uintptr
  13018. FisNmstrt2 uintptr
  13019. FisNmstrt3 uintptr
  13020. FisNmstrt4 uintptr
  13021. FisInvalid2 uintptr
  13022. FisInvalid3 uintptr
  13023. FisInvalid4 uintptr
  13024. }
  13025. const _BT_NONXML = 0
  13026. const _BT_MALFORM = 1
  13027. const _BT_LT = 2
  13028. const _BT_AMP = 3
  13029. const _BT_RSQB = 4
  13030. const _BT_LEAD2 = 5
  13031. const _BT_LEAD3 = 6
  13032. const _BT_LEAD4 = 7
  13033. const _BT_TRAIL = 8
  13034. const _BT_CR = 9
  13035. const _BT_LF = 10
  13036. const _BT_GT = 11
  13037. const _BT_QUOT = 12
  13038. const _BT_APOS = 13
  13039. const _BT_EQUALS = 14
  13040. const _BT_QUEST = 15
  13041. const _BT_EXCL = 16
  13042. const _BT_SOL = 17
  13043. const _BT_SEMI = 18
  13044. const _BT_NUM = 19
  13045. const _BT_LSQB = 20
  13046. const _BT_S = 21
  13047. const _BT_NMSTRT = 22
  13048. const _BT_COLON = 23
  13049. const _BT_HEX = 24
  13050. const _BT_DIGIT = 25
  13051. const _BT_NAME = 26
  13052. const _BT_MINUS = 27
  13053. const _BT_OTHER = 28
  13054. const _BT_NONASCII = 29
  13055. const _BT_PERCNT = 30
  13056. const _BT_LPAR = 31
  13057. const _BT_RPAR = 32
  13058. const _BT_AST = 33
  13059. const _BT_PLUS = 34
  13060. const _BT_COMMA = 35
  13061. const _BT_VERBAR = 36
  13062. /*
  13063. __ __ _
  13064. ___\ \/ /_ __ __ _| |_
  13065. / _ \\ /| '_ \ / _` | __|
  13066. | __// \| |_) | (_| | |_
  13067. \___/_/\_\ .__/ \__,_|\__|
  13068. |_| XML parser
  13069. Copyright (c) 1999-2000 Thai Open Source Software Center Ltd
  13070. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  13071. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  13072. Copyright (c) 2007 Karl Waclawek <karl@waclawek.net>
  13073. Copyright (c) 2017 Sebastian Pipping <sebastian@pipping.org>
  13074. Licensed under the MIT license:
  13075. Permission is hereby granted, free of charge, to any person obtaining
  13076. a copy of this software and associated documentation files (the
  13077. "Software"), to deal in the Software without restriction, including
  13078. without limitation the rights to use, copy, modify, merge, publish,
  13079. distribute, sublicense, and/or sell copies of the Software, and to permit
  13080. persons to whom the Software is furnished to do so, subject to the
  13081. following conditions:
  13082. The above copyright notice and this permission notice shall be included
  13083. in all copies or substantial portions of the Software.
  13084. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  13085. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  13086. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  13087. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  13088. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  13089. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  13090. USE OR OTHER DEALINGS IN THE SOFTWARE.
  13091. */
  13092. /* minimum bytes per character */
  13093. /* c is an ASCII character */
  13094. /* This file is included (from xmltok.c, 1-3 times depending on XML_MIN_SIZE)!
  13095. __ __ _
  13096. ___\ \/ /_ __ __ _| |_
  13097. / _ \\ /| '_ \ / _` | __|
  13098. | __// \| |_) | (_| | |_
  13099. \___/_/\_\ .__/ \__,_|\__|
  13100. |_| XML parser
  13101. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  13102. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  13103. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  13104. Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
  13105. Copyright (c) 2016-2022 Sebastian Pipping <sebastian@pipping.org>
  13106. Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
  13107. Copyright (c) 2018 Benjamin Peterson <benjamin@python.org>
  13108. Copyright (c) 2018 Anton Maklakov <antmak.pub@gmail.com>
  13109. Copyright (c) 2019 David Loffredo <loffredo@steptools.com>
  13110. Copyright (c) 2020 Boris Kolpackov <boris@codesynthesis.com>
  13111. Copyright (c) 2022 Martin Ettl <ettl.martin78@googlemail.com>
  13112. Licensed under the MIT license:
  13113. Permission is hereby granted, free of charge, to any person obtaining
  13114. a copy of this software and associated documentation files (the
  13115. "Software"), to deal in the Software without restriction, including
  13116. without limitation the rights to use, copy, modify, merge, publish,
  13117. distribute, sublicense, and/or sell copies of the Software, and to permit
  13118. persons to whom the Software is furnished to do so, subject to the
  13119. following conditions:
  13120. The above copyright notice and this permission notice shall be included
  13121. in all copies or substantial portions of the Software.
  13122. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  13123. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  13124. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  13125. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  13126. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  13127. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  13128. USE OR OTHER DEALINGS IN THE SOFTWARE.
  13129. */
  13130. /* ptr points to character following "<!-" */
  13131. func _normal_scanComment(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13132. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13133. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_MINUS1)) {
  13134. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13135. return m_XML_TOK_INVALID
  13136. }
  13137. ptr += uintptr(1)
  13138. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13139. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13140. case int32(_BT_LEAD2):
  13141. if int64(end)-int64(ptr) < int64(2) {
  13142. return -int32(2)
  13143. }
  13144. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  13145. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13146. return m_XML_TOK_INVALID
  13147. }
  13148. ptr += uintptr(2)
  13149. case int32(_BT_LEAD3):
  13150. if int64(end)-int64(ptr) < int64(3) {
  13151. return -int32(2)
  13152. }
  13153. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  13154. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13155. return m_XML_TOK_INVALID
  13156. }
  13157. ptr += uintptr(3)
  13158. case int32(_BT_LEAD4):
  13159. if int64(end)-int64(ptr) < int64(4) {
  13160. return -int32(2)
  13161. }
  13162. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  13163. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13164. return m_XML_TOK_INVALID
  13165. }
  13166. ptr += uintptr(4)
  13167. case int32(_BT_NONXML):
  13168. fallthrough
  13169. case int32(_BT_MALFORM):
  13170. fallthrough
  13171. case int32(_BT_TRAIL):
  13172. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13173. return m_XML_TOK_INVALID
  13174. case int32(_BT_MINUS):
  13175. ptr += uintptr(1)
  13176. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13177. return -int32(1)
  13178. }
  13179. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_MINUS1) {
  13180. ptr += uintptr(1)
  13181. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13182. return -int32(1)
  13183. }
  13184. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  13185. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13186. return m_XML_TOK_INVALID
  13187. }
  13188. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13189. return int32(m_XML_TOK_COMMENT)
  13190. }
  13191. default:
  13192. ptr += uintptr(1)
  13193. break
  13194. }
  13195. }
  13196. }
  13197. return -int32(1)
  13198. }
  13199. /* ptr points to character following "<!" */
  13200. func _normal_scanDecl(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13201. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13202. return -int32(1)
  13203. }
  13204. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13205. case int32(_BT_MINUS):
  13206. return _normal_scanComment(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  13207. case int32(_BT_LSQB):
  13208. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13209. return int32(m_XML_TOK_COND_SECT_OPEN)
  13210. case int32(_BT_NMSTRT):
  13211. fallthrough
  13212. case int32(_BT_HEX):
  13213. ptr += uintptr(1)
  13214. default:
  13215. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13216. return m_XML_TOK_INVALID
  13217. }
  13218. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13219. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13220. case int32(_BT_PERCNT):
  13221. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))) {
  13222. return -int32(1)
  13223. }
  13224. /* don't allow <!ENTITY% foo "whatever"> */
  13225. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))))))) {
  13226. case int32(_BT_S):
  13227. fallthrough
  13228. case int32(_BT_CR):
  13229. fallthrough
  13230. case int32(_BT_LF):
  13231. fallthrough
  13232. case int32(_BT_PERCNT):
  13233. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13234. return m_XML_TOK_INVALID
  13235. }
  13236. /* fall through */
  13237. fallthrough
  13238. case int32(_BT_S):
  13239. fallthrough
  13240. case int32(_BT_CR):
  13241. fallthrough
  13242. case int32(_BT_LF):
  13243. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13244. return int32(m_XML_TOK_DECL_OPEN)
  13245. case int32(_BT_NMSTRT):
  13246. fallthrough
  13247. case int32(_BT_HEX):
  13248. ptr += uintptr(1)
  13249. default:
  13250. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13251. return m_XML_TOK_INVALID
  13252. }
  13253. }
  13254. return -int32(1)
  13255. }
  13256. func _normal_checkPiTarget(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, tokPtr uintptr) (r int32) {
  13257. var upper int32
  13258. _ = upper
  13259. upper = 0
  13260. _ = enc
  13261. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_PI)
  13262. if int64(end)-int64(ptr) != int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(3)) {
  13263. return int32(1)
  13264. }
  13265. switch int32(*(*int8)(unsafe.Pointer(ptr))) {
  13266. case int32(m_ASCII_x2):
  13267. case int32(m_ASCII_X):
  13268. upper = int32(1)
  13269. default:
  13270. return int32(1)
  13271. }
  13272. ptr += uintptr(1)
  13273. switch int32(*(*int8)(unsafe.Pointer(ptr))) {
  13274. case int32(m_ASCII_m2):
  13275. case int32(m_ASCII_M):
  13276. upper = int32(1)
  13277. default:
  13278. return int32(1)
  13279. }
  13280. ptr += uintptr(1)
  13281. switch int32(*(*int8)(unsafe.Pointer(ptr))) {
  13282. case int32(m_ASCII_l2):
  13283. case int32(m_ASCII_L):
  13284. upper = int32(1)
  13285. default:
  13286. return int32(1)
  13287. }
  13288. if upper != 0 {
  13289. return 0
  13290. }
  13291. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_XML_DECL)
  13292. return int32(1)
  13293. }
  13294. /* ptr points to character following "<?" */
  13295. func _normal_scanPi(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13296. bp := tls.Alloc(16)
  13297. defer tls.Free(16)
  13298. var target uintptr
  13299. var _ /* tok at bp+0 */ int32
  13300. _ = target
  13301. target = ptr
  13302. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13303. return -int32(1)
  13304. }
  13305. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13306. case int32(_BT_NONASCII):
  13307. if !(libc.Int32FromInt32(0) != 0) {
  13308. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13309. return m_XML_TOK_INVALID
  13310. } /* fall through */
  13311. fallthrough
  13312. case int32(_BT_NMSTRT):
  13313. fallthrough
  13314. case int32(_BT_HEX):
  13315. ptr += uintptr(1)
  13316. case int32(_BT_LEAD2):
  13317. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  13318. return -int32(2)
  13319. }
  13320. 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) {
  13321. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13322. return m_XML_TOK_INVALID
  13323. }
  13324. ptr += uintptr(2)
  13325. case int32(_BT_LEAD3):
  13326. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  13327. return -int32(2)
  13328. }
  13329. 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) {
  13330. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13331. return m_XML_TOK_INVALID
  13332. }
  13333. ptr += uintptr(3)
  13334. case int32(_BT_LEAD4):
  13335. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  13336. return -int32(2)
  13337. }
  13338. 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) {
  13339. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13340. return m_XML_TOK_INVALID
  13341. }
  13342. ptr += uintptr(4)
  13343. default:
  13344. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13345. return m_XML_TOK_INVALID
  13346. }
  13347. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13348. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13349. case int32(_BT_NONASCII):
  13350. if !(libc.Int32FromInt32(0) != 0) {
  13351. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13352. return m_XML_TOK_INVALID
  13353. } /* fall through */
  13354. fallthrough
  13355. case int32(_BT_NMSTRT):
  13356. fallthrough
  13357. case int32(_BT_HEX):
  13358. fallthrough
  13359. case int32(_BT_DIGIT):
  13360. fallthrough
  13361. case int32(_BT_NAME):
  13362. fallthrough
  13363. case int32(_BT_MINUS):
  13364. ptr += uintptr(1)
  13365. case int32(_BT_LEAD2):
  13366. if int64(end)-int64(ptr) < int64(2) {
  13367. return -int32(2)
  13368. }
  13369. 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) {
  13370. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13371. return m_XML_TOK_INVALID
  13372. }
  13373. ptr += uintptr(2)
  13374. case int32(_BT_LEAD3):
  13375. if int64(end)-int64(ptr) < int64(3) {
  13376. return -int32(2)
  13377. }
  13378. 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) {
  13379. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13380. return m_XML_TOK_INVALID
  13381. }
  13382. ptr += uintptr(3)
  13383. case int32(_BT_LEAD4):
  13384. if int64(end)-int64(ptr) < int64(4) {
  13385. return -int32(2)
  13386. }
  13387. 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) {
  13388. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13389. return m_XML_TOK_INVALID
  13390. }
  13391. ptr += uintptr(4)
  13392. case int32(_BT_S):
  13393. fallthrough
  13394. case int32(_BT_CR):
  13395. fallthrough
  13396. case int32(_BT_LF):
  13397. if !(_normal_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  13398. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13399. return m_XML_TOK_INVALID
  13400. }
  13401. ptr += uintptr(1)
  13402. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13403. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13404. case int32(_BT_LEAD2):
  13405. if int64(end)-int64(ptr) < int64(2) {
  13406. return -int32(2)
  13407. }
  13408. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  13409. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13410. return m_XML_TOK_INVALID
  13411. }
  13412. ptr += uintptr(2)
  13413. case int32(_BT_LEAD3):
  13414. if int64(end)-int64(ptr) < int64(3) {
  13415. return -int32(2)
  13416. }
  13417. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  13418. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13419. return m_XML_TOK_INVALID
  13420. }
  13421. ptr += uintptr(3)
  13422. case int32(_BT_LEAD4):
  13423. if int64(end)-int64(ptr) < int64(4) {
  13424. return -int32(2)
  13425. }
  13426. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  13427. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13428. return m_XML_TOK_INVALID
  13429. }
  13430. ptr += uintptr(4)
  13431. case int32(_BT_NONXML):
  13432. fallthrough
  13433. case int32(_BT_MALFORM):
  13434. fallthrough
  13435. case int32(_BT_TRAIL):
  13436. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13437. return m_XML_TOK_INVALID
  13438. case int32(_BT_QUEST):
  13439. ptr += uintptr(1)
  13440. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13441. return -int32(1)
  13442. }
  13443. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  13444. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13445. return *(*int32)(unsafe.Pointer(bp))
  13446. }
  13447. default:
  13448. ptr += uintptr(1)
  13449. break
  13450. }
  13451. }
  13452. return -int32(1)
  13453. case int32(_BT_QUEST):
  13454. if !(_normal_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  13455. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13456. return m_XML_TOK_INVALID
  13457. }
  13458. ptr += uintptr(1)
  13459. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13460. return -int32(1)
  13461. }
  13462. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  13463. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13464. return *(*int32)(unsafe.Pointer(bp))
  13465. }
  13466. /* fall through */
  13467. fallthrough
  13468. default:
  13469. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13470. return m_XML_TOK_INVALID
  13471. }
  13472. }
  13473. return -int32(1)
  13474. }
  13475. func _normal_scanCdataSection(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13476. var i int32
  13477. _ = i
  13478. _ = enc
  13479. /* CDATA[ */
  13480. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(6)*libc.Int32FromInt32(1))) {
  13481. return -int32(1)
  13482. }
  13483. i = 0
  13484. for {
  13485. if !(i < int32(6)) {
  13486. break
  13487. }
  13488. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == int32(_CDATA_LSQB[i])) {
  13489. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13490. return m_XML_TOK_INVALID
  13491. }
  13492. goto _1
  13493. _1:
  13494. ;
  13495. i++
  13496. ptr += uintptr(1)
  13497. }
  13498. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13499. return int32(m_XML_TOK_CDATA_SECT_OPEN)
  13500. }
  13501. var _CDATA_LSQB = [6]int8{
  13502. 0: int8(m_ASCII_C),
  13503. 1: int8(m_ASCII_D),
  13504. 2: int8(m_ASCII_A),
  13505. 3: int8(m_ASCII_T),
  13506. 4: int8(m_ASCII_A),
  13507. 5: int8(m_ASCII_LSQB1),
  13508. }
  13509. func _normal_cdataSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13510. var n Tsize_t
  13511. _ = n
  13512. if ptr >= end {
  13513. return -int32(4)
  13514. }
  13515. if int32(1) > int32(1) {
  13516. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  13517. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  13518. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  13519. if n == uint64(0) {
  13520. return -int32(1)
  13521. }
  13522. end = ptr + uintptr(n)
  13523. }
  13524. }
  13525. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13526. case int32(_BT_RSQB):
  13527. ptr += uintptr(1)
  13528. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13529. return -int32(1)
  13530. }
  13531. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_RSQB1)) {
  13532. break
  13533. }
  13534. ptr += uintptr(1)
  13535. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13536. return -int32(1)
  13537. }
  13538. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  13539. ptr -= uintptr(1)
  13540. break
  13541. }
  13542. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13543. return int32(m_XML_TOK_CDATA_SECT_CLOSE)
  13544. case int32(_BT_CR):
  13545. ptr += uintptr(1)
  13546. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13547. return -int32(1)
  13548. }
  13549. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) == int32(_BT_LF) {
  13550. ptr += uintptr(1)
  13551. }
  13552. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13553. return int32(m_XML_TOK_DATA_NEWLINE)
  13554. case int32(_BT_LF):
  13555. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13556. return int32(m_XML_TOK_DATA_NEWLINE)
  13557. case int32(_BT_LEAD2):
  13558. if int64(end)-int64(ptr) < int64(2) {
  13559. return -int32(2)
  13560. }
  13561. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  13562. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13563. return m_XML_TOK_INVALID
  13564. }
  13565. ptr += uintptr(2)
  13566. case int32(_BT_LEAD3):
  13567. if int64(end)-int64(ptr) < int64(3) {
  13568. return -int32(2)
  13569. }
  13570. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  13571. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13572. return m_XML_TOK_INVALID
  13573. }
  13574. ptr += uintptr(3)
  13575. case int32(_BT_LEAD4):
  13576. if int64(end)-int64(ptr) < int64(4) {
  13577. return -int32(2)
  13578. }
  13579. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  13580. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13581. return m_XML_TOK_INVALID
  13582. }
  13583. ptr += uintptr(4)
  13584. case int32(_BT_NONXML):
  13585. fallthrough
  13586. case int32(_BT_MALFORM):
  13587. fallthrough
  13588. case int32(_BT_TRAIL):
  13589. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13590. return m_XML_TOK_INVALID
  13591. default:
  13592. ptr += uintptr(1)
  13593. break
  13594. }
  13595. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13596. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13597. case int32(_BT_LEAD2):
  13598. 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 {
  13599. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13600. return int32(m_XML_TOK_DATA_CHARS)
  13601. }
  13602. ptr += uintptr(2)
  13603. case int32(_BT_LEAD3):
  13604. 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 {
  13605. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13606. return int32(m_XML_TOK_DATA_CHARS)
  13607. }
  13608. ptr += uintptr(3)
  13609. case int32(_BT_LEAD4):
  13610. 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 {
  13611. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13612. return int32(m_XML_TOK_DATA_CHARS)
  13613. }
  13614. ptr += uintptr(4)
  13615. case int32(_BT_NONXML):
  13616. fallthrough
  13617. case int32(_BT_MALFORM):
  13618. fallthrough
  13619. case int32(_BT_TRAIL):
  13620. fallthrough
  13621. case int32(_BT_CR):
  13622. fallthrough
  13623. case int32(_BT_LF):
  13624. fallthrough
  13625. case int32(_BT_RSQB):
  13626. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13627. return int32(m_XML_TOK_DATA_CHARS)
  13628. default:
  13629. ptr += uintptr(1)
  13630. break
  13631. }
  13632. }
  13633. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13634. return int32(m_XML_TOK_DATA_CHARS)
  13635. }
  13636. /* ptr points to character following "</" */
  13637. func _normal_scanEndTag(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13638. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13639. return -int32(1)
  13640. }
  13641. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13642. case int32(_BT_NONASCII):
  13643. if !(libc.Int32FromInt32(0) != 0) {
  13644. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13645. return m_XML_TOK_INVALID
  13646. } /* fall through */
  13647. fallthrough
  13648. case int32(_BT_NMSTRT):
  13649. fallthrough
  13650. case int32(_BT_HEX):
  13651. ptr += uintptr(1)
  13652. case int32(_BT_LEAD2):
  13653. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  13654. return -int32(2)
  13655. }
  13656. 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) {
  13657. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13658. return m_XML_TOK_INVALID
  13659. }
  13660. ptr += uintptr(2)
  13661. case int32(_BT_LEAD3):
  13662. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  13663. return -int32(2)
  13664. }
  13665. 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) {
  13666. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13667. return m_XML_TOK_INVALID
  13668. }
  13669. ptr += uintptr(3)
  13670. case int32(_BT_LEAD4):
  13671. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  13672. return -int32(2)
  13673. }
  13674. 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) {
  13675. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13676. return m_XML_TOK_INVALID
  13677. }
  13678. ptr += uintptr(4)
  13679. default:
  13680. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13681. return m_XML_TOK_INVALID
  13682. }
  13683. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13684. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13685. case int32(_BT_NONASCII):
  13686. goto _1
  13687. case int32(_BT_MINUS):
  13688. goto _2
  13689. case int32(_BT_NAME):
  13690. goto _3
  13691. case int32(_BT_DIGIT):
  13692. goto _4
  13693. case int32(_BT_HEX):
  13694. goto _5
  13695. case int32(_BT_NMSTRT):
  13696. goto _6
  13697. case int32(_BT_LEAD2):
  13698. goto _7
  13699. case int32(_BT_LEAD3):
  13700. goto _8
  13701. case int32(_BT_LEAD4):
  13702. goto _9
  13703. case int32(_BT_LF):
  13704. goto _10
  13705. case int32(_BT_CR):
  13706. goto _11
  13707. case int32(_BT_S):
  13708. goto _12
  13709. case int32(_BT_COLON):
  13710. goto _13
  13711. case int32(_BT_GT):
  13712. goto _14
  13713. default:
  13714. goto _15
  13715. }
  13716. goto _16
  13717. _1:
  13718. ;
  13719. if !(libc.Int32FromInt32(0) != 0) {
  13720. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13721. return m_XML_TOK_INVALID
  13722. } /* fall through */
  13723. _6:
  13724. ;
  13725. _5:
  13726. ;
  13727. _4:
  13728. ;
  13729. _3:
  13730. ;
  13731. _2:
  13732. ;
  13733. ptr += uintptr(1)
  13734. goto _16
  13735. _7:
  13736. ;
  13737. if int64(end)-int64(ptr) < int64(2) {
  13738. return -int32(2)
  13739. }
  13740. 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) {
  13741. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13742. return m_XML_TOK_INVALID
  13743. }
  13744. ptr += uintptr(2)
  13745. goto _16
  13746. _8:
  13747. ;
  13748. if int64(end)-int64(ptr) < int64(3) {
  13749. return -int32(2)
  13750. }
  13751. 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) {
  13752. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13753. return m_XML_TOK_INVALID
  13754. }
  13755. ptr += uintptr(3)
  13756. goto _16
  13757. _9:
  13758. ;
  13759. if int64(end)-int64(ptr) < int64(4) {
  13760. return -int32(2)
  13761. }
  13762. 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) {
  13763. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13764. return m_XML_TOK_INVALID
  13765. }
  13766. ptr += uintptr(4)
  13767. goto _16
  13768. _12:
  13769. ;
  13770. _11:
  13771. ;
  13772. _10:
  13773. ;
  13774. ptr += uintptr(1)
  13775. _19:
  13776. ;
  13777. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13778. goto _17
  13779. }
  13780. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13781. case int32(_BT_S):
  13782. fallthrough
  13783. case int32(_BT_CR):
  13784. fallthrough
  13785. case int32(_BT_LF):
  13786. case int32(_BT_GT):
  13787. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13788. return int32(m_XML_TOK_END_TAG)
  13789. default:
  13790. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13791. return m_XML_TOK_INVALID
  13792. }
  13793. goto _18
  13794. _18:
  13795. ;
  13796. ptr += uintptr(1)
  13797. goto _19
  13798. goto _17
  13799. _17:
  13800. ;
  13801. return -int32(1)
  13802. _13:
  13803. ;
  13804. /* no need to check qname syntax here,
  13805. since end-tag must match exactly */
  13806. ptr += uintptr(1)
  13807. goto _16
  13808. _14:
  13809. ;
  13810. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13811. return int32(m_XML_TOK_END_TAG)
  13812. _15:
  13813. ;
  13814. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13815. return m_XML_TOK_INVALID
  13816. _16:
  13817. }
  13818. return -int32(1)
  13819. }
  13820. /* ptr points to character following "&#X" */
  13821. func _normal_scanHexCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13822. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13823. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13824. case int32(_BT_DIGIT):
  13825. fallthrough
  13826. case int32(_BT_HEX):
  13827. default:
  13828. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13829. return m_XML_TOK_INVALID
  13830. }
  13831. ptr += uintptr(1)
  13832. for {
  13833. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13834. break
  13835. }
  13836. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13837. case int32(_BT_DIGIT):
  13838. fallthrough
  13839. case int32(_BT_HEX):
  13840. case int32(_BT_SEMI):
  13841. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13842. return int32(m_XML_TOK_CHAR_REF)
  13843. default:
  13844. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13845. return m_XML_TOK_INVALID
  13846. }
  13847. goto _1
  13848. _1:
  13849. ;
  13850. ptr += uintptr(1)
  13851. }
  13852. }
  13853. return -int32(1)
  13854. }
  13855. /* ptr points to character following "&#" */
  13856. func _normal_scanCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13857. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13858. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  13859. return _normal_scanHexCharRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  13860. }
  13861. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13862. case int32(_BT_DIGIT):
  13863. default:
  13864. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13865. return m_XML_TOK_INVALID
  13866. }
  13867. ptr += uintptr(1)
  13868. for {
  13869. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13870. break
  13871. }
  13872. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13873. case int32(_BT_DIGIT):
  13874. case int32(_BT_SEMI):
  13875. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13876. return int32(m_XML_TOK_CHAR_REF)
  13877. default:
  13878. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13879. return m_XML_TOK_INVALID
  13880. }
  13881. goto _1
  13882. _1:
  13883. ;
  13884. ptr += uintptr(1)
  13885. }
  13886. }
  13887. return -int32(1)
  13888. }
  13889. /* ptr points to character following "&" */
  13890. func _normal_scanRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13891. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13892. return -int32(1)
  13893. }
  13894. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13895. case int32(_BT_NONASCII):
  13896. if !(libc.Int32FromInt32(0) != 0) {
  13897. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13898. return m_XML_TOK_INVALID
  13899. } /* fall through */
  13900. fallthrough
  13901. case int32(_BT_NMSTRT):
  13902. fallthrough
  13903. case int32(_BT_HEX):
  13904. ptr += uintptr(1)
  13905. case int32(_BT_LEAD2):
  13906. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  13907. return -int32(2)
  13908. }
  13909. 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) {
  13910. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13911. return m_XML_TOK_INVALID
  13912. }
  13913. ptr += uintptr(2)
  13914. case int32(_BT_LEAD3):
  13915. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  13916. return -int32(2)
  13917. }
  13918. 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) {
  13919. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13920. return m_XML_TOK_INVALID
  13921. }
  13922. ptr += uintptr(3)
  13923. case int32(_BT_LEAD4):
  13924. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  13925. return -int32(2)
  13926. }
  13927. 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) {
  13928. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13929. return m_XML_TOK_INVALID
  13930. }
  13931. ptr += uintptr(4)
  13932. case int32(_BT_NUM):
  13933. return _normal_scanCharRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  13934. default:
  13935. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13936. return m_XML_TOK_INVALID
  13937. }
  13938. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13939. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13940. case int32(_BT_NONASCII):
  13941. if !(libc.Int32FromInt32(0) != 0) {
  13942. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13943. return m_XML_TOK_INVALID
  13944. } /* fall through */
  13945. fallthrough
  13946. case int32(_BT_NMSTRT):
  13947. fallthrough
  13948. case int32(_BT_HEX):
  13949. fallthrough
  13950. case int32(_BT_DIGIT):
  13951. fallthrough
  13952. case int32(_BT_NAME):
  13953. fallthrough
  13954. case int32(_BT_MINUS):
  13955. ptr += uintptr(1)
  13956. case int32(_BT_LEAD2):
  13957. if int64(end)-int64(ptr) < int64(2) {
  13958. return -int32(2)
  13959. }
  13960. 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) {
  13961. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13962. return m_XML_TOK_INVALID
  13963. }
  13964. ptr += uintptr(2)
  13965. case int32(_BT_LEAD3):
  13966. if int64(end)-int64(ptr) < int64(3) {
  13967. return -int32(2)
  13968. }
  13969. 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) {
  13970. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13971. return m_XML_TOK_INVALID
  13972. }
  13973. ptr += uintptr(3)
  13974. case int32(_BT_LEAD4):
  13975. if int64(end)-int64(ptr) < int64(4) {
  13976. return -int32(2)
  13977. }
  13978. 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) {
  13979. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13980. return m_XML_TOK_INVALID
  13981. }
  13982. ptr += uintptr(4)
  13983. case int32(_BT_SEMI):
  13984. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13985. return int32(m_XML_TOK_ENTITY_REF)
  13986. default:
  13987. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13988. return m_XML_TOK_INVALID
  13989. }
  13990. }
  13991. return -int32(1)
  13992. }
  13993. /* ptr points to character following first character of attribute name */
  13994. func _normal_scanAtts(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13995. bp := tls.Alloc(16)
  13996. defer tls.Free(16)
  13997. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  13998. var hadColon, open, t, t1, tok int32
  13999. _, _, _, _, _ = hadColon, open, t, t1, tok
  14000. hadColon = 0
  14001. for int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14002. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))) {
  14003. case int32(_BT_NONASCII):
  14004. goto _1
  14005. case int32(_BT_MINUS):
  14006. goto _2
  14007. case int32(_BT_NAME):
  14008. goto _3
  14009. case int32(_BT_DIGIT):
  14010. goto _4
  14011. case int32(_BT_HEX):
  14012. goto _5
  14013. case int32(_BT_NMSTRT):
  14014. goto _6
  14015. case int32(_BT_LEAD2):
  14016. goto _7
  14017. case int32(_BT_LEAD3):
  14018. goto _8
  14019. case int32(_BT_LEAD4):
  14020. goto _9
  14021. case int32(_BT_COLON):
  14022. goto _10
  14023. case int32(_BT_LF):
  14024. goto _11
  14025. case int32(_BT_CR):
  14026. goto _12
  14027. case int32(_BT_S):
  14028. goto _13
  14029. case int32(_BT_EQUALS):
  14030. goto _14
  14031. default:
  14032. goto _15
  14033. }
  14034. goto _16
  14035. _1:
  14036. ;
  14037. if !(libc.Int32FromInt32(0) != 0) {
  14038. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14039. return m_XML_TOK_INVALID
  14040. } /* fall through */
  14041. _6:
  14042. ;
  14043. _5:
  14044. ;
  14045. _4:
  14046. ;
  14047. _3:
  14048. ;
  14049. _2:
  14050. ;
  14051. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14052. goto _16
  14053. _7:
  14054. ;
  14055. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  14056. return -int32(2)
  14057. }
  14058. 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) {
  14059. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14060. return m_XML_TOK_INVALID
  14061. }
  14062. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  14063. goto _16
  14064. _8:
  14065. ;
  14066. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  14067. return -int32(2)
  14068. }
  14069. 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) {
  14070. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14071. return m_XML_TOK_INVALID
  14072. }
  14073. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  14074. goto _16
  14075. _9:
  14076. ;
  14077. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  14078. return -int32(2)
  14079. }
  14080. 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) {
  14081. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14082. return m_XML_TOK_INVALID
  14083. }
  14084. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  14085. goto _16
  14086. _10:
  14087. ;
  14088. if hadColon != 0 {
  14089. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14090. return m_XML_TOK_INVALID
  14091. }
  14092. hadColon = int32(1)
  14093. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14094. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14095. return -int32(1)
  14096. }
  14097. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))) {
  14098. case int32(_BT_NONASCII):
  14099. if !(libc.Int32FromInt32(0) != 0) {
  14100. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14101. return m_XML_TOK_INVALID
  14102. } /* fall through */
  14103. fallthrough
  14104. case int32(_BT_NMSTRT):
  14105. fallthrough
  14106. case int32(_BT_HEX):
  14107. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14108. case int32(_BT_LEAD2):
  14109. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  14110. return -int32(2)
  14111. }
  14112. 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) {
  14113. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14114. return m_XML_TOK_INVALID
  14115. }
  14116. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  14117. case int32(_BT_LEAD3):
  14118. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  14119. return -int32(2)
  14120. }
  14121. 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) {
  14122. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14123. return m_XML_TOK_INVALID
  14124. }
  14125. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  14126. case int32(_BT_LEAD4):
  14127. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  14128. return -int32(2)
  14129. }
  14130. 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) {
  14131. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14132. return m_XML_TOK_INVALID
  14133. }
  14134. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  14135. default:
  14136. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14137. return m_XML_TOK_INVALID
  14138. }
  14139. goto _16
  14140. _13:
  14141. ;
  14142. _12:
  14143. ;
  14144. _11:
  14145. ;
  14146. _19:
  14147. ;
  14148. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14149. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14150. return -int32(1)
  14151. }
  14152. t = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  14153. if t == int32(_BT_EQUALS) {
  14154. goto _17
  14155. }
  14156. switch t {
  14157. case int32(_BT_S):
  14158. fallthrough
  14159. case int32(_BT_LF):
  14160. fallthrough
  14161. case int32(_BT_CR):
  14162. default:
  14163. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14164. return m_XML_TOK_INVALID
  14165. }
  14166. goto _18
  14167. _18:
  14168. ;
  14169. goto _19
  14170. goto _17
  14171. _17:
  14172. ;
  14173. /* fall through */
  14174. _14:
  14175. ;
  14176. hadColon = 0
  14177. for {
  14178. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14179. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14180. return -int32(1)
  14181. }
  14182. open = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  14183. if open == int32(_BT_QUOT) || open == int32(_BT_APOS) {
  14184. break
  14185. }
  14186. switch open {
  14187. case int32(_BT_S):
  14188. fallthrough
  14189. case int32(_BT_LF):
  14190. fallthrough
  14191. case int32(_BT_CR):
  14192. default:
  14193. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14194. return m_XML_TOK_INVALID
  14195. }
  14196. goto _20
  14197. _20:
  14198. }
  14199. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14200. /* in attribute value */
  14201. for {
  14202. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14203. return -int32(1)
  14204. }
  14205. t1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  14206. if t1 == open {
  14207. break
  14208. }
  14209. switch t1 {
  14210. case int32(_BT_LEAD2):
  14211. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  14212. return -int32(2)
  14213. }
  14214. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  14215. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14216. return m_XML_TOK_INVALID
  14217. }
  14218. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  14219. case int32(_BT_LEAD3):
  14220. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  14221. return -int32(2)
  14222. }
  14223. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  14224. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14225. return m_XML_TOK_INVALID
  14226. }
  14227. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  14228. case int32(_BT_LEAD4):
  14229. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  14230. return -int32(2)
  14231. }
  14232. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  14233. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14234. return m_XML_TOK_INVALID
  14235. }
  14236. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  14237. case int32(_BT_NONXML):
  14238. fallthrough
  14239. case int32(_BT_MALFORM):
  14240. fallthrough
  14241. case int32(_BT_TRAIL):
  14242. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14243. return m_XML_TOK_INVALID
  14244. case int32(_BT_AMP):
  14245. tok = _normal_scanRef(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr(1), end, bp)
  14246. if tok <= 0 {
  14247. if tok == m_XML_TOK_INVALID {
  14248. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14249. }
  14250. return tok
  14251. }
  14252. case int32(_BT_LT):
  14253. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14254. return m_XML_TOK_INVALID
  14255. default:
  14256. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14257. break
  14258. }
  14259. goto _21
  14260. _21:
  14261. }
  14262. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14263. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14264. return -int32(1)
  14265. }
  14266. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))) {
  14267. case int32(_BT_S):
  14268. fallthrough
  14269. case int32(_BT_CR):
  14270. fallthrough
  14271. case int32(_BT_LF):
  14272. case int32(_BT_SOL):
  14273. goto sol
  14274. case int32(_BT_GT):
  14275. goto gt
  14276. default:
  14277. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14278. return m_XML_TOK_INVALID
  14279. }
  14280. /* ptr points to closing quote */
  14281. _24:
  14282. ;
  14283. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14284. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14285. return -int32(1)
  14286. }
  14287. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))) {
  14288. case int32(_BT_NONASCII):
  14289. goto _25
  14290. case int32(_BT_HEX):
  14291. goto _26
  14292. case int32(_BT_NMSTRT):
  14293. goto _27
  14294. case int32(_BT_LEAD2):
  14295. goto _28
  14296. case int32(_BT_LEAD3):
  14297. goto _29
  14298. case int32(_BT_LEAD4):
  14299. goto _30
  14300. case int32(_BT_LF):
  14301. goto _31
  14302. case int32(_BT_CR):
  14303. goto _32
  14304. case int32(_BT_S):
  14305. goto _33
  14306. case int32(_BT_GT):
  14307. goto _34
  14308. case int32(_BT_SOL):
  14309. goto _35
  14310. default:
  14311. goto _36
  14312. }
  14313. goto _37
  14314. _25:
  14315. ;
  14316. if !(libc.Int32FromInt32(0) != 0) {
  14317. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14318. return m_XML_TOK_INVALID
  14319. } /* fall through */
  14320. _27:
  14321. ;
  14322. _26:
  14323. ;
  14324. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14325. goto _37
  14326. _28:
  14327. ;
  14328. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  14329. return -int32(2)
  14330. }
  14331. 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) {
  14332. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14333. return m_XML_TOK_INVALID
  14334. }
  14335. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  14336. goto _37
  14337. _29:
  14338. ;
  14339. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  14340. return -int32(2)
  14341. }
  14342. 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) {
  14343. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14344. return m_XML_TOK_INVALID
  14345. }
  14346. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  14347. goto _37
  14348. _30:
  14349. ;
  14350. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  14351. return -int32(2)
  14352. }
  14353. 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) {
  14354. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14355. return m_XML_TOK_INVALID
  14356. }
  14357. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  14358. goto _37
  14359. _33:
  14360. ;
  14361. _32:
  14362. ;
  14363. _31:
  14364. ;
  14365. goto _23
  14366. _34:
  14367. ;
  14368. goto gt
  14369. gt:
  14370. ;
  14371. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(1)
  14372. return int32(m_XML_TOK_START_TAG_WITH_ATTS)
  14373. _35:
  14374. ;
  14375. goto sol
  14376. sol:
  14377. ;
  14378. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14379. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14380. return -int32(1)
  14381. }
  14382. if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  14383. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14384. return m_XML_TOK_INVALID
  14385. }
  14386. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(1)
  14387. return int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS)
  14388. _36:
  14389. ;
  14390. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14391. return m_XML_TOK_INVALID
  14392. _37:
  14393. ;
  14394. goto _22
  14395. goto _23
  14396. _23:
  14397. ;
  14398. goto _24
  14399. goto _22
  14400. _22:
  14401. ;
  14402. goto _16
  14403. _15:
  14404. ;
  14405. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14406. return m_XML_TOK_INVALID
  14407. _16:
  14408. }
  14409. return -int32(1)
  14410. }
  14411. /* ptr points to character following "<" */
  14412. func _normal_scanLt(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  14413. var hadColon int32
  14414. _ = hadColon
  14415. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14416. return -int32(1)
  14417. }
  14418. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14419. case int32(_BT_NONASCII):
  14420. if !(libc.Int32FromInt32(0) != 0) {
  14421. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14422. return m_XML_TOK_INVALID
  14423. } /* fall through */
  14424. fallthrough
  14425. case int32(_BT_NMSTRT):
  14426. fallthrough
  14427. case int32(_BT_HEX):
  14428. ptr += uintptr(1)
  14429. case int32(_BT_LEAD2):
  14430. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  14431. return -int32(2)
  14432. }
  14433. 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) {
  14434. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14435. return m_XML_TOK_INVALID
  14436. }
  14437. ptr += uintptr(2)
  14438. case int32(_BT_LEAD3):
  14439. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  14440. return -int32(2)
  14441. }
  14442. 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) {
  14443. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14444. return m_XML_TOK_INVALID
  14445. }
  14446. ptr += uintptr(3)
  14447. case int32(_BT_LEAD4):
  14448. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  14449. return -int32(2)
  14450. }
  14451. 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) {
  14452. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14453. return m_XML_TOK_INVALID
  14454. }
  14455. ptr += uintptr(4)
  14456. case int32(_BT_EXCL):
  14457. ptr += uintptr(1)
  14458. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14459. return -int32(1)
  14460. }
  14461. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14462. case int32(_BT_MINUS):
  14463. return _normal_scanComment(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14464. case int32(_BT_LSQB):
  14465. return _normal_scanCdataSection(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14466. }
  14467. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14468. return m_XML_TOK_INVALID
  14469. case int32(_BT_QUEST):
  14470. return _normal_scanPi(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14471. case int32(_BT_SOL):
  14472. return _normal_scanEndTag(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14473. default:
  14474. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14475. return m_XML_TOK_INVALID
  14476. }
  14477. hadColon = 0
  14478. /* we have a start-tag */
  14479. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14480. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14481. case int32(_BT_NONASCII):
  14482. goto _1
  14483. case int32(_BT_MINUS):
  14484. goto _2
  14485. case int32(_BT_NAME):
  14486. goto _3
  14487. case int32(_BT_DIGIT):
  14488. goto _4
  14489. case int32(_BT_HEX):
  14490. goto _5
  14491. case int32(_BT_NMSTRT):
  14492. goto _6
  14493. case int32(_BT_LEAD2):
  14494. goto _7
  14495. case int32(_BT_LEAD3):
  14496. goto _8
  14497. case int32(_BT_LEAD4):
  14498. goto _9
  14499. case int32(_BT_COLON):
  14500. goto _10
  14501. case int32(_BT_LF):
  14502. goto _11
  14503. case int32(_BT_CR):
  14504. goto _12
  14505. case int32(_BT_S):
  14506. goto _13
  14507. case int32(_BT_GT):
  14508. goto _14
  14509. case int32(_BT_SOL):
  14510. goto _15
  14511. default:
  14512. goto _16
  14513. }
  14514. goto _17
  14515. _1:
  14516. ;
  14517. if !(libc.Int32FromInt32(0) != 0) {
  14518. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14519. return m_XML_TOK_INVALID
  14520. } /* fall through */
  14521. _6:
  14522. ;
  14523. _5:
  14524. ;
  14525. _4:
  14526. ;
  14527. _3:
  14528. ;
  14529. _2:
  14530. ;
  14531. ptr += uintptr(1)
  14532. goto _17
  14533. _7:
  14534. ;
  14535. if int64(end)-int64(ptr) < int64(2) {
  14536. return -int32(2)
  14537. }
  14538. 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) {
  14539. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14540. return m_XML_TOK_INVALID
  14541. }
  14542. ptr += uintptr(2)
  14543. goto _17
  14544. _8:
  14545. ;
  14546. if int64(end)-int64(ptr) < int64(3) {
  14547. return -int32(2)
  14548. }
  14549. 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) {
  14550. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14551. return m_XML_TOK_INVALID
  14552. }
  14553. ptr += uintptr(3)
  14554. goto _17
  14555. _9:
  14556. ;
  14557. if int64(end)-int64(ptr) < int64(4) {
  14558. return -int32(2)
  14559. }
  14560. 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) {
  14561. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14562. return m_XML_TOK_INVALID
  14563. }
  14564. ptr += uintptr(4)
  14565. goto _17
  14566. _10:
  14567. ;
  14568. if hadColon != 0 {
  14569. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14570. return m_XML_TOK_INVALID
  14571. }
  14572. hadColon = int32(1)
  14573. ptr += uintptr(1)
  14574. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14575. return -int32(1)
  14576. }
  14577. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14578. case int32(_BT_NONASCII):
  14579. if !(libc.Int32FromInt32(0) != 0) {
  14580. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14581. return m_XML_TOK_INVALID
  14582. } /* fall through */
  14583. fallthrough
  14584. case int32(_BT_NMSTRT):
  14585. fallthrough
  14586. case int32(_BT_HEX):
  14587. ptr += uintptr(1)
  14588. case int32(_BT_LEAD2):
  14589. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  14590. return -int32(2)
  14591. }
  14592. 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) {
  14593. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14594. return m_XML_TOK_INVALID
  14595. }
  14596. ptr += uintptr(2)
  14597. case int32(_BT_LEAD3):
  14598. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  14599. return -int32(2)
  14600. }
  14601. 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) {
  14602. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14603. return m_XML_TOK_INVALID
  14604. }
  14605. ptr += uintptr(3)
  14606. case int32(_BT_LEAD4):
  14607. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  14608. return -int32(2)
  14609. }
  14610. 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) {
  14611. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14612. return m_XML_TOK_INVALID
  14613. }
  14614. ptr += uintptr(4)
  14615. default:
  14616. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14617. return m_XML_TOK_INVALID
  14618. }
  14619. goto _17
  14620. _13:
  14621. ;
  14622. _12:
  14623. ;
  14624. _11:
  14625. ;
  14626. ptr += uintptr(1)
  14627. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14628. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14629. case int32(_BT_NONASCII):
  14630. if !(libc.Int32FromInt32(0) != 0) {
  14631. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14632. return m_XML_TOK_INVALID
  14633. } /* fall through */
  14634. fallthrough
  14635. case int32(_BT_NMSTRT):
  14636. fallthrough
  14637. case int32(_BT_HEX):
  14638. ptr += uintptr(1)
  14639. case int32(_BT_LEAD2):
  14640. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  14641. return -int32(2)
  14642. }
  14643. 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) {
  14644. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14645. return m_XML_TOK_INVALID
  14646. }
  14647. ptr += uintptr(2)
  14648. case int32(_BT_LEAD3):
  14649. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  14650. return -int32(2)
  14651. }
  14652. 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) {
  14653. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14654. return m_XML_TOK_INVALID
  14655. }
  14656. ptr += uintptr(3)
  14657. case int32(_BT_LEAD4):
  14658. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  14659. return -int32(2)
  14660. }
  14661. 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) {
  14662. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14663. return m_XML_TOK_INVALID
  14664. }
  14665. ptr += uintptr(4)
  14666. case int32(_BT_GT):
  14667. goto gt
  14668. case int32(_BT_SOL):
  14669. goto sol
  14670. case int32(_BT_S):
  14671. fallthrough
  14672. case int32(_BT_CR):
  14673. fallthrough
  14674. case int32(_BT_LF):
  14675. ptr += uintptr(1)
  14676. continue
  14677. default:
  14678. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14679. return m_XML_TOK_INVALID
  14680. }
  14681. return _normal_scanAtts(tls, enc, ptr, end, nextTokPtr)
  14682. }
  14683. return -int32(1)
  14684. _14:
  14685. ;
  14686. goto gt
  14687. gt:
  14688. ;
  14689. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14690. return int32(m_XML_TOK_START_TAG_NO_ATTS)
  14691. _15:
  14692. ;
  14693. goto sol
  14694. sol:
  14695. ;
  14696. ptr += uintptr(1)
  14697. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14698. return -int32(1)
  14699. }
  14700. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  14701. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14702. return m_XML_TOK_INVALID
  14703. }
  14704. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14705. return int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS)
  14706. _16:
  14707. ;
  14708. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14709. return m_XML_TOK_INVALID
  14710. _17:
  14711. }
  14712. return -int32(1)
  14713. }
  14714. func _normal_contentTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  14715. var n Tsize_t
  14716. _ = n
  14717. if ptr >= end {
  14718. return -int32(4)
  14719. }
  14720. if int32(1) > int32(1) {
  14721. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  14722. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  14723. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  14724. if n == uint64(0) {
  14725. return -int32(1)
  14726. }
  14727. end = ptr + uintptr(n)
  14728. }
  14729. }
  14730. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14731. case int32(_BT_LT):
  14732. return _normal_scanLt(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14733. case int32(_BT_AMP):
  14734. return _normal_scanRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14735. case int32(_BT_CR):
  14736. ptr += uintptr(1)
  14737. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14738. return -int32(3)
  14739. }
  14740. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) == int32(_BT_LF) {
  14741. ptr += uintptr(1)
  14742. }
  14743. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14744. return int32(m_XML_TOK_DATA_NEWLINE)
  14745. case int32(_BT_LF):
  14746. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14747. return int32(m_XML_TOK_DATA_NEWLINE)
  14748. case int32(_BT_RSQB):
  14749. ptr += uintptr(1)
  14750. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14751. return -int32(5)
  14752. }
  14753. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_RSQB1)) {
  14754. break
  14755. }
  14756. ptr += uintptr(1)
  14757. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14758. return -int32(5)
  14759. }
  14760. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  14761. ptr -= uintptr(1)
  14762. break
  14763. }
  14764. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14765. return m_XML_TOK_INVALID
  14766. case int32(_BT_LEAD2):
  14767. if int64(end)-int64(ptr) < int64(2) {
  14768. return -int32(2)
  14769. }
  14770. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  14771. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14772. return m_XML_TOK_INVALID
  14773. }
  14774. ptr += uintptr(2)
  14775. case int32(_BT_LEAD3):
  14776. if int64(end)-int64(ptr) < int64(3) {
  14777. return -int32(2)
  14778. }
  14779. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  14780. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14781. return m_XML_TOK_INVALID
  14782. }
  14783. ptr += uintptr(3)
  14784. case int32(_BT_LEAD4):
  14785. if int64(end)-int64(ptr) < int64(4) {
  14786. return -int32(2)
  14787. }
  14788. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  14789. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14790. return m_XML_TOK_INVALID
  14791. }
  14792. ptr += uintptr(4)
  14793. case int32(_BT_NONXML):
  14794. fallthrough
  14795. case int32(_BT_MALFORM):
  14796. fallthrough
  14797. case int32(_BT_TRAIL):
  14798. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14799. return m_XML_TOK_INVALID
  14800. default:
  14801. ptr += uintptr(1)
  14802. break
  14803. }
  14804. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14805. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14806. case int32(_BT_LEAD2):
  14807. 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 {
  14808. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14809. return int32(m_XML_TOK_DATA_CHARS)
  14810. }
  14811. ptr += uintptr(2)
  14812. case int32(_BT_LEAD3):
  14813. 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 {
  14814. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14815. return int32(m_XML_TOK_DATA_CHARS)
  14816. }
  14817. ptr += uintptr(3)
  14818. case int32(_BT_LEAD4):
  14819. 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 {
  14820. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14821. return int32(m_XML_TOK_DATA_CHARS)
  14822. }
  14823. ptr += uintptr(4)
  14824. case int32(_BT_RSQB):
  14825. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(1)) {
  14826. if !(int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == libc.Int32FromInt32(m_ASCII_RSQB1)) {
  14827. ptr += uintptr(1)
  14828. break
  14829. }
  14830. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(3)*libc.Int32FromInt32(1)) {
  14831. if !(int32(*(*int8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  14832. ptr += uintptr(1)
  14833. break
  14834. }
  14835. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))
  14836. return m_XML_TOK_INVALID
  14837. }
  14838. }
  14839. /* fall through */
  14840. fallthrough
  14841. case int32(_BT_AMP):
  14842. fallthrough
  14843. case int32(_BT_LT):
  14844. fallthrough
  14845. case int32(_BT_NONXML):
  14846. fallthrough
  14847. case int32(_BT_MALFORM):
  14848. fallthrough
  14849. case int32(_BT_TRAIL):
  14850. fallthrough
  14851. case int32(_BT_CR):
  14852. fallthrough
  14853. case int32(_BT_LF):
  14854. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14855. return int32(m_XML_TOK_DATA_CHARS)
  14856. default:
  14857. ptr += uintptr(1)
  14858. break
  14859. }
  14860. }
  14861. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14862. return int32(m_XML_TOK_DATA_CHARS)
  14863. }
  14864. /* ptr points to character following "%" */
  14865. func _normal_scanPercent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  14866. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14867. return -int32(1)
  14868. }
  14869. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14870. case int32(_BT_NONASCII):
  14871. if !(libc.Int32FromInt32(0) != 0) {
  14872. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14873. return m_XML_TOK_INVALID
  14874. } /* fall through */
  14875. fallthrough
  14876. case int32(_BT_NMSTRT):
  14877. fallthrough
  14878. case int32(_BT_HEX):
  14879. ptr += uintptr(1)
  14880. case int32(_BT_LEAD2):
  14881. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  14882. return -int32(2)
  14883. }
  14884. 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) {
  14885. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14886. return m_XML_TOK_INVALID
  14887. }
  14888. ptr += uintptr(2)
  14889. case int32(_BT_LEAD3):
  14890. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  14891. return -int32(2)
  14892. }
  14893. 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) {
  14894. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14895. return m_XML_TOK_INVALID
  14896. }
  14897. ptr += uintptr(3)
  14898. case int32(_BT_LEAD4):
  14899. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  14900. return -int32(2)
  14901. }
  14902. 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) {
  14903. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14904. return m_XML_TOK_INVALID
  14905. }
  14906. ptr += uintptr(4)
  14907. case int32(_BT_S):
  14908. fallthrough
  14909. case int32(_BT_LF):
  14910. fallthrough
  14911. case int32(_BT_CR):
  14912. fallthrough
  14913. case int32(_BT_PERCNT):
  14914. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14915. return int32(m_XML_TOK_PERCENT)
  14916. default:
  14917. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14918. return m_XML_TOK_INVALID
  14919. }
  14920. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14921. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14922. case int32(_BT_NONASCII):
  14923. if !(libc.Int32FromInt32(0) != 0) {
  14924. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14925. return m_XML_TOK_INVALID
  14926. } /* fall through */
  14927. fallthrough
  14928. case int32(_BT_NMSTRT):
  14929. fallthrough
  14930. case int32(_BT_HEX):
  14931. fallthrough
  14932. case int32(_BT_DIGIT):
  14933. fallthrough
  14934. case int32(_BT_NAME):
  14935. fallthrough
  14936. case int32(_BT_MINUS):
  14937. ptr += uintptr(1)
  14938. case int32(_BT_LEAD2):
  14939. if int64(end)-int64(ptr) < int64(2) {
  14940. return -int32(2)
  14941. }
  14942. 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) {
  14943. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14944. return m_XML_TOK_INVALID
  14945. }
  14946. ptr += uintptr(2)
  14947. case int32(_BT_LEAD3):
  14948. if int64(end)-int64(ptr) < int64(3) {
  14949. return -int32(2)
  14950. }
  14951. 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) {
  14952. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14953. return m_XML_TOK_INVALID
  14954. }
  14955. ptr += uintptr(3)
  14956. case int32(_BT_LEAD4):
  14957. if int64(end)-int64(ptr) < int64(4) {
  14958. return -int32(2)
  14959. }
  14960. 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) {
  14961. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14962. return m_XML_TOK_INVALID
  14963. }
  14964. ptr += uintptr(4)
  14965. case int32(_BT_SEMI):
  14966. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14967. return int32(m_XML_TOK_PARAM_ENTITY_REF)
  14968. default:
  14969. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14970. return m_XML_TOK_INVALID
  14971. }
  14972. }
  14973. return -int32(1)
  14974. }
  14975. func _normal_scanPoundName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  14976. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14977. return -int32(1)
  14978. }
  14979. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14980. case int32(_BT_NONASCII):
  14981. if !(libc.Int32FromInt32(0) != 0) {
  14982. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14983. return m_XML_TOK_INVALID
  14984. } /* fall through */
  14985. fallthrough
  14986. case int32(_BT_NMSTRT):
  14987. fallthrough
  14988. case int32(_BT_HEX):
  14989. ptr += uintptr(1)
  14990. case int32(_BT_LEAD2):
  14991. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  14992. return -int32(2)
  14993. }
  14994. 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) {
  14995. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14996. return m_XML_TOK_INVALID
  14997. }
  14998. ptr += uintptr(2)
  14999. case int32(_BT_LEAD3):
  15000. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  15001. return -int32(2)
  15002. }
  15003. 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) {
  15004. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15005. return m_XML_TOK_INVALID
  15006. }
  15007. ptr += uintptr(3)
  15008. case int32(_BT_LEAD4):
  15009. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  15010. return -int32(2)
  15011. }
  15012. 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) {
  15013. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15014. return m_XML_TOK_INVALID
  15015. }
  15016. ptr += uintptr(4)
  15017. default:
  15018. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15019. return m_XML_TOK_INVALID
  15020. }
  15021. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15022. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15023. case int32(_BT_NONASCII):
  15024. if !(libc.Int32FromInt32(0) != 0) {
  15025. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15026. return m_XML_TOK_INVALID
  15027. } /* fall through */
  15028. fallthrough
  15029. case int32(_BT_NMSTRT):
  15030. fallthrough
  15031. case int32(_BT_HEX):
  15032. fallthrough
  15033. case int32(_BT_DIGIT):
  15034. fallthrough
  15035. case int32(_BT_NAME):
  15036. fallthrough
  15037. case int32(_BT_MINUS):
  15038. ptr += uintptr(1)
  15039. case int32(_BT_LEAD2):
  15040. if int64(end)-int64(ptr) < int64(2) {
  15041. return -int32(2)
  15042. }
  15043. 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) {
  15044. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15045. return m_XML_TOK_INVALID
  15046. }
  15047. ptr += uintptr(2)
  15048. case int32(_BT_LEAD3):
  15049. if int64(end)-int64(ptr) < int64(3) {
  15050. return -int32(2)
  15051. }
  15052. 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) {
  15053. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15054. return m_XML_TOK_INVALID
  15055. }
  15056. ptr += uintptr(3)
  15057. case int32(_BT_LEAD4):
  15058. if int64(end)-int64(ptr) < int64(4) {
  15059. return -int32(2)
  15060. }
  15061. 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) {
  15062. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15063. return m_XML_TOK_INVALID
  15064. }
  15065. ptr += uintptr(4)
  15066. case int32(_BT_CR):
  15067. fallthrough
  15068. case int32(_BT_LF):
  15069. fallthrough
  15070. case int32(_BT_S):
  15071. fallthrough
  15072. case int32(_BT_RPAR):
  15073. fallthrough
  15074. case int32(_BT_GT):
  15075. fallthrough
  15076. case int32(_BT_PERCNT):
  15077. fallthrough
  15078. case int32(_BT_VERBAR):
  15079. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15080. return int32(m_XML_TOK_POUND_NAME)
  15081. default:
  15082. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15083. return m_XML_TOK_INVALID
  15084. }
  15085. }
  15086. return -int32(m_XML_TOK_POUND_NAME)
  15087. }
  15088. func _normal_scanLit(tls *libc.TLS, open int32, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15089. var t int32
  15090. _ = t
  15091. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15092. t = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  15093. switch t {
  15094. case int32(_BT_LEAD2):
  15095. if int64(end)-int64(ptr) < int64(2) {
  15096. return -int32(2)
  15097. }
  15098. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  15099. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15100. return m_XML_TOK_INVALID
  15101. }
  15102. ptr += uintptr(2)
  15103. case int32(_BT_LEAD3):
  15104. if int64(end)-int64(ptr) < int64(3) {
  15105. return -int32(2)
  15106. }
  15107. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  15108. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15109. return m_XML_TOK_INVALID
  15110. }
  15111. ptr += uintptr(3)
  15112. case int32(_BT_LEAD4):
  15113. if int64(end)-int64(ptr) < int64(4) {
  15114. return -int32(2)
  15115. }
  15116. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  15117. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15118. return m_XML_TOK_INVALID
  15119. }
  15120. ptr += uintptr(4)
  15121. case int32(_BT_NONXML):
  15122. fallthrough
  15123. case int32(_BT_MALFORM):
  15124. fallthrough
  15125. case int32(_BT_TRAIL):
  15126. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15127. return m_XML_TOK_INVALID
  15128. case int32(_BT_QUOT):
  15129. fallthrough
  15130. case int32(_BT_APOS):
  15131. ptr += uintptr(1)
  15132. if t != open {
  15133. break
  15134. }
  15135. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15136. return -int32(m_XML_TOK_LITERAL)
  15137. }
  15138. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15139. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15140. case int32(_BT_S):
  15141. fallthrough
  15142. case int32(_BT_CR):
  15143. fallthrough
  15144. case int32(_BT_LF):
  15145. fallthrough
  15146. case int32(_BT_GT):
  15147. fallthrough
  15148. case int32(_BT_PERCNT):
  15149. fallthrough
  15150. case int32(_BT_LSQB):
  15151. return int32(m_XML_TOK_LITERAL)
  15152. default:
  15153. return m_XML_TOK_INVALID
  15154. }
  15155. fallthrough
  15156. default:
  15157. ptr += uintptr(1)
  15158. break
  15159. }
  15160. }
  15161. return -int32(1)
  15162. }
  15163. func _normal_prologTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15164. var n Tsize_t
  15165. var tok int32
  15166. _, _ = n, tok
  15167. if ptr >= end {
  15168. return -int32(4)
  15169. }
  15170. if int32(1) > int32(1) {
  15171. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  15172. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  15173. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  15174. if n == uint64(0) {
  15175. return -int32(1)
  15176. }
  15177. end = ptr + uintptr(n)
  15178. }
  15179. }
  15180. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15181. case int32(_BT_QUOT):
  15182. goto _1
  15183. case int32(_BT_APOS):
  15184. goto _2
  15185. case int32(_BT_LT):
  15186. goto _3
  15187. case int32(_BT_CR):
  15188. goto _4
  15189. case int32(_BT_LF):
  15190. goto _5
  15191. case int32(_BT_S):
  15192. goto _6
  15193. case int32(_BT_PERCNT):
  15194. goto _7
  15195. case int32(_BT_COMMA):
  15196. goto _8
  15197. case int32(_BT_LSQB):
  15198. goto _9
  15199. case int32(_BT_RSQB):
  15200. goto _10
  15201. case int32(_BT_LPAR):
  15202. goto _11
  15203. case int32(_BT_RPAR):
  15204. goto _12
  15205. case int32(_BT_VERBAR):
  15206. goto _13
  15207. case int32(_BT_GT):
  15208. goto _14
  15209. case int32(_BT_NUM):
  15210. goto _15
  15211. case int32(_BT_LEAD2):
  15212. goto _16
  15213. case int32(_BT_LEAD3):
  15214. goto _17
  15215. case int32(_BT_LEAD4):
  15216. goto _18
  15217. case int32(_BT_HEX):
  15218. goto _19
  15219. case int32(_BT_NMSTRT):
  15220. goto _20
  15221. case int32(_BT_COLON):
  15222. goto _21
  15223. case int32(_BT_MINUS):
  15224. goto _22
  15225. case int32(_BT_NAME):
  15226. goto _23
  15227. case int32(_BT_DIGIT):
  15228. goto _24
  15229. case int32(_BT_NONASCII):
  15230. goto _25
  15231. default:
  15232. goto _26
  15233. }
  15234. goto _27
  15235. _1:
  15236. ;
  15237. return _normal_scanLit(tls, int32(_BT_QUOT), enc, ptr+uintptr(1), end, nextTokPtr)
  15238. _2:
  15239. ;
  15240. return _normal_scanLit(tls, int32(_BT_APOS), enc, ptr+uintptr(1), end, nextTokPtr)
  15241. _3:
  15242. ;
  15243. ptr += uintptr(1)
  15244. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15245. return -int32(1)
  15246. }
  15247. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15248. case int32(_BT_EXCL):
  15249. return _normal_scanDecl(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15250. case int32(_BT_QUEST):
  15251. return _normal_scanPi(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15252. case int32(_BT_NMSTRT):
  15253. fallthrough
  15254. case int32(_BT_HEX):
  15255. fallthrough
  15256. case int32(_BT_NONASCII):
  15257. fallthrough
  15258. case int32(_BT_LEAD2):
  15259. fallthrough
  15260. case int32(_BT_LEAD3):
  15261. fallthrough
  15262. case int32(_BT_LEAD4):
  15263. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr - uintptr(1)
  15264. return int32(m_XML_TOK_INSTANCE_START)
  15265. }
  15266. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15267. return m_XML_TOK_INVALID
  15268. _4:
  15269. ;
  15270. if ptr+uintptr(1) == end {
  15271. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = end
  15272. /* indicate that this might be part of a CR/LF pair */
  15273. return -int32(m_XML_TOK_PROLOG_S)
  15274. }
  15275. /* fall through */
  15276. _6:
  15277. ;
  15278. _5:
  15279. ;
  15280. _30:
  15281. ;
  15282. ptr += uintptr(1)
  15283. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15284. goto _28
  15285. }
  15286. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15287. case int32(_BT_S):
  15288. fallthrough
  15289. case int32(_BT_LF):
  15290. case int32(_BT_CR):
  15291. /* don't split CR/LF pair */
  15292. if ptr+uintptr(1) != end {
  15293. break
  15294. }
  15295. /* fall through */
  15296. fallthrough
  15297. default:
  15298. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15299. return int32(m_XML_TOK_PROLOG_S)
  15300. }
  15301. goto _29
  15302. _29:
  15303. ;
  15304. goto _30
  15305. goto _28
  15306. _28:
  15307. ;
  15308. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15309. return int32(m_XML_TOK_PROLOG_S)
  15310. _7:
  15311. ;
  15312. return _normal_scanPercent(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15313. _8:
  15314. ;
  15315. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15316. return int32(m_XML_TOK_COMMA)
  15317. _9:
  15318. ;
  15319. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15320. return int32(m_XML_TOK_OPEN_BRACKET)
  15321. _10:
  15322. ;
  15323. ptr += uintptr(1)
  15324. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15325. return -int32(m_XML_TOK_CLOSE_BRACKET)
  15326. }
  15327. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  15328. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))) {
  15329. return -int32(1)
  15330. }
  15331. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == int32(m_ASCII_GT1) {
  15332. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))
  15333. return int32(m_XML_TOK_COND_SECT_CLOSE)
  15334. }
  15335. }
  15336. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15337. return int32(m_XML_TOK_CLOSE_BRACKET)
  15338. _11:
  15339. ;
  15340. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15341. return int32(m_XML_TOK_OPEN_PAREN)
  15342. _12:
  15343. ;
  15344. ptr += uintptr(1)
  15345. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15346. return -int32(m_XML_TOK_CLOSE_PAREN)
  15347. }
  15348. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15349. case int32(_BT_AST):
  15350. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15351. return int32(m_XML_TOK_CLOSE_PAREN_ASTERISK)
  15352. case int32(_BT_QUEST):
  15353. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15354. return int32(m_XML_TOK_CLOSE_PAREN_QUESTION)
  15355. case int32(_BT_PLUS):
  15356. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15357. return int32(m_XML_TOK_CLOSE_PAREN_PLUS)
  15358. case int32(_BT_CR):
  15359. fallthrough
  15360. case int32(_BT_LF):
  15361. fallthrough
  15362. case int32(_BT_S):
  15363. fallthrough
  15364. case int32(_BT_GT):
  15365. fallthrough
  15366. case int32(_BT_COMMA):
  15367. fallthrough
  15368. case int32(_BT_VERBAR):
  15369. fallthrough
  15370. case int32(_BT_RPAR):
  15371. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15372. return int32(m_XML_TOK_CLOSE_PAREN)
  15373. }
  15374. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15375. return m_XML_TOK_INVALID
  15376. _13:
  15377. ;
  15378. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15379. return int32(m_XML_TOK_OR)
  15380. _14:
  15381. ;
  15382. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15383. return int32(m_XML_TOK_DECL_CLOSE)
  15384. _15:
  15385. ;
  15386. return _normal_scanPoundName(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15387. _16:
  15388. ;
  15389. if int64(end)-int64(ptr) < int64(2) {
  15390. return -int32(2)
  15391. }
  15392. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  15393. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15394. return m_XML_TOK_INVALID
  15395. }
  15396. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0 {
  15397. ptr += uintptr(2)
  15398. tok = int32(m_XML_TOK_NAME)
  15399. goto _27
  15400. }
  15401. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0 {
  15402. ptr += uintptr(2)
  15403. tok = int32(m_XML_TOK_NMTOKEN)
  15404. goto _27
  15405. }
  15406. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15407. return m_XML_TOK_INVALID
  15408. _17:
  15409. ;
  15410. if int64(end)-int64(ptr) < int64(3) {
  15411. return -int32(2)
  15412. }
  15413. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  15414. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15415. return m_XML_TOK_INVALID
  15416. }
  15417. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0 {
  15418. ptr += uintptr(3)
  15419. tok = int32(m_XML_TOK_NAME)
  15420. goto _27
  15421. }
  15422. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0 {
  15423. ptr += uintptr(3)
  15424. tok = int32(m_XML_TOK_NMTOKEN)
  15425. goto _27
  15426. }
  15427. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15428. return m_XML_TOK_INVALID
  15429. _18:
  15430. ;
  15431. if int64(end)-int64(ptr) < int64(4) {
  15432. return -int32(2)
  15433. }
  15434. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  15435. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15436. return m_XML_TOK_INVALID
  15437. }
  15438. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0 {
  15439. ptr += uintptr(4)
  15440. tok = int32(m_XML_TOK_NAME)
  15441. goto _27
  15442. }
  15443. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0 {
  15444. ptr += uintptr(4)
  15445. tok = int32(m_XML_TOK_NMTOKEN)
  15446. goto _27
  15447. }
  15448. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15449. return m_XML_TOK_INVALID
  15450. _20:
  15451. ;
  15452. _19:
  15453. ;
  15454. tok = int32(m_XML_TOK_NAME)
  15455. ptr += uintptr(1)
  15456. goto _27
  15457. _24:
  15458. ;
  15459. _23:
  15460. ;
  15461. _22:
  15462. ;
  15463. _21:
  15464. ;
  15465. tok = int32(m_XML_TOK_NMTOKEN)
  15466. ptr += uintptr(1)
  15467. goto _27
  15468. _25:
  15469. ;
  15470. if 0 != 0 {
  15471. ptr += uintptr(1)
  15472. tok = int32(m_XML_TOK_NAME)
  15473. goto _27
  15474. }
  15475. if 0 != 0 {
  15476. ptr += uintptr(1)
  15477. tok = int32(m_XML_TOK_NMTOKEN)
  15478. goto _27
  15479. }
  15480. /* fall through */
  15481. _26:
  15482. ;
  15483. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15484. return m_XML_TOK_INVALID
  15485. _27:
  15486. ;
  15487. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15488. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15489. case int32(_BT_NONASCII):
  15490. if !(libc.Int32FromInt32(0) != 0) {
  15491. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15492. return m_XML_TOK_INVALID
  15493. } /* fall through */
  15494. fallthrough
  15495. case int32(_BT_NMSTRT):
  15496. fallthrough
  15497. case int32(_BT_HEX):
  15498. fallthrough
  15499. case int32(_BT_DIGIT):
  15500. fallthrough
  15501. case int32(_BT_NAME):
  15502. fallthrough
  15503. case int32(_BT_MINUS):
  15504. ptr += uintptr(1)
  15505. case int32(_BT_LEAD2):
  15506. if int64(end)-int64(ptr) < int64(2) {
  15507. return -int32(2)
  15508. }
  15509. 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) {
  15510. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15511. return m_XML_TOK_INVALID
  15512. }
  15513. ptr += uintptr(2)
  15514. case int32(_BT_LEAD3):
  15515. if int64(end)-int64(ptr) < int64(3) {
  15516. return -int32(2)
  15517. }
  15518. 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) {
  15519. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15520. return m_XML_TOK_INVALID
  15521. }
  15522. ptr += uintptr(3)
  15523. case int32(_BT_LEAD4):
  15524. if int64(end)-int64(ptr) < int64(4) {
  15525. return -int32(2)
  15526. }
  15527. 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) {
  15528. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15529. return m_XML_TOK_INVALID
  15530. }
  15531. ptr += uintptr(4)
  15532. case int32(_BT_GT):
  15533. fallthrough
  15534. case int32(_BT_RPAR):
  15535. fallthrough
  15536. case int32(_BT_COMMA):
  15537. fallthrough
  15538. case int32(_BT_VERBAR):
  15539. fallthrough
  15540. case int32(_BT_LSQB):
  15541. fallthrough
  15542. case int32(_BT_PERCNT):
  15543. fallthrough
  15544. case int32(_BT_S):
  15545. fallthrough
  15546. case int32(_BT_CR):
  15547. fallthrough
  15548. case int32(_BT_LF):
  15549. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15550. return tok
  15551. case int32(_BT_COLON):
  15552. ptr += uintptr(1)
  15553. switch tok {
  15554. case int32(m_XML_TOK_NAME):
  15555. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15556. return -int32(1)
  15557. }
  15558. tok = int32(m_XML_TOK_PREFIXED_NAME)
  15559. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15560. case int32(_BT_NONASCII):
  15561. if !(libc.Int32FromInt32(0) != 0) {
  15562. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15563. return m_XML_TOK_INVALID
  15564. } /* fall through */
  15565. fallthrough
  15566. case int32(_BT_NMSTRT):
  15567. fallthrough
  15568. case int32(_BT_HEX):
  15569. fallthrough
  15570. case int32(_BT_DIGIT):
  15571. fallthrough
  15572. case int32(_BT_NAME):
  15573. fallthrough
  15574. case int32(_BT_MINUS):
  15575. ptr += uintptr(1)
  15576. case int32(_BT_LEAD2):
  15577. if int64(end)-int64(ptr) < int64(2) {
  15578. return -int32(2)
  15579. }
  15580. 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) {
  15581. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15582. return m_XML_TOK_INVALID
  15583. }
  15584. ptr += uintptr(2)
  15585. case int32(_BT_LEAD3):
  15586. if int64(end)-int64(ptr) < int64(3) {
  15587. return -int32(2)
  15588. }
  15589. 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) {
  15590. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15591. return m_XML_TOK_INVALID
  15592. }
  15593. ptr += uintptr(3)
  15594. case int32(_BT_LEAD4):
  15595. if int64(end)-int64(ptr) < int64(4) {
  15596. return -int32(2)
  15597. }
  15598. 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) {
  15599. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15600. return m_XML_TOK_INVALID
  15601. }
  15602. ptr += uintptr(4)
  15603. default:
  15604. tok = int32(m_XML_TOK_NMTOKEN)
  15605. break
  15606. }
  15607. case int32(m_XML_TOK_PREFIXED_NAME):
  15608. tok = int32(m_XML_TOK_NMTOKEN)
  15609. break
  15610. }
  15611. case int32(_BT_PLUS):
  15612. if tok == int32(m_XML_TOK_NMTOKEN) {
  15613. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15614. return m_XML_TOK_INVALID
  15615. }
  15616. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15617. return int32(m_XML_TOK_NAME_PLUS)
  15618. case int32(_BT_AST):
  15619. if tok == int32(m_XML_TOK_NMTOKEN) {
  15620. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15621. return m_XML_TOK_INVALID
  15622. }
  15623. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15624. return int32(m_XML_TOK_NAME_ASTERISK)
  15625. case int32(_BT_QUEST):
  15626. if tok == int32(m_XML_TOK_NMTOKEN) {
  15627. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15628. return m_XML_TOK_INVALID
  15629. }
  15630. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15631. return int32(m_XML_TOK_NAME_QUESTION)
  15632. default:
  15633. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15634. return m_XML_TOK_INVALID
  15635. }
  15636. }
  15637. return -tok
  15638. }
  15639. func _normal_attributeValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15640. var start uintptr
  15641. _ = start
  15642. if ptr >= end {
  15643. return -int32(4)
  15644. } else {
  15645. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15646. /* This line cannot be executed. The incoming data has already
  15647. * been tokenized once, so incomplete characters like this have
  15648. * already been eliminated from the input. Retaining the paranoia
  15649. * check is still valuable, however.
  15650. */
  15651. return -int32(1) /* LCOV_EXCL_LINE */
  15652. }
  15653. }
  15654. start = ptr
  15655. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15656. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15657. case int32(_BT_LEAD2):
  15658. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  15659. case int32(_BT_LEAD3):
  15660. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  15661. case int32(_BT_LEAD4):
  15662. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  15663. case int32(_BT_AMP):
  15664. if ptr == start {
  15665. return _normal_scanRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15666. }
  15667. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15668. return int32(m_XML_TOK_DATA_CHARS)
  15669. case int32(_BT_LT):
  15670. /* this is for inside entity references */
  15671. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15672. return m_XML_TOK_INVALID
  15673. case int32(_BT_LF):
  15674. if ptr == start {
  15675. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15676. return int32(m_XML_TOK_DATA_NEWLINE)
  15677. }
  15678. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15679. return int32(m_XML_TOK_DATA_CHARS)
  15680. case int32(_BT_CR):
  15681. if ptr == start {
  15682. ptr += uintptr(1)
  15683. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15684. return -int32(3)
  15685. }
  15686. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) == int32(_BT_LF) {
  15687. ptr += uintptr(1)
  15688. }
  15689. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15690. return int32(m_XML_TOK_DATA_NEWLINE)
  15691. }
  15692. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15693. return int32(m_XML_TOK_DATA_CHARS)
  15694. case int32(_BT_S):
  15695. if ptr == start {
  15696. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15697. return int32(m_XML_TOK_ATTRIBUTE_VALUE_S)
  15698. }
  15699. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15700. return int32(m_XML_TOK_DATA_CHARS)
  15701. default:
  15702. ptr += uintptr(1)
  15703. break
  15704. }
  15705. }
  15706. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15707. return int32(m_XML_TOK_DATA_CHARS)
  15708. }
  15709. func _normal_entityValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15710. var start uintptr
  15711. var tok, v1 int32
  15712. _, _, _ = start, tok, v1
  15713. if ptr >= end {
  15714. return -int32(4)
  15715. } else {
  15716. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15717. /* This line cannot be executed. The incoming data has already
  15718. * been tokenized once, so incomplete characters like this have
  15719. * already been eliminated from the input. Retaining the paranoia
  15720. * check is still valuable, however.
  15721. */
  15722. return -int32(1) /* LCOV_EXCL_LINE */
  15723. }
  15724. }
  15725. start = ptr
  15726. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15727. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15728. case int32(_BT_LEAD2):
  15729. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  15730. case int32(_BT_LEAD3):
  15731. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  15732. case int32(_BT_LEAD4):
  15733. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  15734. case int32(_BT_AMP):
  15735. if ptr == start {
  15736. return _normal_scanRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15737. }
  15738. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15739. return int32(m_XML_TOK_DATA_CHARS)
  15740. case int32(_BT_PERCNT):
  15741. if ptr == start {
  15742. tok = _normal_scanPercent(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15743. if tok == int32(m_XML_TOK_PERCENT) {
  15744. v1 = m_XML_TOK_INVALID
  15745. } else {
  15746. v1 = tok
  15747. }
  15748. return v1
  15749. }
  15750. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15751. return int32(m_XML_TOK_DATA_CHARS)
  15752. case int32(_BT_LF):
  15753. if ptr == start {
  15754. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15755. return int32(m_XML_TOK_DATA_NEWLINE)
  15756. }
  15757. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15758. return int32(m_XML_TOK_DATA_CHARS)
  15759. case int32(_BT_CR):
  15760. if ptr == start {
  15761. ptr += uintptr(1)
  15762. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15763. return -int32(3)
  15764. }
  15765. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) == int32(_BT_LF) {
  15766. ptr += uintptr(1)
  15767. }
  15768. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15769. return int32(m_XML_TOK_DATA_NEWLINE)
  15770. }
  15771. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15772. return int32(m_XML_TOK_DATA_CHARS)
  15773. default:
  15774. ptr += uintptr(1)
  15775. break
  15776. }
  15777. }
  15778. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15779. return int32(m_XML_TOK_DATA_CHARS)
  15780. }
  15781. func _normal_ignoreSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15782. var level int32
  15783. var n Tsize_t
  15784. _, _ = level, n
  15785. level = 0
  15786. if int32(1) > int32(1) {
  15787. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  15788. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  15789. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  15790. end = ptr + uintptr(n)
  15791. }
  15792. }
  15793. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15794. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15795. case int32(_BT_LEAD2):
  15796. if int64(end)-int64(ptr) < int64(2) {
  15797. return -int32(2)
  15798. }
  15799. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  15800. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15801. return m_XML_TOK_INVALID
  15802. }
  15803. ptr += uintptr(2)
  15804. case int32(_BT_LEAD3):
  15805. if int64(end)-int64(ptr) < int64(3) {
  15806. return -int32(2)
  15807. }
  15808. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  15809. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15810. return m_XML_TOK_INVALID
  15811. }
  15812. ptr += uintptr(3)
  15813. case int32(_BT_LEAD4):
  15814. if int64(end)-int64(ptr) < int64(4) {
  15815. return -int32(2)
  15816. }
  15817. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  15818. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15819. return m_XML_TOK_INVALID
  15820. }
  15821. ptr += uintptr(4)
  15822. case int32(_BT_NONXML):
  15823. fallthrough
  15824. case int32(_BT_MALFORM):
  15825. fallthrough
  15826. case int32(_BT_TRAIL):
  15827. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15828. return m_XML_TOK_INVALID
  15829. case int32(_BT_LT):
  15830. ptr += uintptr(1)
  15831. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15832. return -int32(1)
  15833. }
  15834. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_EXCL2) {
  15835. ptr += uintptr(1)
  15836. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15837. return -int32(1)
  15838. }
  15839. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_LSQB1) {
  15840. level++
  15841. ptr += uintptr(1)
  15842. }
  15843. }
  15844. case int32(_BT_RSQB):
  15845. ptr += uintptr(1)
  15846. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15847. return -int32(1)
  15848. }
  15849. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  15850. ptr += uintptr(1)
  15851. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15852. return -int32(1)
  15853. }
  15854. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  15855. ptr += uintptr(1)
  15856. if level == 0 {
  15857. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15858. return int32(m_XML_TOK_IGNORE_SECT)
  15859. }
  15860. level--
  15861. }
  15862. }
  15863. default:
  15864. ptr += uintptr(1)
  15865. break
  15866. }
  15867. }
  15868. return -int32(1)
  15869. }
  15870. func _normal_isPublicId(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr) (r int32) {
  15871. ptr += uintptr(1)
  15872. end -= uintptr(1)
  15873. for {
  15874. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15875. break
  15876. }
  15877. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15878. case int32(_BT_DIGIT):
  15879. fallthrough
  15880. case int32(_BT_HEX):
  15881. fallthrough
  15882. case int32(_BT_MINUS):
  15883. fallthrough
  15884. case int32(_BT_APOS):
  15885. fallthrough
  15886. case int32(_BT_LPAR):
  15887. fallthrough
  15888. case int32(_BT_RPAR):
  15889. fallthrough
  15890. case int32(_BT_PLUS):
  15891. fallthrough
  15892. case int32(_BT_COMMA):
  15893. fallthrough
  15894. case int32(_BT_SOL):
  15895. fallthrough
  15896. case int32(_BT_EQUALS):
  15897. fallthrough
  15898. case int32(_BT_QUEST):
  15899. fallthrough
  15900. case int32(_BT_CR):
  15901. fallthrough
  15902. case int32(_BT_LF):
  15903. fallthrough
  15904. case int32(_BT_SEMI):
  15905. fallthrough
  15906. case int32(_BT_EXCL):
  15907. fallthrough
  15908. case int32(_BT_AST):
  15909. fallthrough
  15910. case int32(_BT_PERCNT):
  15911. fallthrough
  15912. case int32(_BT_NUM):
  15913. fallthrough
  15914. case int32(_BT_COLON):
  15915. case int32(_BT_S):
  15916. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_TAB1) {
  15917. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  15918. return 0
  15919. }
  15920. case int32(_BT_NAME):
  15921. fallthrough
  15922. case int32(_BT_NMSTRT):
  15923. if !(int32(*(*int8)(unsafe.Pointer(ptr))) & ^libc.Int32FromInt32(0x7f) != 0) {
  15924. break
  15925. }
  15926. /* fall through */
  15927. fallthrough
  15928. default:
  15929. switch int32(*(*int8)(unsafe.Pointer(ptr))) {
  15930. case int32(0x24): /* $ */
  15931. fallthrough
  15932. case int32(0x40): /* @ */
  15933. default:
  15934. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  15935. return 0
  15936. }
  15937. break
  15938. }
  15939. goto _1
  15940. _1:
  15941. ;
  15942. ptr += uintptr(1)
  15943. }
  15944. return int32(1)
  15945. }
  15946. /* This must only be called for a well-formed start-tag or empty
  15947. element tag. Returns the number of attributes. Pointers to the
  15948. first attsMax attributes are stored in atts.
  15949. */
  15950. func _normal_getAtts(tls *libc.TLS, enc uintptr, ptr uintptr, attsMax int32, atts uintptr) (r int32) {
  15951. var nAtts, open, state int32
  15952. _, _, _ = nAtts, open, state
  15953. state = 1
  15954. nAtts = 0
  15955. open = 0 /* defined when state == inValue;
  15956. initialization just to shut up compilers */
  15957. ptr += uintptr(1)
  15958. for {
  15959. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15960. case int32(_BT_LEAD2):
  15961. if state == 0 {
  15962. if nAtts < attsMax {
  15963. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  15964. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  15965. }
  15966. state = 1
  15967. }
  15968. ptr += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(1))
  15969. case int32(_BT_LEAD3):
  15970. if state == 0 {
  15971. if nAtts < attsMax {
  15972. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  15973. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  15974. }
  15975. state = 1
  15976. }
  15977. ptr += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(1))
  15978. case int32(_BT_LEAD4):
  15979. if state == 0 {
  15980. if nAtts < attsMax {
  15981. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  15982. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  15983. }
  15984. state = 1
  15985. }
  15986. ptr += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(1))
  15987. case int32(_BT_NONASCII):
  15988. fallthrough
  15989. case int32(_BT_NMSTRT):
  15990. fallthrough
  15991. case int32(_BT_HEX):
  15992. if state == 0 {
  15993. if nAtts < attsMax {
  15994. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  15995. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  15996. }
  15997. state = 1
  15998. }
  15999. case int32(_BT_QUOT):
  16000. if state != 2 {
  16001. if nAtts < attsMax {
  16002. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(1)
  16003. }
  16004. state = 2
  16005. open = int32(_BT_QUOT)
  16006. } else {
  16007. if open == int32(_BT_QUOT) {
  16008. state = 0
  16009. if nAtts < attsMax {
  16010. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  16011. }
  16012. nAtts++
  16013. }
  16014. }
  16015. case int32(_BT_APOS):
  16016. if state != 2 {
  16017. if nAtts < attsMax {
  16018. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(1)
  16019. }
  16020. state = 2
  16021. open = int32(_BT_APOS)
  16022. } else {
  16023. if open == int32(_BT_APOS) {
  16024. state = 0
  16025. if nAtts < attsMax {
  16026. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  16027. }
  16028. nAtts++
  16029. }
  16030. }
  16031. case int32(_BT_AMP):
  16032. if nAtts < attsMax {
  16033. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  16034. }
  16035. case int32(_BT_S):
  16036. if state == 1 {
  16037. state = 0
  16038. } else {
  16039. if state == 2 && nAtts < attsMax && (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized != 0 && (ptr == (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr || int32(*(*int8)(unsafe.Pointer(ptr))) != int32(m_ASCII_SPACE1) || int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == int32(m_ASCII_SPACE1) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))))))) == open) {
  16040. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  16041. }
  16042. }
  16043. case int32(_BT_CR):
  16044. fallthrough
  16045. case int32(_BT_LF):
  16046. /* This case ensures that the first attribute name is counted
  16047. Apart from that we could just change state on the quote. */
  16048. if state == 1 {
  16049. state = 0
  16050. } else {
  16051. if state == 2 && nAtts < attsMax {
  16052. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  16053. }
  16054. }
  16055. case int32(_BT_GT):
  16056. fallthrough
  16057. case int32(_BT_SOL):
  16058. if state != 2 {
  16059. return nAtts
  16060. }
  16061. default:
  16062. break
  16063. }
  16064. goto _1
  16065. _1:
  16066. ;
  16067. ptr += uintptr(1)
  16068. }
  16069. /* not reached */
  16070. return r
  16071. }
  16072. func _normal_charRefNumber(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  16073. var c, c1, result int32
  16074. _, _, _ = c, c1, result
  16075. result = 0
  16076. /* skip &# */
  16077. _ = enc
  16078. ptr += uintptr(libc.Int32FromInt32(2) * libc.Int32FromInt32(1))
  16079. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  16080. ptr += uintptr(1)
  16081. for {
  16082. if !!(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_SEMI1)) {
  16083. break
  16084. }
  16085. c = int32(*(*int8)(unsafe.Pointer(ptr)))
  16086. switch c {
  16087. case int32(m_ASCII_02):
  16088. fallthrough
  16089. case int32(m_ASCII_12):
  16090. fallthrough
  16091. case int32(m_ASCII_22):
  16092. fallthrough
  16093. case int32(m_ASCII_32):
  16094. fallthrough
  16095. case int32(m_ASCII_41):
  16096. fallthrough
  16097. case int32(m_ASCII_51):
  16098. fallthrough
  16099. case int32(m_ASCII_61):
  16100. fallthrough
  16101. case int32(m_ASCII_71):
  16102. fallthrough
  16103. case int32(m_ASCII_82):
  16104. fallthrough
  16105. case int32(m_ASCII_92):
  16106. result <<= int32(4)
  16107. result |= c - int32(m_ASCII_02)
  16108. case int32(m_ASCII_A):
  16109. fallthrough
  16110. case int32(m_ASCII_B1):
  16111. fallthrough
  16112. case int32(m_ASCII_C):
  16113. fallthrough
  16114. case int32(m_ASCII_D):
  16115. fallthrough
  16116. case int32(m_ASCII_E):
  16117. fallthrough
  16118. case int32(m_ASCII_F):
  16119. result <<= int32(4)
  16120. result += int32(10) + (c - int32(m_ASCII_A))
  16121. case int32(m_ASCII_a2):
  16122. fallthrough
  16123. case int32(m_ASCII_b1):
  16124. fallthrough
  16125. case int32(m_ASCII_c2):
  16126. fallthrough
  16127. case int32(m_ASCII_d1):
  16128. fallthrough
  16129. case int32(m_ASCII_e2):
  16130. fallthrough
  16131. case int32(m_ASCII_f1):
  16132. result <<= int32(4)
  16133. result += int32(10) + (c - int32(m_ASCII_a2))
  16134. break
  16135. }
  16136. if result >= int32(0x110000) {
  16137. return -int32(1)
  16138. }
  16139. goto _1
  16140. _1:
  16141. ;
  16142. ptr += uintptr(1)
  16143. }
  16144. } else {
  16145. for {
  16146. if !!(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_SEMI1)) {
  16147. break
  16148. }
  16149. c1 = int32(*(*int8)(unsafe.Pointer(ptr)))
  16150. result *= int32(10)
  16151. result += c1 - int32(m_ASCII_02)
  16152. if result >= int32(0x110000) {
  16153. return -int32(1)
  16154. }
  16155. goto _2
  16156. _2:
  16157. ;
  16158. ptr += uintptr(1)
  16159. }
  16160. }
  16161. return _checkCharRefNumber(tls, result)
  16162. }
  16163. func _normal_predefinedEntityName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr) (r int32) {
  16164. _ = enc
  16165. switch (int64(end) - int64(ptr)) / libc.Int64FromInt32(1) {
  16166. case int64(2):
  16167. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == int32(m_ASCII_t2) {
  16168. switch int32(*(*int8)(unsafe.Pointer(ptr))) {
  16169. case int32(m_ASCII_l2):
  16170. return int32(m_ASCII_LT1)
  16171. case int32(m_ASCII_g2):
  16172. return int32(m_ASCII_GT1)
  16173. }
  16174. }
  16175. case int64(3):
  16176. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_a2) {
  16177. ptr += uintptr(1)
  16178. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_m2) {
  16179. ptr += uintptr(1)
  16180. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  16181. return int32(m_ASCII_AMP1)
  16182. }
  16183. }
  16184. }
  16185. case int64(4):
  16186. switch int32(*(*int8)(unsafe.Pointer(ptr))) {
  16187. case int32(m_ASCII_q1):
  16188. ptr += uintptr(1)
  16189. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_u1) {
  16190. ptr += uintptr(1)
  16191. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  16192. ptr += uintptr(1)
  16193. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_t2) {
  16194. return int32(m_ASCII_QUOT1)
  16195. }
  16196. }
  16197. }
  16198. case int32(m_ASCII_a2):
  16199. ptr += uintptr(1)
  16200. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  16201. ptr += uintptr(1)
  16202. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  16203. ptr += uintptr(1)
  16204. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_s2) {
  16205. return int32(m_ASCII_APOS1)
  16206. }
  16207. }
  16208. }
  16209. break
  16210. }
  16211. }
  16212. return 0
  16213. }
  16214. func _normal_nameMatchesAscii(tls *libc.TLS, enc uintptr, ptr1 uintptr, end1 uintptr, ptr2 uintptr) (r int32) {
  16215. _ = enc
  16216. for {
  16217. if !(*(*int8)(unsafe.Pointer(ptr2)) != 0) {
  16218. break
  16219. }
  16220. if int64(end1)-int64(ptr1) < int64(1) {
  16221. /* This line cannot be executed. The incoming data has already
  16222. * been tokenized once, so incomplete characters like this have
  16223. * already been eliminated from the input. Retaining the
  16224. * paranoia check is still valuable, however.
  16225. */
  16226. return 0 /* LCOV_EXCL_LINE */
  16227. }
  16228. if !(int32(*(*int8)(unsafe.Pointer(ptr1))) == int32(*(*int8)(unsafe.Pointer(ptr2)))) {
  16229. return 0
  16230. }
  16231. goto _1
  16232. _1:
  16233. ;
  16234. ptr1 += uintptr(1)
  16235. ptr2++
  16236. }
  16237. return libc.BoolInt32(ptr1 == end1)
  16238. }
  16239. func _normal_nameLength(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  16240. var start uintptr
  16241. _ = start
  16242. start = ptr
  16243. for {
  16244. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  16245. case int32(_BT_LEAD2):
  16246. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  16247. case int32(_BT_LEAD3):
  16248. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  16249. case int32(_BT_LEAD4):
  16250. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  16251. case int32(_BT_NONASCII):
  16252. fallthrough
  16253. case int32(_BT_NMSTRT):
  16254. fallthrough
  16255. case int32(_BT_COLON):
  16256. fallthrough
  16257. case int32(_BT_HEX):
  16258. fallthrough
  16259. case int32(_BT_DIGIT):
  16260. fallthrough
  16261. case int32(_BT_NAME):
  16262. fallthrough
  16263. case int32(_BT_MINUS):
  16264. ptr += uintptr(1)
  16265. default:
  16266. return int32(int64(ptr) - int64(start))
  16267. }
  16268. goto _1
  16269. _1:
  16270. }
  16271. return r
  16272. }
  16273. func _normal_skipS(tls *libc.TLS, enc uintptr, ptr uintptr) (r uintptr) {
  16274. for {
  16275. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  16276. case int32(_BT_LF):
  16277. fallthrough
  16278. case int32(_BT_CR):
  16279. fallthrough
  16280. case int32(_BT_S):
  16281. ptr += uintptr(1)
  16282. default:
  16283. return ptr
  16284. }
  16285. goto _1
  16286. _1:
  16287. }
  16288. return r
  16289. }
  16290. func _normal_updatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  16291. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  16292. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  16293. case int32(_BT_LEAD2):
  16294. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  16295. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  16296. case int32(_BT_LEAD3):
  16297. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  16298. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  16299. case int32(_BT_LEAD4):
  16300. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  16301. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  16302. case int32(_BT_LF):
  16303. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  16304. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  16305. ptr += uintptr(1)
  16306. case int32(_BT_CR):
  16307. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  16308. ptr += uintptr(1)
  16309. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) == int32(_BT_LF) {
  16310. ptr += uintptr(1)
  16311. }
  16312. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  16313. default:
  16314. ptr += uintptr(1)
  16315. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  16316. break
  16317. }
  16318. }
  16319. }
  16320. const /* UTF8_cvalN is value of masked first byte of N byte sequence */
  16321. _UTF8_cval1 = 0
  16322. const _UTF8_cval2 = 192
  16323. const _UTF8_cval3 = 224
  16324. const _UTF8_cval4 = 240
  16325. func X_INTERNAL_trim_to_complete_utf8_characters(tls *libc.TLS, from uintptr, fromLimRef uintptr) {
  16326. var fromLim uintptr
  16327. var prev uint8
  16328. var walked Tsize_t
  16329. _, _, _ = fromLim, prev, walked
  16330. fromLim = *(*uintptr)(unsafe.Pointer(fromLimRef))
  16331. walked = uint64(0)
  16332. for {
  16333. if !(fromLim > from) {
  16334. break
  16335. }
  16336. prev = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(fromLim + uintptr(-libc.Int32FromInt32(1)))))
  16337. if uint32(prev)&uint32(0xf8) == uint32(0xf0) { /* 4-byte character, lead by 0b11110xxx byte */
  16338. if walked+uint64(1) >= uint64(4) {
  16339. fromLim += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(1))
  16340. break
  16341. } else {
  16342. walked = uint64(0)
  16343. }
  16344. } else {
  16345. if uint32(prev)&uint32(0xf0) == uint32(0xe0) { /* 3-byte character, lead by 0b1110xxxx byte */
  16346. if walked+uint64(1) >= uint64(3) {
  16347. fromLim += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(1))
  16348. break
  16349. } else {
  16350. walked = uint64(0)
  16351. }
  16352. } else {
  16353. if uint32(prev)&uint32(0xe0) == uint32(0xc0) { /* 2-byte character, lead by 0b110xxxxx byte */
  16354. if walked+uint64(1) >= uint64(2) {
  16355. fromLim += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(1))
  16356. break
  16357. } else {
  16358. walked = uint64(0)
  16359. }
  16360. } else {
  16361. if uint32(prev)&uint32(0x80) == 0x00 { /* 1-byte character, matching 0b0xxxxxxx */
  16362. break
  16363. }
  16364. }
  16365. }
  16366. }
  16367. goto _1
  16368. _1:
  16369. ;
  16370. fromLim--
  16371. walked++
  16372. }
  16373. *(*uintptr)(unsafe.Pointer(fromLimRef)) = fromLim
  16374. }
  16375. func _utf8_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, _fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  16376. bp := tls.Alloc(16)
  16377. defer tls.Free(16)
  16378. *(*uintptr)(unsafe.Pointer(bp)) = _fromLim
  16379. var bytesAvailable, bytesStorable, bytesToCopy Tptrdiff_t
  16380. var fromLimBefore uintptr
  16381. var input_incomplete, output_exhausted uint8
  16382. _, _, _, _, _, _ = bytesAvailable, bytesStorable, bytesToCopy, fromLimBefore, input_incomplete, output_exhausted
  16383. input_incomplete = uint8(m_false)
  16384. output_exhausted = uint8(m_false)
  16385. /* Avoid copying partial characters (due to limited space). */
  16386. bytesAvailable = int64(*(*uintptr)(unsafe.Pointer(bp))) - int64(*(*uintptr)(unsafe.Pointer(fromP)))
  16387. bytesStorable = int64(toLim) - int64(*(*uintptr)(unsafe.Pointer(toP)))
  16388. _ = enc
  16389. if bytesAvailable > bytesStorable {
  16390. *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(fromP)) + uintptr(bytesStorable)
  16391. output_exhausted = uint8(m_true)
  16392. }
  16393. /* Avoid copying partial characters (from incomplete input). */
  16394. fromLimBefore = *(*uintptr)(unsafe.Pointer(bp))
  16395. X_INTERNAL_trim_to_complete_utf8_characters(tls, *(*uintptr)(unsafe.Pointer(fromP)), bp)
  16396. if *(*uintptr)(unsafe.Pointer(bp)) < fromLimBefore {
  16397. input_incomplete = uint8(m_true)
  16398. }
  16399. bytesToCopy = int64(*(*uintptr)(unsafe.Pointer(bp))) - int64(*(*uintptr)(unsafe.Pointer(fromP)))
  16400. libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(toP)), *(*uintptr)(unsafe.Pointer(fromP)), libc.Uint64FromInt64(bytesToCopy))
  16401. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(bytesToCopy)
  16402. *(*uintptr)(unsafe.Pointer(toP)) += uintptr(bytesToCopy)
  16403. if output_exhausted != 0 { /* needs to go first */
  16404. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  16405. } else {
  16406. if input_incomplete != 0 {
  16407. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16408. } else {
  16409. return int32(_XML_CONVERT_COMPLETED)
  16410. }
  16411. }
  16412. return r
  16413. }
  16414. func _utf8_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  16415. var from, to, v1, v2, v3, v4 uintptr
  16416. var n uint64
  16417. var res _XML_Convert_Result
  16418. _, _, _, _, _, _, _, _ = from, n, res, to, v1, v2, v3, v4
  16419. res = int32(_XML_CONVERT_COMPLETED)
  16420. to = *(*uintptr)(unsafe.Pointer(toP))
  16421. from = *(*uintptr)(unsafe.Pointer(fromP))
  16422. for from < fromLim && to < toLim {
  16423. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from))))))) {
  16424. case int32(_BT_LEAD2):
  16425. if int64(fromLim)-int64(from) < int64(2) {
  16426. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16427. goto after
  16428. }
  16429. v1 = to
  16430. to += 2
  16431. *(*uint16)(unsafe.Pointer(v1)) = libc.Uint16FromInt32(int32(*(*int8)(unsafe.Pointer(from)))&libc.Int32FromInt32(0x1f)<<libc.Int32FromInt32(6) | int32(*(*int8)(unsafe.Pointer(from + 1)))&libc.Int32FromInt32(0x3f))
  16432. from += uintptr(2)
  16433. case int32(_BT_LEAD3):
  16434. if int64(fromLim)-int64(from) < int64(3) {
  16435. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16436. goto after
  16437. }
  16438. v2 = to
  16439. to += 2
  16440. *(*uint16)(unsafe.Pointer(v2)) = libc.Uint16FromInt32(int32(*(*int8)(unsafe.Pointer(from)))&libc.Int32FromInt32(0xf)<<libc.Int32FromInt32(12) | int32(*(*int8)(unsafe.Pointer(from + 1)))&libc.Int32FromInt32(0x3f)<<libc.Int32FromInt32(6) | int32(*(*int8)(unsafe.Pointer(from + 2)))&libc.Int32FromInt32(0x3f))
  16441. from += uintptr(3)
  16442. case int32(_BT_LEAD4):
  16443. if (int64(toLim)-int64(to))/2 < int64(2) {
  16444. res = int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  16445. goto after
  16446. }
  16447. if int64(fromLim)-int64(from) < int64(4) {
  16448. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16449. goto after
  16450. }
  16451. n = libc.Uint64FromInt32(int32(*(*int8)(unsafe.Pointer(from)))&int32(0x7)<<int32(18) | int32(*(*int8)(unsafe.Pointer(from + 1)))&int32(0x3f)<<int32(12) | int32(*(*int8)(unsafe.Pointer(from + 2)))&int32(0x3f)<<int32(6) | int32(*(*int8)(unsafe.Pointer(from + 3)))&int32(0x3f))
  16452. n -= uint64(0x10000)
  16453. *(*uint16)(unsafe.Pointer(to)) = uint16(n>>libc.Int32FromInt32(10) | libc.Uint64FromInt32(0xD800))
  16454. *(*uint16)(unsafe.Pointer(to + 1*2)) = uint16(n&libc.Uint64FromInt32(0x3FF) | libc.Uint64FromInt32(0xDC00))
  16455. to += uintptr(2) * 2
  16456. from += uintptr(4)
  16457. default:
  16458. v3 = to
  16459. to += 2
  16460. v4 = from
  16461. from++
  16462. *(*uint16)(unsafe.Pointer(v3)) = libc.Uint16FromInt8(*(*int8)(unsafe.Pointer(v4)))
  16463. break
  16464. }
  16465. }
  16466. if from < fromLim {
  16467. res = int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  16468. }
  16469. goto after
  16470. after:
  16471. ;
  16472. *(*uintptr)(unsafe.Pointer(fromP)) = from
  16473. *(*uintptr)(unsafe.Pointer(toP)) = to
  16474. return res
  16475. }
  16476. var _utf8_encoding_ns = Tnormal_encoding{
  16477. Fenc: TENCODING{
  16478. Fscanners: [4]TSCANNER{},
  16479. FliteralScanners: [2]TSCANNER{},
  16480. FminBytesPerChar: int32(1),
  16481. FisUtf8: int8(1),
  16482. },
  16483. Ftype1: [256]uint8{
  16484. 9: uint8(_BT_S),
  16485. 10: uint8(_BT_LF),
  16486. 13: uint8(_BT_CR),
  16487. 32: uint8(_BT_S),
  16488. 33: uint8(_BT_EXCL),
  16489. 34: uint8(_BT_QUOT),
  16490. 35: uint8(_BT_NUM),
  16491. 36: uint8(_BT_OTHER),
  16492. 37: uint8(_BT_PERCNT),
  16493. 38: uint8(_BT_AMP),
  16494. 39: uint8(_BT_APOS),
  16495. 40: uint8(_BT_LPAR),
  16496. 41: uint8(_BT_RPAR),
  16497. 42: uint8(_BT_AST),
  16498. 43: uint8(_BT_PLUS),
  16499. 44: uint8(_BT_COMMA),
  16500. 45: uint8(_BT_MINUS),
  16501. 46: uint8(_BT_NAME),
  16502. 47: uint8(_BT_SOL),
  16503. 48: uint8(_BT_DIGIT),
  16504. 49: uint8(_BT_DIGIT),
  16505. 50: uint8(_BT_DIGIT),
  16506. 51: uint8(_BT_DIGIT),
  16507. 52: uint8(_BT_DIGIT),
  16508. 53: uint8(_BT_DIGIT),
  16509. 54: uint8(_BT_DIGIT),
  16510. 55: uint8(_BT_DIGIT),
  16511. 56: uint8(_BT_DIGIT),
  16512. 57: uint8(_BT_DIGIT),
  16513. 58: uint8(_BT_COLON),
  16514. 59: uint8(_BT_SEMI),
  16515. 60: uint8(_BT_LT),
  16516. 61: uint8(_BT_EQUALS),
  16517. 62: uint8(_BT_GT),
  16518. 63: uint8(_BT_QUEST),
  16519. 64: uint8(_BT_OTHER),
  16520. 65: uint8(_BT_HEX),
  16521. 66: uint8(_BT_HEX),
  16522. 67: uint8(_BT_HEX),
  16523. 68: uint8(_BT_HEX),
  16524. 69: uint8(_BT_HEX),
  16525. 70: uint8(_BT_HEX),
  16526. 71: uint8(_BT_NMSTRT),
  16527. 72: uint8(_BT_NMSTRT),
  16528. 73: uint8(_BT_NMSTRT),
  16529. 74: uint8(_BT_NMSTRT),
  16530. 75: uint8(_BT_NMSTRT),
  16531. 76: uint8(_BT_NMSTRT),
  16532. 77: uint8(_BT_NMSTRT),
  16533. 78: uint8(_BT_NMSTRT),
  16534. 79: uint8(_BT_NMSTRT),
  16535. 80: uint8(_BT_NMSTRT),
  16536. 81: uint8(_BT_NMSTRT),
  16537. 82: uint8(_BT_NMSTRT),
  16538. 83: uint8(_BT_NMSTRT),
  16539. 84: uint8(_BT_NMSTRT),
  16540. 85: uint8(_BT_NMSTRT),
  16541. 86: uint8(_BT_NMSTRT),
  16542. 87: uint8(_BT_NMSTRT),
  16543. 88: uint8(_BT_NMSTRT),
  16544. 89: uint8(_BT_NMSTRT),
  16545. 90: uint8(_BT_NMSTRT),
  16546. 91: uint8(_BT_LSQB),
  16547. 92: uint8(_BT_OTHER),
  16548. 93: uint8(_BT_RSQB),
  16549. 94: uint8(_BT_OTHER),
  16550. 95: uint8(_BT_NMSTRT),
  16551. 96: uint8(_BT_OTHER),
  16552. 97: uint8(_BT_HEX),
  16553. 98: uint8(_BT_HEX),
  16554. 99: uint8(_BT_HEX),
  16555. 100: uint8(_BT_HEX),
  16556. 101: uint8(_BT_HEX),
  16557. 102: uint8(_BT_HEX),
  16558. 103: uint8(_BT_NMSTRT),
  16559. 104: uint8(_BT_NMSTRT),
  16560. 105: uint8(_BT_NMSTRT),
  16561. 106: uint8(_BT_NMSTRT),
  16562. 107: uint8(_BT_NMSTRT),
  16563. 108: uint8(_BT_NMSTRT),
  16564. 109: uint8(_BT_NMSTRT),
  16565. 110: uint8(_BT_NMSTRT),
  16566. 111: uint8(_BT_NMSTRT),
  16567. 112: uint8(_BT_NMSTRT),
  16568. 113: uint8(_BT_NMSTRT),
  16569. 114: uint8(_BT_NMSTRT),
  16570. 115: uint8(_BT_NMSTRT),
  16571. 116: uint8(_BT_NMSTRT),
  16572. 117: uint8(_BT_NMSTRT),
  16573. 118: uint8(_BT_NMSTRT),
  16574. 119: uint8(_BT_NMSTRT),
  16575. 120: uint8(_BT_NMSTRT),
  16576. 121: uint8(_BT_NMSTRT),
  16577. 122: uint8(_BT_NMSTRT),
  16578. 123: uint8(_BT_OTHER),
  16579. 124: uint8(_BT_VERBAR),
  16580. 125: uint8(_BT_OTHER),
  16581. 126: uint8(_BT_OTHER),
  16582. 127: uint8(_BT_OTHER),
  16583. 128: uint8(_BT_TRAIL),
  16584. 129: uint8(_BT_TRAIL),
  16585. 130: uint8(_BT_TRAIL),
  16586. 131: uint8(_BT_TRAIL),
  16587. 132: uint8(_BT_TRAIL),
  16588. 133: uint8(_BT_TRAIL),
  16589. 134: uint8(_BT_TRAIL),
  16590. 135: uint8(_BT_TRAIL),
  16591. 136: uint8(_BT_TRAIL),
  16592. 137: uint8(_BT_TRAIL),
  16593. 138: uint8(_BT_TRAIL),
  16594. 139: uint8(_BT_TRAIL),
  16595. 140: uint8(_BT_TRAIL),
  16596. 141: uint8(_BT_TRAIL),
  16597. 142: uint8(_BT_TRAIL),
  16598. 143: uint8(_BT_TRAIL),
  16599. 144: uint8(_BT_TRAIL),
  16600. 145: uint8(_BT_TRAIL),
  16601. 146: uint8(_BT_TRAIL),
  16602. 147: uint8(_BT_TRAIL),
  16603. 148: uint8(_BT_TRAIL),
  16604. 149: uint8(_BT_TRAIL),
  16605. 150: uint8(_BT_TRAIL),
  16606. 151: uint8(_BT_TRAIL),
  16607. 152: uint8(_BT_TRAIL),
  16608. 153: uint8(_BT_TRAIL),
  16609. 154: uint8(_BT_TRAIL),
  16610. 155: uint8(_BT_TRAIL),
  16611. 156: uint8(_BT_TRAIL),
  16612. 157: uint8(_BT_TRAIL),
  16613. 158: uint8(_BT_TRAIL),
  16614. 159: uint8(_BT_TRAIL),
  16615. 160: uint8(_BT_TRAIL),
  16616. 161: uint8(_BT_TRAIL),
  16617. 162: uint8(_BT_TRAIL),
  16618. 163: uint8(_BT_TRAIL),
  16619. 164: uint8(_BT_TRAIL),
  16620. 165: uint8(_BT_TRAIL),
  16621. 166: uint8(_BT_TRAIL),
  16622. 167: uint8(_BT_TRAIL),
  16623. 168: uint8(_BT_TRAIL),
  16624. 169: uint8(_BT_TRAIL),
  16625. 170: uint8(_BT_TRAIL),
  16626. 171: uint8(_BT_TRAIL),
  16627. 172: uint8(_BT_TRAIL),
  16628. 173: uint8(_BT_TRAIL),
  16629. 174: uint8(_BT_TRAIL),
  16630. 175: uint8(_BT_TRAIL),
  16631. 176: uint8(_BT_TRAIL),
  16632. 177: uint8(_BT_TRAIL),
  16633. 178: uint8(_BT_TRAIL),
  16634. 179: uint8(_BT_TRAIL),
  16635. 180: uint8(_BT_TRAIL),
  16636. 181: uint8(_BT_TRAIL),
  16637. 182: uint8(_BT_TRAIL),
  16638. 183: uint8(_BT_TRAIL),
  16639. 184: uint8(_BT_TRAIL),
  16640. 185: uint8(_BT_TRAIL),
  16641. 186: uint8(_BT_TRAIL),
  16642. 187: uint8(_BT_TRAIL),
  16643. 188: uint8(_BT_TRAIL),
  16644. 189: uint8(_BT_TRAIL),
  16645. 190: uint8(_BT_TRAIL),
  16646. 191: uint8(_BT_TRAIL),
  16647. 192: uint8(_BT_LEAD2),
  16648. 193: uint8(_BT_LEAD2),
  16649. 194: uint8(_BT_LEAD2),
  16650. 195: uint8(_BT_LEAD2),
  16651. 196: uint8(_BT_LEAD2),
  16652. 197: uint8(_BT_LEAD2),
  16653. 198: uint8(_BT_LEAD2),
  16654. 199: uint8(_BT_LEAD2),
  16655. 200: uint8(_BT_LEAD2),
  16656. 201: uint8(_BT_LEAD2),
  16657. 202: uint8(_BT_LEAD2),
  16658. 203: uint8(_BT_LEAD2),
  16659. 204: uint8(_BT_LEAD2),
  16660. 205: uint8(_BT_LEAD2),
  16661. 206: uint8(_BT_LEAD2),
  16662. 207: uint8(_BT_LEAD2),
  16663. 208: uint8(_BT_LEAD2),
  16664. 209: uint8(_BT_LEAD2),
  16665. 210: uint8(_BT_LEAD2),
  16666. 211: uint8(_BT_LEAD2),
  16667. 212: uint8(_BT_LEAD2),
  16668. 213: uint8(_BT_LEAD2),
  16669. 214: uint8(_BT_LEAD2),
  16670. 215: uint8(_BT_LEAD2),
  16671. 216: uint8(_BT_LEAD2),
  16672. 217: uint8(_BT_LEAD2),
  16673. 218: uint8(_BT_LEAD2),
  16674. 219: uint8(_BT_LEAD2),
  16675. 220: uint8(_BT_LEAD2),
  16676. 221: uint8(_BT_LEAD2),
  16677. 222: uint8(_BT_LEAD2),
  16678. 223: uint8(_BT_LEAD2),
  16679. 224: uint8(_BT_LEAD3),
  16680. 225: uint8(_BT_LEAD3),
  16681. 226: uint8(_BT_LEAD3),
  16682. 227: uint8(_BT_LEAD3),
  16683. 228: uint8(_BT_LEAD3),
  16684. 229: uint8(_BT_LEAD3),
  16685. 230: uint8(_BT_LEAD3),
  16686. 231: uint8(_BT_LEAD3),
  16687. 232: uint8(_BT_LEAD3),
  16688. 233: uint8(_BT_LEAD3),
  16689. 234: uint8(_BT_LEAD3),
  16690. 235: uint8(_BT_LEAD3),
  16691. 236: uint8(_BT_LEAD3),
  16692. 237: uint8(_BT_LEAD3),
  16693. 238: uint8(_BT_LEAD3),
  16694. 239: uint8(_BT_LEAD3),
  16695. 240: uint8(_BT_LEAD4),
  16696. 241: uint8(_BT_LEAD4),
  16697. 242: uint8(_BT_LEAD4),
  16698. 243: uint8(_BT_LEAD4),
  16699. 244: uint8(_BT_LEAD4),
  16700. 254: uint8(_BT_MALFORM),
  16701. 255: uint8(_BT_MALFORM),
  16702. },
  16703. }
  16704. func init() {
  16705. p := unsafe.Pointer(&_utf8_encoding_ns)
  16706. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  16707. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  16708. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  16709. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  16710. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  16711. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  16712. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  16713. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  16714. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  16715. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  16716. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  16717. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  16718. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  16719. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  16720. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  16721. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  16722. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  16723. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  16724. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  16725. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  16726. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  16727. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  16728. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  16729. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  16730. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  16731. }
  16732. var _utf8_encoding = Tnormal_encoding{
  16733. Fenc: TENCODING{
  16734. Fscanners: [4]TSCANNER{},
  16735. FliteralScanners: [2]TSCANNER{},
  16736. FminBytesPerChar: int32(1),
  16737. FisUtf8: int8(1),
  16738. },
  16739. Ftype1: [256]uint8{
  16740. 9: uint8(_BT_S),
  16741. 10: uint8(_BT_LF),
  16742. 13: uint8(_BT_CR),
  16743. 32: uint8(_BT_S),
  16744. 33: uint8(_BT_EXCL),
  16745. 34: uint8(_BT_QUOT),
  16746. 35: uint8(_BT_NUM),
  16747. 36: uint8(_BT_OTHER),
  16748. 37: uint8(_BT_PERCNT),
  16749. 38: uint8(_BT_AMP),
  16750. 39: uint8(_BT_APOS),
  16751. 40: uint8(_BT_LPAR),
  16752. 41: uint8(_BT_RPAR),
  16753. 42: uint8(_BT_AST),
  16754. 43: uint8(_BT_PLUS),
  16755. 44: uint8(_BT_COMMA),
  16756. 45: uint8(_BT_MINUS),
  16757. 46: uint8(_BT_NAME),
  16758. 47: uint8(_BT_SOL),
  16759. 48: uint8(_BT_DIGIT),
  16760. 49: uint8(_BT_DIGIT),
  16761. 50: uint8(_BT_DIGIT),
  16762. 51: uint8(_BT_DIGIT),
  16763. 52: uint8(_BT_DIGIT),
  16764. 53: uint8(_BT_DIGIT),
  16765. 54: uint8(_BT_DIGIT),
  16766. 55: uint8(_BT_DIGIT),
  16767. 56: uint8(_BT_DIGIT),
  16768. 57: uint8(_BT_DIGIT),
  16769. 58: uint8(_BT_NMSTRT),
  16770. 59: uint8(_BT_SEMI),
  16771. 60: uint8(_BT_LT),
  16772. 61: uint8(_BT_EQUALS),
  16773. 62: uint8(_BT_GT),
  16774. 63: uint8(_BT_QUEST),
  16775. 64: uint8(_BT_OTHER),
  16776. 65: uint8(_BT_HEX),
  16777. 66: uint8(_BT_HEX),
  16778. 67: uint8(_BT_HEX),
  16779. 68: uint8(_BT_HEX),
  16780. 69: uint8(_BT_HEX),
  16781. 70: uint8(_BT_HEX),
  16782. 71: uint8(_BT_NMSTRT),
  16783. 72: uint8(_BT_NMSTRT),
  16784. 73: uint8(_BT_NMSTRT),
  16785. 74: uint8(_BT_NMSTRT),
  16786. 75: uint8(_BT_NMSTRT),
  16787. 76: uint8(_BT_NMSTRT),
  16788. 77: uint8(_BT_NMSTRT),
  16789. 78: uint8(_BT_NMSTRT),
  16790. 79: uint8(_BT_NMSTRT),
  16791. 80: uint8(_BT_NMSTRT),
  16792. 81: uint8(_BT_NMSTRT),
  16793. 82: uint8(_BT_NMSTRT),
  16794. 83: uint8(_BT_NMSTRT),
  16795. 84: uint8(_BT_NMSTRT),
  16796. 85: uint8(_BT_NMSTRT),
  16797. 86: uint8(_BT_NMSTRT),
  16798. 87: uint8(_BT_NMSTRT),
  16799. 88: uint8(_BT_NMSTRT),
  16800. 89: uint8(_BT_NMSTRT),
  16801. 90: uint8(_BT_NMSTRT),
  16802. 91: uint8(_BT_LSQB),
  16803. 92: uint8(_BT_OTHER),
  16804. 93: uint8(_BT_RSQB),
  16805. 94: uint8(_BT_OTHER),
  16806. 95: uint8(_BT_NMSTRT),
  16807. 96: uint8(_BT_OTHER),
  16808. 97: uint8(_BT_HEX),
  16809. 98: uint8(_BT_HEX),
  16810. 99: uint8(_BT_HEX),
  16811. 100: uint8(_BT_HEX),
  16812. 101: uint8(_BT_HEX),
  16813. 102: uint8(_BT_HEX),
  16814. 103: uint8(_BT_NMSTRT),
  16815. 104: uint8(_BT_NMSTRT),
  16816. 105: uint8(_BT_NMSTRT),
  16817. 106: uint8(_BT_NMSTRT),
  16818. 107: uint8(_BT_NMSTRT),
  16819. 108: uint8(_BT_NMSTRT),
  16820. 109: uint8(_BT_NMSTRT),
  16821. 110: uint8(_BT_NMSTRT),
  16822. 111: uint8(_BT_NMSTRT),
  16823. 112: uint8(_BT_NMSTRT),
  16824. 113: uint8(_BT_NMSTRT),
  16825. 114: uint8(_BT_NMSTRT),
  16826. 115: uint8(_BT_NMSTRT),
  16827. 116: uint8(_BT_NMSTRT),
  16828. 117: uint8(_BT_NMSTRT),
  16829. 118: uint8(_BT_NMSTRT),
  16830. 119: uint8(_BT_NMSTRT),
  16831. 120: uint8(_BT_NMSTRT),
  16832. 121: uint8(_BT_NMSTRT),
  16833. 122: uint8(_BT_NMSTRT),
  16834. 123: uint8(_BT_OTHER),
  16835. 124: uint8(_BT_VERBAR),
  16836. 125: uint8(_BT_OTHER),
  16837. 126: uint8(_BT_OTHER),
  16838. 127: uint8(_BT_OTHER),
  16839. 128: uint8(_BT_TRAIL),
  16840. 129: uint8(_BT_TRAIL),
  16841. 130: uint8(_BT_TRAIL),
  16842. 131: uint8(_BT_TRAIL),
  16843. 132: uint8(_BT_TRAIL),
  16844. 133: uint8(_BT_TRAIL),
  16845. 134: uint8(_BT_TRAIL),
  16846. 135: uint8(_BT_TRAIL),
  16847. 136: uint8(_BT_TRAIL),
  16848. 137: uint8(_BT_TRAIL),
  16849. 138: uint8(_BT_TRAIL),
  16850. 139: uint8(_BT_TRAIL),
  16851. 140: uint8(_BT_TRAIL),
  16852. 141: uint8(_BT_TRAIL),
  16853. 142: uint8(_BT_TRAIL),
  16854. 143: uint8(_BT_TRAIL),
  16855. 144: uint8(_BT_TRAIL),
  16856. 145: uint8(_BT_TRAIL),
  16857. 146: uint8(_BT_TRAIL),
  16858. 147: uint8(_BT_TRAIL),
  16859. 148: uint8(_BT_TRAIL),
  16860. 149: uint8(_BT_TRAIL),
  16861. 150: uint8(_BT_TRAIL),
  16862. 151: uint8(_BT_TRAIL),
  16863. 152: uint8(_BT_TRAIL),
  16864. 153: uint8(_BT_TRAIL),
  16865. 154: uint8(_BT_TRAIL),
  16866. 155: uint8(_BT_TRAIL),
  16867. 156: uint8(_BT_TRAIL),
  16868. 157: uint8(_BT_TRAIL),
  16869. 158: uint8(_BT_TRAIL),
  16870. 159: uint8(_BT_TRAIL),
  16871. 160: uint8(_BT_TRAIL),
  16872. 161: uint8(_BT_TRAIL),
  16873. 162: uint8(_BT_TRAIL),
  16874. 163: uint8(_BT_TRAIL),
  16875. 164: uint8(_BT_TRAIL),
  16876. 165: uint8(_BT_TRAIL),
  16877. 166: uint8(_BT_TRAIL),
  16878. 167: uint8(_BT_TRAIL),
  16879. 168: uint8(_BT_TRAIL),
  16880. 169: uint8(_BT_TRAIL),
  16881. 170: uint8(_BT_TRAIL),
  16882. 171: uint8(_BT_TRAIL),
  16883. 172: uint8(_BT_TRAIL),
  16884. 173: uint8(_BT_TRAIL),
  16885. 174: uint8(_BT_TRAIL),
  16886. 175: uint8(_BT_TRAIL),
  16887. 176: uint8(_BT_TRAIL),
  16888. 177: uint8(_BT_TRAIL),
  16889. 178: uint8(_BT_TRAIL),
  16890. 179: uint8(_BT_TRAIL),
  16891. 180: uint8(_BT_TRAIL),
  16892. 181: uint8(_BT_TRAIL),
  16893. 182: uint8(_BT_TRAIL),
  16894. 183: uint8(_BT_TRAIL),
  16895. 184: uint8(_BT_TRAIL),
  16896. 185: uint8(_BT_TRAIL),
  16897. 186: uint8(_BT_TRAIL),
  16898. 187: uint8(_BT_TRAIL),
  16899. 188: uint8(_BT_TRAIL),
  16900. 189: uint8(_BT_TRAIL),
  16901. 190: uint8(_BT_TRAIL),
  16902. 191: uint8(_BT_TRAIL),
  16903. 192: uint8(_BT_LEAD2),
  16904. 193: uint8(_BT_LEAD2),
  16905. 194: uint8(_BT_LEAD2),
  16906. 195: uint8(_BT_LEAD2),
  16907. 196: uint8(_BT_LEAD2),
  16908. 197: uint8(_BT_LEAD2),
  16909. 198: uint8(_BT_LEAD2),
  16910. 199: uint8(_BT_LEAD2),
  16911. 200: uint8(_BT_LEAD2),
  16912. 201: uint8(_BT_LEAD2),
  16913. 202: uint8(_BT_LEAD2),
  16914. 203: uint8(_BT_LEAD2),
  16915. 204: uint8(_BT_LEAD2),
  16916. 205: uint8(_BT_LEAD2),
  16917. 206: uint8(_BT_LEAD2),
  16918. 207: uint8(_BT_LEAD2),
  16919. 208: uint8(_BT_LEAD2),
  16920. 209: uint8(_BT_LEAD2),
  16921. 210: uint8(_BT_LEAD2),
  16922. 211: uint8(_BT_LEAD2),
  16923. 212: uint8(_BT_LEAD2),
  16924. 213: uint8(_BT_LEAD2),
  16925. 214: uint8(_BT_LEAD2),
  16926. 215: uint8(_BT_LEAD2),
  16927. 216: uint8(_BT_LEAD2),
  16928. 217: uint8(_BT_LEAD2),
  16929. 218: uint8(_BT_LEAD2),
  16930. 219: uint8(_BT_LEAD2),
  16931. 220: uint8(_BT_LEAD2),
  16932. 221: uint8(_BT_LEAD2),
  16933. 222: uint8(_BT_LEAD2),
  16934. 223: uint8(_BT_LEAD2),
  16935. 224: uint8(_BT_LEAD3),
  16936. 225: uint8(_BT_LEAD3),
  16937. 226: uint8(_BT_LEAD3),
  16938. 227: uint8(_BT_LEAD3),
  16939. 228: uint8(_BT_LEAD3),
  16940. 229: uint8(_BT_LEAD3),
  16941. 230: uint8(_BT_LEAD3),
  16942. 231: uint8(_BT_LEAD3),
  16943. 232: uint8(_BT_LEAD3),
  16944. 233: uint8(_BT_LEAD3),
  16945. 234: uint8(_BT_LEAD3),
  16946. 235: uint8(_BT_LEAD3),
  16947. 236: uint8(_BT_LEAD3),
  16948. 237: uint8(_BT_LEAD3),
  16949. 238: uint8(_BT_LEAD3),
  16950. 239: uint8(_BT_LEAD3),
  16951. 240: uint8(_BT_LEAD4),
  16952. 241: uint8(_BT_LEAD4),
  16953. 242: uint8(_BT_LEAD4),
  16954. 243: uint8(_BT_LEAD4),
  16955. 244: uint8(_BT_LEAD4),
  16956. 254: uint8(_BT_MALFORM),
  16957. 255: uint8(_BT_MALFORM),
  16958. },
  16959. }
  16960. func init() {
  16961. p := unsafe.Pointer(&_utf8_encoding)
  16962. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  16963. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  16964. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  16965. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  16966. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  16967. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  16968. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  16969. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  16970. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  16971. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  16972. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  16973. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  16974. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  16975. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  16976. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  16977. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  16978. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  16979. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  16980. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  16981. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  16982. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  16983. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  16984. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  16985. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  16986. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  16987. }
  16988. var _internal_utf8_encoding_ns = Tnormal_encoding{
  16989. Fenc: TENCODING{
  16990. Fscanners: [4]TSCANNER{},
  16991. FliteralScanners: [2]TSCANNER{},
  16992. FminBytesPerChar: int32(1),
  16993. FisUtf8: int8(1),
  16994. },
  16995. Ftype1: [256]uint8{
  16996. 9: uint8(_BT_S),
  16997. 10: uint8(_BT_LF),
  16998. 13: uint8(_BT_S),
  16999. 32: uint8(_BT_S),
  17000. 33: uint8(_BT_EXCL),
  17001. 34: uint8(_BT_QUOT),
  17002. 35: uint8(_BT_NUM),
  17003. 36: uint8(_BT_OTHER),
  17004. 37: uint8(_BT_PERCNT),
  17005. 38: uint8(_BT_AMP),
  17006. 39: uint8(_BT_APOS),
  17007. 40: uint8(_BT_LPAR),
  17008. 41: uint8(_BT_RPAR),
  17009. 42: uint8(_BT_AST),
  17010. 43: uint8(_BT_PLUS),
  17011. 44: uint8(_BT_COMMA),
  17012. 45: uint8(_BT_MINUS),
  17013. 46: uint8(_BT_NAME),
  17014. 47: uint8(_BT_SOL),
  17015. 48: uint8(_BT_DIGIT),
  17016. 49: uint8(_BT_DIGIT),
  17017. 50: uint8(_BT_DIGIT),
  17018. 51: uint8(_BT_DIGIT),
  17019. 52: uint8(_BT_DIGIT),
  17020. 53: uint8(_BT_DIGIT),
  17021. 54: uint8(_BT_DIGIT),
  17022. 55: uint8(_BT_DIGIT),
  17023. 56: uint8(_BT_DIGIT),
  17024. 57: uint8(_BT_DIGIT),
  17025. 58: uint8(_BT_COLON),
  17026. 59: uint8(_BT_SEMI),
  17027. 60: uint8(_BT_LT),
  17028. 61: uint8(_BT_EQUALS),
  17029. 62: uint8(_BT_GT),
  17030. 63: uint8(_BT_QUEST),
  17031. 64: uint8(_BT_OTHER),
  17032. 65: uint8(_BT_HEX),
  17033. 66: uint8(_BT_HEX),
  17034. 67: uint8(_BT_HEX),
  17035. 68: uint8(_BT_HEX),
  17036. 69: uint8(_BT_HEX),
  17037. 70: uint8(_BT_HEX),
  17038. 71: uint8(_BT_NMSTRT),
  17039. 72: uint8(_BT_NMSTRT),
  17040. 73: uint8(_BT_NMSTRT),
  17041. 74: uint8(_BT_NMSTRT),
  17042. 75: uint8(_BT_NMSTRT),
  17043. 76: uint8(_BT_NMSTRT),
  17044. 77: uint8(_BT_NMSTRT),
  17045. 78: uint8(_BT_NMSTRT),
  17046. 79: uint8(_BT_NMSTRT),
  17047. 80: uint8(_BT_NMSTRT),
  17048. 81: uint8(_BT_NMSTRT),
  17049. 82: uint8(_BT_NMSTRT),
  17050. 83: uint8(_BT_NMSTRT),
  17051. 84: uint8(_BT_NMSTRT),
  17052. 85: uint8(_BT_NMSTRT),
  17053. 86: uint8(_BT_NMSTRT),
  17054. 87: uint8(_BT_NMSTRT),
  17055. 88: uint8(_BT_NMSTRT),
  17056. 89: uint8(_BT_NMSTRT),
  17057. 90: uint8(_BT_NMSTRT),
  17058. 91: uint8(_BT_LSQB),
  17059. 92: uint8(_BT_OTHER),
  17060. 93: uint8(_BT_RSQB),
  17061. 94: uint8(_BT_OTHER),
  17062. 95: uint8(_BT_NMSTRT),
  17063. 96: uint8(_BT_OTHER),
  17064. 97: uint8(_BT_HEX),
  17065. 98: uint8(_BT_HEX),
  17066. 99: uint8(_BT_HEX),
  17067. 100: uint8(_BT_HEX),
  17068. 101: uint8(_BT_HEX),
  17069. 102: uint8(_BT_HEX),
  17070. 103: uint8(_BT_NMSTRT),
  17071. 104: uint8(_BT_NMSTRT),
  17072. 105: uint8(_BT_NMSTRT),
  17073. 106: uint8(_BT_NMSTRT),
  17074. 107: uint8(_BT_NMSTRT),
  17075. 108: uint8(_BT_NMSTRT),
  17076. 109: uint8(_BT_NMSTRT),
  17077. 110: uint8(_BT_NMSTRT),
  17078. 111: uint8(_BT_NMSTRT),
  17079. 112: uint8(_BT_NMSTRT),
  17080. 113: uint8(_BT_NMSTRT),
  17081. 114: uint8(_BT_NMSTRT),
  17082. 115: uint8(_BT_NMSTRT),
  17083. 116: uint8(_BT_NMSTRT),
  17084. 117: uint8(_BT_NMSTRT),
  17085. 118: uint8(_BT_NMSTRT),
  17086. 119: uint8(_BT_NMSTRT),
  17087. 120: uint8(_BT_NMSTRT),
  17088. 121: uint8(_BT_NMSTRT),
  17089. 122: uint8(_BT_NMSTRT),
  17090. 123: uint8(_BT_OTHER),
  17091. 124: uint8(_BT_VERBAR),
  17092. 125: uint8(_BT_OTHER),
  17093. 126: uint8(_BT_OTHER),
  17094. 127: uint8(_BT_OTHER),
  17095. 128: uint8(_BT_TRAIL),
  17096. 129: uint8(_BT_TRAIL),
  17097. 130: uint8(_BT_TRAIL),
  17098. 131: uint8(_BT_TRAIL),
  17099. 132: uint8(_BT_TRAIL),
  17100. 133: uint8(_BT_TRAIL),
  17101. 134: uint8(_BT_TRAIL),
  17102. 135: uint8(_BT_TRAIL),
  17103. 136: uint8(_BT_TRAIL),
  17104. 137: uint8(_BT_TRAIL),
  17105. 138: uint8(_BT_TRAIL),
  17106. 139: uint8(_BT_TRAIL),
  17107. 140: uint8(_BT_TRAIL),
  17108. 141: uint8(_BT_TRAIL),
  17109. 142: uint8(_BT_TRAIL),
  17110. 143: uint8(_BT_TRAIL),
  17111. 144: uint8(_BT_TRAIL),
  17112. 145: uint8(_BT_TRAIL),
  17113. 146: uint8(_BT_TRAIL),
  17114. 147: uint8(_BT_TRAIL),
  17115. 148: uint8(_BT_TRAIL),
  17116. 149: uint8(_BT_TRAIL),
  17117. 150: uint8(_BT_TRAIL),
  17118. 151: uint8(_BT_TRAIL),
  17119. 152: uint8(_BT_TRAIL),
  17120. 153: uint8(_BT_TRAIL),
  17121. 154: uint8(_BT_TRAIL),
  17122. 155: uint8(_BT_TRAIL),
  17123. 156: uint8(_BT_TRAIL),
  17124. 157: uint8(_BT_TRAIL),
  17125. 158: uint8(_BT_TRAIL),
  17126. 159: uint8(_BT_TRAIL),
  17127. 160: uint8(_BT_TRAIL),
  17128. 161: uint8(_BT_TRAIL),
  17129. 162: uint8(_BT_TRAIL),
  17130. 163: uint8(_BT_TRAIL),
  17131. 164: uint8(_BT_TRAIL),
  17132. 165: uint8(_BT_TRAIL),
  17133. 166: uint8(_BT_TRAIL),
  17134. 167: uint8(_BT_TRAIL),
  17135. 168: uint8(_BT_TRAIL),
  17136. 169: uint8(_BT_TRAIL),
  17137. 170: uint8(_BT_TRAIL),
  17138. 171: uint8(_BT_TRAIL),
  17139. 172: uint8(_BT_TRAIL),
  17140. 173: uint8(_BT_TRAIL),
  17141. 174: uint8(_BT_TRAIL),
  17142. 175: uint8(_BT_TRAIL),
  17143. 176: uint8(_BT_TRAIL),
  17144. 177: uint8(_BT_TRAIL),
  17145. 178: uint8(_BT_TRAIL),
  17146. 179: uint8(_BT_TRAIL),
  17147. 180: uint8(_BT_TRAIL),
  17148. 181: uint8(_BT_TRAIL),
  17149. 182: uint8(_BT_TRAIL),
  17150. 183: uint8(_BT_TRAIL),
  17151. 184: uint8(_BT_TRAIL),
  17152. 185: uint8(_BT_TRAIL),
  17153. 186: uint8(_BT_TRAIL),
  17154. 187: uint8(_BT_TRAIL),
  17155. 188: uint8(_BT_TRAIL),
  17156. 189: uint8(_BT_TRAIL),
  17157. 190: uint8(_BT_TRAIL),
  17158. 191: uint8(_BT_TRAIL),
  17159. 192: uint8(_BT_LEAD2),
  17160. 193: uint8(_BT_LEAD2),
  17161. 194: uint8(_BT_LEAD2),
  17162. 195: uint8(_BT_LEAD2),
  17163. 196: uint8(_BT_LEAD2),
  17164. 197: uint8(_BT_LEAD2),
  17165. 198: uint8(_BT_LEAD2),
  17166. 199: uint8(_BT_LEAD2),
  17167. 200: uint8(_BT_LEAD2),
  17168. 201: uint8(_BT_LEAD2),
  17169. 202: uint8(_BT_LEAD2),
  17170. 203: uint8(_BT_LEAD2),
  17171. 204: uint8(_BT_LEAD2),
  17172. 205: uint8(_BT_LEAD2),
  17173. 206: uint8(_BT_LEAD2),
  17174. 207: uint8(_BT_LEAD2),
  17175. 208: uint8(_BT_LEAD2),
  17176. 209: uint8(_BT_LEAD2),
  17177. 210: uint8(_BT_LEAD2),
  17178. 211: uint8(_BT_LEAD2),
  17179. 212: uint8(_BT_LEAD2),
  17180. 213: uint8(_BT_LEAD2),
  17181. 214: uint8(_BT_LEAD2),
  17182. 215: uint8(_BT_LEAD2),
  17183. 216: uint8(_BT_LEAD2),
  17184. 217: uint8(_BT_LEAD2),
  17185. 218: uint8(_BT_LEAD2),
  17186. 219: uint8(_BT_LEAD2),
  17187. 220: uint8(_BT_LEAD2),
  17188. 221: uint8(_BT_LEAD2),
  17189. 222: uint8(_BT_LEAD2),
  17190. 223: uint8(_BT_LEAD2),
  17191. 224: uint8(_BT_LEAD3),
  17192. 225: uint8(_BT_LEAD3),
  17193. 226: uint8(_BT_LEAD3),
  17194. 227: uint8(_BT_LEAD3),
  17195. 228: uint8(_BT_LEAD3),
  17196. 229: uint8(_BT_LEAD3),
  17197. 230: uint8(_BT_LEAD3),
  17198. 231: uint8(_BT_LEAD3),
  17199. 232: uint8(_BT_LEAD3),
  17200. 233: uint8(_BT_LEAD3),
  17201. 234: uint8(_BT_LEAD3),
  17202. 235: uint8(_BT_LEAD3),
  17203. 236: uint8(_BT_LEAD3),
  17204. 237: uint8(_BT_LEAD3),
  17205. 238: uint8(_BT_LEAD3),
  17206. 239: uint8(_BT_LEAD3),
  17207. 240: uint8(_BT_LEAD4),
  17208. 241: uint8(_BT_LEAD4),
  17209. 242: uint8(_BT_LEAD4),
  17210. 243: uint8(_BT_LEAD4),
  17211. 244: uint8(_BT_LEAD4),
  17212. 254: uint8(_BT_MALFORM),
  17213. 255: uint8(_BT_MALFORM),
  17214. },
  17215. }
  17216. func init() {
  17217. p := unsafe.Pointer(&_internal_utf8_encoding_ns)
  17218. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  17219. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  17220. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  17221. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  17222. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  17223. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  17224. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  17225. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  17226. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  17227. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  17228. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  17229. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  17230. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  17231. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  17232. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  17233. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  17234. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  17235. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  17236. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  17237. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  17238. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  17239. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  17240. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  17241. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  17242. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  17243. }
  17244. var _internal_utf8_encoding = Tnormal_encoding{
  17245. Fenc: TENCODING{
  17246. Fscanners: [4]TSCANNER{},
  17247. FliteralScanners: [2]TSCANNER{},
  17248. FminBytesPerChar: int32(1),
  17249. FisUtf8: int8(1),
  17250. },
  17251. Ftype1: [256]uint8{
  17252. 9: uint8(_BT_S),
  17253. 10: uint8(_BT_LF),
  17254. 13: uint8(_BT_S),
  17255. 32: uint8(_BT_S),
  17256. 33: uint8(_BT_EXCL),
  17257. 34: uint8(_BT_QUOT),
  17258. 35: uint8(_BT_NUM),
  17259. 36: uint8(_BT_OTHER),
  17260. 37: uint8(_BT_PERCNT),
  17261. 38: uint8(_BT_AMP),
  17262. 39: uint8(_BT_APOS),
  17263. 40: uint8(_BT_LPAR),
  17264. 41: uint8(_BT_RPAR),
  17265. 42: uint8(_BT_AST),
  17266. 43: uint8(_BT_PLUS),
  17267. 44: uint8(_BT_COMMA),
  17268. 45: uint8(_BT_MINUS),
  17269. 46: uint8(_BT_NAME),
  17270. 47: uint8(_BT_SOL),
  17271. 48: uint8(_BT_DIGIT),
  17272. 49: uint8(_BT_DIGIT),
  17273. 50: uint8(_BT_DIGIT),
  17274. 51: uint8(_BT_DIGIT),
  17275. 52: uint8(_BT_DIGIT),
  17276. 53: uint8(_BT_DIGIT),
  17277. 54: uint8(_BT_DIGIT),
  17278. 55: uint8(_BT_DIGIT),
  17279. 56: uint8(_BT_DIGIT),
  17280. 57: uint8(_BT_DIGIT),
  17281. 58: uint8(_BT_NMSTRT),
  17282. 59: uint8(_BT_SEMI),
  17283. 60: uint8(_BT_LT),
  17284. 61: uint8(_BT_EQUALS),
  17285. 62: uint8(_BT_GT),
  17286. 63: uint8(_BT_QUEST),
  17287. 64: uint8(_BT_OTHER),
  17288. 65: uint8(_BT_HEX),
  17289. 66: uint8(_BT_HEX),
  17290. 67: uint8(_BT_HEX),
  17291. 68: uint8(_BT_HEX),
  17292. 69: uint8(_BT_HEX),
  17293. 70: uint8(_BT_HEX),
  17294. 71: uint8(_BT_NMSTRT),
  17295. 72: uint8(_BT_NMSTRT),
  17296. 73: uint8(_BT_NMSTRT),
  17297. 74: uint8(_BT_NMSTRT),
  17298. 75: uint8(_BT_NMSTRT),
  17299. 76: uint8(_BT_NMSTRT),
  17300. 77: uint8(_BT_NMSTRT),
  17301. 78: uint8(_BT_NMSTRT),
  17302. 79: uint8(_BT_NMSTRT),
  17303. 80: uint8(_BT_NMSTRT),
  17304. 81: uint8(_BT_NMSTRT),
  17305. 82: uint8(_BT_NMSTRT),
  17306. 83: uint8(_BT_NMSTRT),
  17307. 84: uint8(_BT_NMSTRT),
  17308. 85: uint8(_BT_NMSTRT),
  17309. 86: uint8(_BT_NMSTRT),
  17310. 87: uint8(_BT_NMSTRT),
  17311. 88: uint8(_BT_NMSTRT),
  17312. 89: uint8(_BT_NMSTRT),
  17313. 90: uint8(_BT_NMSTRT),
  17314. 91: uint8(_BT_LSQB),
  17315. 92: uint8(_BT_OTHER),
  17316. 93: uint8(_BT_RSQB),
  17317. 94: uint8(_BT_OTHER),
  17318. 95: uint8(_BT_NMSTRT),
  17319. 96: uint8(_BT_OTHER),
  17320. 97: uint8(_BT_HEX),
  17321. 98: uint8(_BT_HEX),
  17322. 99: uint8(_BT_HEX),
  17323. 100: uint8(_BT_HEX),
  17324. 101: uint8(_BT_HEX),
  17325. 102: uint8(_BT_HEX),
  17326. 103: uint8(_BT_NMSTRT),
  17327. 104: uint8(_BT_NMSTRT),
  17328. 105: uint8(_BT_NMSTRT),
  17329. 106: uint8(_BT_NMSTRT),
  17330. 107: uint8(_BT_NMSTRT),
  17331. 108: uint8(_BT_NMSTRT),
  17332. 109: uint8(_BT_NMSTRT),
  17333. 110: uint8(_BT_NMSTRT),
  17334. 111: uint8(_BT_NMSTRT),
  17335. 112: uint8(_BT_NMSTRT),
  17336. 113: uint8(_BT_NMSTRT),
  17337. 114: uint8(_BT_NMSTRT),
  17338. 115: uint8(_BT_NMSTRT),
  17339. 116: uint8(_BT_NMSTRT),
  17340. 117: uint8(_BT_NMSTRT),
  17341. 118: uint8(_BT_NMSTRT),
  17342. 119: uint8(_BT_NMSTRT),
  17343. 120: uint8(_BT_NMSTRT),
  17344. 121: uint8(_BT_NMSTRT),
  17345. 122: uint8(_BT_NMSTRT),
  17346. 123: uint8(_BT_OTHER),
  17347. 124: uint8(_BT_VERBAR),
  17348. 125: uint8(_BT_OTHER),
  17349. 126: uint8(_BT_OTHER),
  17350. 127: uint8(_BT_OTHER),
  17351. 128: uint8(_BT_TRAIL),
  17352. 129: uint8(_BT_TRAIL),
  17353. 130: uint8(_BT_TRAIL),
  17354. 131: uint8(_BT_TRAIL),
  17355. 132: uint8(_BT_TRAIL),
  17356. 133: uint8(_BT_TRAIL),
  17357. 134: uint8(_BT_TRAIL),
  17358. 135: uint8(_BT_TRAIL),
  17359. 136: uint8(_BT_TRAIL),
  17360. 137: uint8(_BT_TRAIL),
  17361. 138: uint8(_BT_TRAIL),
  17362. 139: uint8(_BT_TRAIL),
  17363. 140: uint8(_BT_TRAIL),
  17364. 141: uint8(_BT_TRAIL),
  17365. 142: uint8(_BT_TRAIL),
  17366. 143: uint8(_BT_TRAIL),
  17367. 144: uint8(_BT_TRAIL),
  17368. 145: uint8(_BT_TRAIL),
  17369. 146: uint8(_BT_TRAIL),
  17370. 147: uint8(_BT_TRAIL),
  17371. 148: uint8(_BT_TRAIL),
  17372. 149: uint8(_BT_TRAIL),
  17373. 150: uint8(_BT_TRAIL),
  17374. 151: uint8(_BT_TRAIL),
  17375. 152: uint8(_BT_TRAIL),
  17376. 153: uint8(_BT_TRAIL),
  17377. 154: uint8(_BT_TRAIL),
  17378. 155: uint8(_BT_TRAIL),
  17379. 156: uint8(_BT_TRAIL),
  17380. 157: uint8(_BT_TRAIL),
  17381. 158: uint8(_BT_TRAIL),
  17382. 159: uint8(_BT_TRAIL),
  17383. 160: uint8(_BT_TRAIL),
  17384. 161: uint8(_BT_TRAIL),
  17385. 162: uint8(_BT_TRAIL),
  17386. 163: uint8(_BT_TRAIL),
  17387. 164: uint8(_BT_TRAIL),
  17388. 165: uint8(_BT_TRAIL),
  17389. 166: uint8(_BT_TRAIL),
  17390. 167: uint8(_BT_TRAIL),
  17391. 168: uint8(_BT_TRAIL),
  17392. 169: uint8(_BT_TRAIL),
  17393. 170: uint8(_BT_TRAIL),
  17394. 171: uint8(_BT_TRAIL),
  17395. 172: uint8(_BT_TRAIL),
  17396. 173: uint8(_BT_TRAIL),
  17397. 174: uint8(_BT_TRAIL),
  17398. 175: uint8(_BT_TRAIL),
  17399. 176: uint8(_BT_TRAIL),
  17400. 177: uint8(_BT_TRAIL),
  17401. 178: uint8(_BT_TRAIL),
  17402. 179: uint8(_BT_TRAIL),
  17403. 180: uint8(_BT_TRAIL),
  17404. 181: uint8(_BT_TRAIL),
  17405. 182: uint8(_BT_TRAIL),
  17406. 183: uint8(_BT_TRAIL),
  17407. 184: uint8(_BT_TRAIL),
  17408. 185: uint8(_BT_TRAIL),
  17409. 186: uint8(_BT_TRAIL),
  17410. 187: uint8(_BT_TRAIL),
  17411. 188: uint8(_BT_TRAIL),
  17412. 189: uint8(_BT_TRAIL),
  17413. 190: uint8(_BT_TRAIL),
  17414. 191: uint8(_BT_TRAIL),
  17415. 192: uint8(_BT_LEAD2),
  17416. 193: uint8(_BT_LEAD2),
  17417. 194: uint8(_BT_LEAD2),
  17418. 195: uint8(_BT_LEAD2),
  17419. 196: uint8(_BT_LEAD2),
  17420. 197: uint8(_BT_LEAD2),
  17421. 198: uint8(_BT_LEAD2),
  17422. 199: uint8(_BT_LEAD2),
  17423. 200: uint8(_BT_LEAD2),
  17424. 201: uint8(_BT_LEAD2),
  17425. 202: uint8(_BT_LEAD2),
  17426. 203: uint8(_BT_LEAD2),
  17427. 204: uint8(_BT_LEAD2),
  17428. 205: uint8(_BT_LEAD2),
  17429. 206: uint8(_BT_LEAD2),
  17430. 207: uint8(_BT_LEAD2),
  17431. 208: uint8(_BT_LEAD2),
  17432. 209: uint8(_BT_LEAD2),
  17433. 210: uint8(_BT_LEAD2),
  17434. 211: uint8(_BT_LEAD2),
  17435. 212: uint8(_BT_LEAD2),
  17436. 213: uint8(_BT_LEAD2),
  17437. 214: uint8(_BT_LEAD2),
  17438. 215: uint8(_BT_LEAD2),
  17439. 216: uint8(_BT_LEAD2),
  17440. 217: uint8(_BT_LEAD2),
  17441. 218: uint8(_BT_LEAD2),
  17442. 219: uint8(_BT_LEAD2),
  17443. 220: uint8(_BT_LEAD2),
  17444. 221: uint8(_BT_LEAD2),
  17445. 222: uint8(_BT_LEAD2),
  17446. 223: uint8(_BT_LEAD2),
  17447. 224: uint8(_BT_LEAD3),
  17448. 225: uint8(_BT_LEAD3),
  17449. 226: uint8(_BT_LEAD3),
  17450. 227: uint8(_BT_LEAD3),
  17451. 228: uint8(_BT_LEAD3),
  17452. 229: uint8(_BT_LEAD3),
  17453. 230: uint8(_BT_LEAD3),
  17454. 231: uint8(_BT_LEAD3),
  17455. 232: uint8(_BT_LEAD3),
  17456. 233: uint8(_BT_LEAD3),
  17457. 234: uint8(_BT_LEAD3),
  17458. 235: uint8(_BT_LEAD3),
  17459. 236: uint8(_BT_LEAD3),
  17460. 237: uint8(_BT_LEAD3),
  17461. 238: uint8(_BT_LEAD3),
  17462. 239: uint8(_BT_LEAD3),
  17463. 240: uint8(_BT_LEAD4),
  17464. 241: uint8(_BT_LEAD4),
  17465. 242: uint8(_BT_LEAD4),
  17466. 243: uint8(_BT_LEAD4),
  17467. 244: uint8(_BT_LEAD4),
  17468. 254: uint8(_BT_MALFORM),
  17469. 255: uint8(_BT_MALFORM),
  17470. },
  17471. }
  17472. func init() {
  17473. p := unsafe.Pointer(&_internal_utf8_encoding)
  17474. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  17475. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  17476. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  17477. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  17478. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  17479. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  17480. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  17481. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  17482. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  17483. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  17484. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  17485. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  17486. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  17487. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  17488. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  17489. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  17490. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  17491. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  17492. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  17493. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  17494. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  17495. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  17496. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  17497. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  17498. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  17499. }
  17500. func _latin1_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  17501. var c uint8
  17502. var v2, v3, v4, v5, v6, v7, v8, v9 uintptr
  17503. _, _, _, _, _, _, _, _, _ = c, v2, v3, v4, v5, v6, v7, v8, v9
  17504. _ = enc
  17505. for {
  17506. if *(*uintptr)(unsafe.Pointer(fromP)) == fromLim {
  17507. return int32(_XML_CONVERT_COMPLETED)
  17508. }
  17509. c = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)))))
  17510. if libc.Int32FromUint8(c)&int32(0x80) != 0 {
  17511. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(2) {
  17512. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  17513. }
  17514. v3 = toP
  17515. v2 = *(*uintptr)(unsafe.Pointer(v3))
  17516. *(*uintptr)(unsafe.Pointer(v3))++
  17517. *(*int8)(unsafe.Pointer(v2)) = int8(libc.Int32FromUint8(c)>>libc.Int32FromInt32(6) | int32(_UTF8_cval2))
  17518. v5 = toP
  17519. v4 = *(*uintptr)(unsafe.Pointer(v5))
  17520. *(*uintptr)(unsafe.Pointer(v5))++
  17521. *(*int8)(unsafe.Pointer(v4)) = int8(libc.Int32FromUint8(c)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  17522. *(*uintptr)(unsafe.Pointer(fromP))++
  17523. } else {
  17524. if *(*uintptr)(unsafe.Pointer(toP)) == toLim {
  17525. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  17526. }
  17527. v7 = toP
  17528. v6 = *(*uintptr)(unsafe.Pointer(v7))
  17529. *(*uintptr)(unsafe.Pointer(v7))++
  17530. v9 = fromP
  17531. v8 = *(*uintptr)(unsafe.Pointer(v9))
  17532. *(*uintptr)(unsafe.Pointer(v9))++
  17533. *(*int8)(unsafe.Pointer(v6)) = *(*int8)(unsafe.Pointer(v8))
  17534. }
  17535. goto _1
  17536. _1:
  17537. }
  17538. return r
  17539. }
  17540. func _latin1_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  17541. var v1, v2, v3, v4 uintptr
  17542. _, _, _, _ = v1, v2, v3, v4
  17543. _ = enc
  17544. for *(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim {
  17545. v2 = toP
  17546. v1 = *(*uintptr)(unsafe.Pointer(v2))
  17547. *(*uintptr)(unsafe.Pointer(v2)) += 2
  17548. v4 = fromP
  17549. v3 = *(*uintptr)(unsafe.Pointer(v4))
  17550. *(*uintptr)(unsafe.Pointer(v4))++
  17551. *(*uint16)(unsafe.Pointer(v1)) = uint16(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(v3))))
  17552. }
  17553. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  17554. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  17555. } else {
  17556. return int32(_XML_CONVERT_COMPLETED)
  17557. }
  17558. return r
  17559. }
  17560. var _latin1_encoding_ns = Tnormal_encoding{
  17561. Fenc: TENCODING{
  17562. Fscanners: [4]TSCANNER{},
  17563. FliteralScanners: [2]TSCANNER{},
  17564. FminBytesPerChar: int32(1),
  17565. },
  17566. Ftype1: [256]uint8{
  17567. 9: uint8(_BT_S),
  17568. 10: uint8(_BT_LF),
  17569. 13: uint8(_BT_CR),
  17570. 32: uint8(_BT_S),
  17571. 33: uint8(_BT_EXCL),
  17572. 34: uint8(_BT_QUOT),
  17573. 35: uint8(_BT_NUM),
  17574. 36: uint8(_BT_OTHER),
  17575. 37: uint8(_BT_PERCNT),
  17576. 38: uint8(_BT_AMP),
  17577. 39: uint8(_BT_APOS),
  17578. 40: uint8(_BT_LPAR),
  17579. 41: uint8(_BT_RPAR),
  17580. 42: uint8(_BT_AST),
  17581. 43: uint8(_BT_PLUS),
  17582. 44: uint8(_BT_COMMA),
  17583. 45: uint8(_BT_MINUS),
  17584. 46: uint8(_BT_NAME),
  17585. 47: uint8(_BT_SOL),
  17586. 48: uint8(_BT_DIGIT),
  17587. 49: uint8(_BT_DIGIT),
  17588. 50: uint8(_BT_DIGIT),
  17589. 51: uint8(_BT_DIGIT),
  17590. 52: uint8(_BT_DIGIT),
  17591. 53: uint8(_BT_DIGIT),
  17592. 54: uint8(_BT_DIGIT),
  17593. 55: uint8(_BT_DIGIT),
  17594. 56: uint8(_BT_DIGIT),
  17595. 57: uint8(_BT_DIGIT),
  17596. 58: uint8(_BT_COLON),
  17597. 59: uint8(_BT_SEMI),
  17598. 60: uint8(_BT_LT),
  17599. 61: uint8(_BT_EQUALS),
  17600. 62: uint8(_BT_GT),
  17601. 63: uint8(_BT_QUEST),
  17602. 64: uint8(_BT_OTHER),
  17603. 65: uint8(_BT_HEX),
  17604. 66: uint8(_BT_HEX),
  17605. 67: uint8(_BT_HEX),
  17606. 68: uint8(_BT_HEX),
  17607. 69: uint8(_BT_HEX),
  17608. 70: uint8(_BT_HEX),
  17609. 71: uint8(_BT_NMSTRT),
  17610. 72: uint8(_BT_NMSTRT),
  17611. 73: uint8(_BT_NMSTRT),
  17612. 74: uint8(_BT_NMSTRT),
  17613. 75: uint8(_BT_NMSTRT),
  17614. 76: uint8(_BT_NMSTRT),
  17615. 77: uint8(_BT_NMSTRT),
  17616. 78: uint8(_BT_NMSTRT),
  17617. 79: uint8(_BT_NMSTRT),
  17618. 80: uint8(_BT_NMSTRT),
  17619. 81: uint8(_BT_NMSTRT),
  17620. 82: uint8(_BT_NMSTRT),
  17621. 83: uint8(_BT_NMSTRT),
  17622. 84: uint8(_BT_NMSTRT),
  17623. 85: uint8(_BT_NMSTRT),
  17624. 86: uint8(_BT_NMSTRT),
  17625. 87: uint8(_BT_NMSTRT),
  17626. 88: uint8(_BT_NMSTRT),
  17627. 89: uint8(_BT_NMSTRT),
  17628. 90: uint8(_BT_NMSTRT),
  17629. 91: uint8(_BT_LSQB),
  17630. 92: uint8(_BT_OTHER),
  17631. 93: uint8(_BT_RSQB),
  17632. 94: uint8(_BT_OTHER),
  17633. 95: uint8(_BT_NMSTRT),
  17634. 96: uint8(_BT_OTHER),
  17635. 97: uint8(_BT_HEX),
  17636. 98: uint8(_BT_HEX),
  17637. 99: uint8(_BT_HEX),
  17638. 100: uint8(_BT_HEX),
  17639. 101: uint8(_BT_HEX),
  17640. 102: uint8(_BT_HEX),
  17641. 103: uint8(_BT_NMSTRT),
  17642. 104: uint8(_BT_NMSTRT),
  17643. 105: uint8(_BT_NMSTRT),
  17644. 106: uint8(_BT_NMSTRT),
  17645. 107: uint8(_BT_NMSTRT),
  17646. 108: uint8(_BT_NMSTRT),
  17647. 109: uint8(_BT_NMSTRT),
  17648. 110: uint8(_BT_NMSTRT),
  17649. 111: uint8(_BT_NMSTRT),
  17650. 112: uint8(_BT_NMSTRT),
  17651. 113: uint8(_BT_NMSTRT),
  17652. 114: uint8(_BT_NMSTRT),
  17653. 115: uint8(_BT_NMSTRT),
  17654. 116: uint8(_BT_NMSTRT),
  17655. 117: uint8(_BT_NMSTRT),
  17656. 118: uint8(_BT_NMSTRT),
  17657. 119: uint8(_BT_NMSTRT),
  17658. 120: uint8(_BT_NMSTRT),
  17659. 121: uint8(_BT_NMSTRT),
  17660. 122: uint8(_BT_NMSTRT),
  17661. 123: uint8(_BT_OTHER),
  17662. 124: uint8(_BT_VERBAR),
  17663. 125: uint8(_BT_OTHER),
  17664. 126: uint8(_BT_OTHER),
  17665. 127: uint8(_BT_OTHER),
  17666. 128: uint8(_BT_OTHER),
  17667. 129: uint8(_BT_OTHER),
  17668. 130: uint8(_BT_OTHER),
  17669. 131: uint8(_BT_OTHER),
  17670. 132: uint8(_BT_OTHER),
  17671. 133: uint8(_BT_OTHER),
  17672. 134: uint8(_BT_OTHER),
  17673. 135: uint8(_BT_OTHER),
  17674. 136: uint8(_BT_OTHER),
  17675. 137: uint8(_BT_OTHER),
  17676. 138: uint8(_BT_OTHER),
  17677. 139: uint8(_BT_OTHER),
  17678. 140: uint8(_BT_OTHER),
  17679. 141: uint8(_BT_OTHER),
  17680. 142: uint8(_BT_OTHER),
  17681. 143: uint8(_BT_OTHER),
  17682. 144: uint8(_BT_OTHER),
  17683. 145: uint8(_BT_OTHER),
  17684. 146: uint8(_BT_OTHER),
  17685. 147: uint8(_BT_OTHER),
  17686. 148: uint8(_BT_OTHER),
  17687. 149: uint8(_BT_OTHER),
  17688. 150: uint8(_BT_OTHER),
  17689. 151: uint8(_BT_OTHER),
  17690. 152: uint8(_BT_OTHER),
  17691. 153: uint8(_BT_OTHER),
  17692. 154: uint8(_BT_OTHER),
  17693. 155: uint8(_BT_OTHER),
  17694. 156: uint8(_BT_OTHER),
  17695. 157: uint8(_BT_OTHER),
  17696. 158: uint8(_BT_OTHER),
  17697. 159: uint8(_BT_OTHER),
  17698. 160: uint8(_BT_OTHER),
  17699. 161: uint8(_BT_OTHER),
  17700. 162: uint8(_BT_OTHER),
  17701. 163: uint8(_BT_OTHER),
  17702. 164: uint8(_BT_OTHER),
  17703. 165: uint8(_BT_OTHER),
  17704. 166: uint8(_BT_OTHER),
  17705. 167: uint8(_BT_OTHER),
  17706. 168: uint8(_BT_OTHER),
  17707. 169: uint8(_BT_OTHER),
  17708. 170: uint8(_BT_NMSTRT),
  17709. 171: uint8(_BT_OTHER),
  17710. 172: uint8(_BT_OTHER),
  17711. 173: uint8(_BT_OTHER),
  17712. 174: uint8(_BT_OTHER),
  17713. 175: uint8(_BT_OTHER),
  17714. 176: uint8(_BT_OTHER),
  17715. 177: uint8(_BT_OTHER),
  17716. 178: uint8(_BT_OTHER),
  17717. 179: uint8(_BT_OTHER),
  17718. 180: uint8(_BT_OTHER),
  17719. 181: uint8(_BT_NMSTRT),
  17720. 182: uint8(_BT_OTHER),
  17721. 183: uint8(_BT_NAME),
  17722. 184: uint8(_BT_OTHER),
  17723. 185: uint8(_BT_OTHER),
  17724. 186: uint8(_BT_NMSTRT),
  17725. 187: uint8(_BT_OTHER),
  17726. 188: uint8(_BT_OTHER),
  17727. 189: uint8(_BT_OTHER),
  17728. 190: uint8(_BT_OTHER),
  17729. 191: uint8(_BT_OTHER),
  17730. 192: uint8(_BT_NMSTRT),
  17731. 193: uint8(_BT_NMSTRT),
  17732. 194: uint8(_BT_NMSTRT),
  17733. 195: uint8(_BT_NMSTRT),
  17734. 196: uint8(_BT_NMSTRT),
  17735. 197: uint8(_BT_NMSTRT),
  17736. 198: uint8(_BT_NMSTRT),
  17737. 199: uint8(_BT_NMSTRT),
  17738. 200: uint8(_BT_NMSTRT),
  17739. 201: uint8(_BT_NMSTRT),
  17740. 202: uint8(_BT_NMSTRT),
  17741. 203: uint8(_BT_NMSTRT),
  17742. 204: uint8(_BT_NMSTRT),
  17743. 205: uint8(_BT_NMSTRT),
  17744. 206: uint8(_BT_NMSTRT),
  17745. 207: uint8(_BT_NMSTRT),
  17746. 208: uint8(_BT_NMSTRT),
  17747. 209: uint8(_BT_NMSTRT),
  17748. 210: uint8(_BT_NMSTRT),
  17749. 211: uint8(_BT_NMSTRT),
  17750. 212: uint8(_BT_NMSTRT),
  17751. 213: uint8(_BT_NMSTRT),
  17752. 214: uint8(_BT_NMSTRT),
  17753. 215: uint8(_BT_OTHER),
  17754. 216: uint8(_BT_NMSTRT),
  17755. 217: uint8(_BT_NMSTRT),
  17756. 218: uint8(_BT_NMSTRT),
  17757. 219: uint8(_BT_NMSTRT),
  17758. 220: uint8(_BT_NMSTRT),
  17759. 221: uint8(_BT_NMSTRT),
  17760. 222: uint8(_BT_NMSTRT),
  17761. 223: uint8(_BT_NMSTRT),
  17762. 224: uint8(_BT_NMSTRT),
  17763. 225: uint8(_BT_NMSTRT),
  17764. 226: uint8(_BT_NMSTRT),
  17765. 227: uint8(_BT_NMSTRT),
  17766. 228: uint8(_BT_NMSTRT),
  17767. 229: uint8(_BT_NMSTRT),
  17768. 230: uint8(_BT_NMSTRT),
  17769. 231: uint8(_BT_NMSTRT),
  17770. 232: uint8(_BT_NMSTRT),
  17771. 233: uint8(_BT_NMSTRT),
  17772. 234: uint8(_BT_NMSTRT),
  17773. 235: uint8(_BT_NMSTRT),
  17774. 236: uint8(_BT_NMSTRT),
  17775. 237: uint8(_BT_NMSTRT),
  17776. 238: uint8(_BT_NMSTRT),
  17777. 239: uint8(_BT_NMSTRT),
  17778. 240: uint8(_BT_NMSTRT),
  17779. 241: uint8(_BT_NMSTRT),
  17780. 242: uint8(_BT_NMSTRT),
  17781. 243: uint8(_BT_NMSTRT),
  17782. 244: uint8(_BT_NMSTRT),
  17783. 245: uint8(_BT_NMSTRT),
  17784. 246: uint8(_BT_NMSTRT),
  17785. 247: uint8(_BT_OTHER),
  17786. 248: uint8(_BT_NMSTRT),
  17787. 249: uint8(_BT_NMSTRT),
  17788. 250: uint8(_BT_NMSTRT),
  17789. 251: uint8(_BT_NMSTRT),
  17790. 252: uint8(_BT_NMSTRT),
  17791. 253: uint8(_BT_NMSTRT),
  17792. 254: uint8(_BT_NMSTRT),
  17793. 255: uint8(_BT_NMSTRT),
  17794. },
  17795. }
  17796. func init() {
  17797. p := unsafe.Pointer(&_latin1_encoding_ns)
  17798. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  17799. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  17800. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  17801. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  17802. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  17803. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  17804. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  17805. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  17806. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  17807. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  17808. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  17809. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  17810. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  17811. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  17812. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_latin1_toUtf8)
  17813. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  17814. }
  17815. var _latin1_encoding = Tnormal_encoding{
  17816. Fenc: TENCODING{
  17817. Fscanners: [4]TSCANNER{},
  17818. FliteralScanners: [2]TSCANNER{},
  17819. FminBytesPerChar: int32(1),
  17820. },
  17821. Ftype1: [256]uint8{
  17822. 9: uint8(_BT_S),
  17823. 10: uint8(_BT_LF),
  17824. 13: uint8(_BT_CR),
  17825. 32: uint8(_BT_S),
  17826. 33: uint8(_BT_EXCL),
  17827. 34: uint8(_BT_QUOT),
  17828. 35: uint8(_BT_NUM),
  17829. 36: uint8(_BT_OTHER),
  17830. 37: uint8(_BT_PERCNT),
  17831. 38: uint8(_BT_AMP),
  17832. 39: uint8(_BT_APOS),
  17833. 40: uint8(_BT_LPAR),
  17834. 41: uint8(_BT_RPAR),
  17835. 42: uint8(_BT_AST),
  17836. 43: uint8(_BT_PLUS),
  17837. 44: uint8(_BT_COMMA),
  17838. 45: uint8(_BT_MINUS),
  17839. 46: uint8(_BT_NAME),
  17840. 47: uint8(_BT_SOL),
  17841. 48: uint8(_BT_DIGIT),
  17842. 49: uint8(_BT_DIGIT),
  17843. 50: uint8(_BT_DIGIT),
  17844. 51: uint8(_BT_DIGIT),
  17845. 52: uint8(_BT_DIGIT),
  17846. 53: uint8(_BT_DIGIT),
  17847. 54: uint8(_BT_DIGIT),
  17848. 55: uint8(_BT_DIGIT),
  17849. 56: uint8(_BT_DIGIT),
  17850. 57: uint8(_BT_DIGIT),
  17851. 58: uint8(_BT_NMSTRT),
  17852. 59: uint8(_BT_SEMI),
  17853. 60: uint8(_BT_LT),
  17854. 61: uint8(_BT_EQUALS),
  17855. 62: uint8(_BT_GT),
  17856. 63: uint8(_BT_QUEST),
  17857. 64: uint8(_BT_OTHER),
  17858. 65: uint8(_BT_HEX),
  17859. 66: uint8(_BT_HEX),
  17860. 67: uint8(_BT_HEX),
  17861. 68: uint8(_BT_HEX),
  17862. 69: uint8(_BT_HEX),
  17863. 70: uint8(_BT_HEX),
  17864. 71: uint8(_BT_NMSTRT),
  17865. 72: uint8(_BT_NMSTRT),
  17866. 73: uint8(_BT_NMSTRT),
  17867. 74: uint8(_BT_NMSTRT),
  17868. 75: uint8(_BT_NMSTRT),
  17869. 76: uint8(_BT_NMSTRT),
  17870. 77: uint8(_BT_NMSTRT),
  17871. 78: uint8(_BT_NMSTRT),
  17872. 79: uint8(_BT_NMSTRT),
  17873. 80: uint8(_BT_NMSTRT),
  17874. 81: uint8(_BT_NMSTRT),
  17875. 82: uint8(_BT_NMSTRT),
  17876. 83: uint8(_BT_NMSTRT),
  17877. 84: uint8(_BT_NMSTRT),
  17878. 85: uint8(_BT_NMSTRT),
  17879. 86: uint8(_BT_NMSTRT),
  17880. 87: uint8(_BT_NMSTRT),
  17881. 88: uint8(_BT_NMSTRT),
  17882. 89: uint8(_BT_NMSTRT),
  17883. 90: uint8(_BT_NMSTRT),
  17884. 91: uint8(_BT_LSQB),
  17885. 92: uint8(_BT_OTHER),
  17886. 93: uint8(_BT_RSQB),
  17887. 94: uint8(_BT_OTHER),
  17888. 95: uint8(_BT_NMSTRT),
  17889. 96: uint8(_BT_OTHER),
  17890. 97: uint8(_BT_HEX),
  17891. 98: uint8(_BT_HEX),
  17892. 99: uint8(_BT_HEX),
  17893. 100: uint8(_BT_HEX),
  17894. 101: uint8(_BT_HEX),
  17895. 102: uint8(_BT_HEX),
  17896. 103: uint8(_BT_NMSTRT),
  17897. 104: uint8(_BT_NMSTRT),
  17898. 105: uint8(_BT_NMSTRT),
  17899. 106: uint8(_BT_NMSTRT),
  17900. 107: uint8(_BT_NMSTRT),
  17901. 108: uint8(_BT_NMSTRT),
  17902. 109: uint8(_BT_NMSTRT),
  17903. 110: uint8(_BT_NMSTRT),
  17904. 111: uint8(_BT_NMSTRT),
  17905. 112: uint8(_BT_NMSTRT),
  17906. 113: uint8(_BT_NMSTRT),
  17907. 114: uint8(_BT_NMSTRT),
  17908. 115: uint8(_BT_NMSTRT),
  17909. 116: uint8(_BT_NMSTRT),
  17910. 117: uint8(_BT_NMSTRT),
  17911. 118: uint8(_BT_NMSTRT),
  17912. 119: uint8(_BT_NMSTRT),
  17913. 120: uint8(_BT_NMSTRT),
  17914. 121: uint8(_BT_NMSTRT),
  17915. 122: uint8(_BT_NMSTRT),
  17916. 123: uint8(_BT_OTHER),
  17917. 124: uint8(_BT_VERBAR),
  17918. 125: uint8(_BT_OTHER),
  17919. 126: uint8(_BT_OTHER),
  17920. 127: uint8(_BT_OTHER),
  17921. 128: uint8(_BT_OTHER),
  17922. 129: uint8(_BT_OTHER),
  17923. 130: uint8(_BT_OTHER),
  17924. 131: uint8(_BT_OTHER),
  17925. 132: uint8(_BT_OTHER),
  17926. 133: uint8(_BT_OTHER),
  17927. 134: uint8(_BT_OTHER),
  17928. 135: uint8(_BT_OTHER),
  17929. 136: uint8(_BT_OTHER),
  17930. 137: uint8(_BT_OTHER),
  17931. 138: uint8(_BT_OTHER),
  17932. 139: uint8(_BT_OTHER),
  17933. 140: uint8(_BT_OTHER),
  17934. 141: uint8(_BT_OTHER),
  17935. 142: uint8(_BT_OTHER),
  17936. 143: uint8(_BT_OTHER),
  17937. 144: uint8(_BT_OTHER),
  17938. 145: uint8(_BT_OTHER),
  17939. 146: uint8(_BT_OTHER),
  17940. 147: uint8(_BT_OTHER),
  17941. 148: uint8(_BT_OTHER),
  17942. 149: uint8(_BT_OTHER),
  17943. 150: uint8(_BT_OTHER),
  17944. 151: uint8(_BT_OTHER),
  17945. 152: uint8(_BT_OTHER),
  17946. 153: uint8(_BT_OTHER),
  17947. 154: uint8(_BT_OTHER),
  17948. 155: uint8(_BT_OTHER),
  17949. 156: uint8(_BT_OTHER),
  17950. 157: uint8(_BT_OTHER),
  17951. 158: uint8(_BT_OTHER),
  17952. 159: uint8(_BT_OTHER),
  17953. 160: uint8(_BT_OTHER),
  17954. 161: uint8(_BT_OTHER),
  17955. 162: uint8(_BT_OTHER),
  17956. 163: uint8(_BT_OTHER),
  17957. 164: uint8(_BT_OTHER),
  17958. 165: uint8(_BT_OTHER),
  17959. 166: uint8(_BT_OTHER),
  17960. 167: uint8(_BT_OTHER),
  17961. 168: uint8(_BT_OTHER),
  17962. 169: uint8(_BT_OTHER),
  17963. 170: uint8(_BT_NMSTRT),
  17964. 171: uint8(_BT_OTHER),
  17965. 172: uint8(_BT_OTHER),
  17966. 173: uint8(_BT_OTHER),
  17967. 174: uint8(_BT_OTHER),
  17968. 175: uint8(_BT_OTHER),
  17969. 176: uint8(_BT_OTHER),
  17970. 177: uint8(_BT_OTHER),
  17971. 178: uint8(_BT_OTHER),
  17972. 179: uint8(_BT_OTHER),
  17973. 180: uint8(_BT_OTHER),
  17974. 181: uint8(_BT_NMSTRT),
  17975. 182: uint8(_BT_OTHER),
  17976. 183: uint8(_BT_NAME),
  17977. 184: uint8(_BT_OTHER),
  17978. 185: uint8(_BT_OTHER),
  17979. 186: uint8(_BT_NMSTRT),
  17980. 187: uint8(_BT_OTHER),
  17981. 188: uint8(_BT_OTHER),
  17982. 189: uint8(_BT_OTHER),
  17983. 190: uint8(_BT_OTHER),
  17984. 191: uint8(_BT_OTHER),
  17985. 192: uint8(_BT_NMSTRT),
  17986. 193: uint8(_BT_NMSTRT),
  17987. 194: uint8(_BT_NMSTRT),
  17988. 195: uint8(_BT_NMSTRT),
  17989. 196: uint8(_BT_NMSTRT),
  17990. 197: uint8(_BT_NMSTRT),
  17991. 198: uint8(_BT_NMSTRT),
  17992. 199: uint8(_BT_NMSTRT),
  17993. 200: uint8(_BT_NMSTRT),
  17994. 201: uint8(_BT_NMSTRT),
  17995. 202: uint8(_BT_NMSTRT),
  17996. 203: uint8(_BT_NMSTRT),
  17997. 204: uint8(_BT_NMSTRT),
  17998. 205: uint8(_BT_NMSTRT),
  17999. 206: uint8(_BT_NMSTRT),
  18000. 207: uint8(_BT_NMSTRT),
  18001. 208: uint8(_BT_NMSTRT),
  18002. 209: uint8(_BT_NMSTRT),
  18003. 210: uint8(_BT_NMSTRT),
  18004. 211: uint8(_BT_NMSTRT),
  18005. 212: uint8(_BT_NMSTRT),
  18006. 213: uint8(_BT_NMSTRT),
  18007. 214: uint8(_BT_NMSTRT),
  18008. 215: uint8(_BT_OTHER),
  18009. 216: uint8(_BT_NMSTRT),
  18010. 217: uint8(_BT_NMSTRT),
  18011. 218: uint8(_BT_NMSTRT),
  18012. 219: uint8(_BT_NMSTRT),
  18013. 220: uint8(_BT_NMSTRT),
  18014. 221: uint8(_BT_NMSTRT),
  18015. 222: uint8(_BT_NMSTRT),
  18016. 223: uint8(_BT_NMSTRT),
  18017. 224: uint8(_BT_NMSTRT),
  18018. 225: uint8(_BT_NMSTRT),
  18019. 226: uint8(_BT_NMSTRT),
  18020. 227: uint8(_BT_NMSTRT),
  18021. 228: uint8(_BT_NMSTRT),
  18022. 229: uint8(_BT_NMSTRT),
  18023. 230: uint8(_BT_NMSTRT),
  18024. 231: uint8(_BT_NMSTRT),
  18025. 232: uint8(_BT_NMSTRT),
  18026. 233: uint8(_BT_NMSTRT),
  18027. 234: uint8(_BT_NMSTRT),
  18028. 235: uint8(_BT_NMSTRT),
  18029. 236: uint8(_BT_NMSTRT),
  18030. 237: uint8(_BT_NMSTRT),
  18031. 238: uint8(_BT_NMSTRT),
  18032. 239: uint8(_BT_NMSTRT),
  18033. 240: uint8(_BT_NMSTRT),
  18034. 241: uint8(_BT_NMSTRT),
  18035. 242: uint8(_BT_NMSTRT),
  18036. 243: uint8(_BT_NMSTRT),
  18037. 244: uint8(_BT_NMSTRT),
  18038. 245: uint8(_BT_NMSTRT),
  18039. 246: uint8(_BT_NMSTRT),
  18040. 247: uint8(_BT_OTHER),
  18041. 248: uint8(_BT_NMSTRT),
  18042. 249: uint8(_BT_NMSTRT),
  18043. 250: uint8(_BT_NMSTRT),
  18044. 251: uint8(_BT_NMSTRT),
  18045. 252: uint8(_BT_NMSTRT),
  18046. 253: uint8(_BT_NMSTRT),
  18047. 254: uint8(_BT_NMSTRT),
  18048. 255: uint8(_BT_NMSTRT),
  18049. },
  18050. }
  18051. func init() {
  18052. p := unsafe.Pointer(&_latin1_encoding)
  18053. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  18054. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  18055. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  18056. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  18057. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  18058. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  18059. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  18060. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  18061. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  18062. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  18063. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  18064. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  18065. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  18066. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  18067. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_latin1_toUtf8)
  18068. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  18069. }
  18070. func _ascii_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18071. var v1, v2, v3, v4 uintptr
  18072. _, _, _, _ = v1, v2, v3, v4
  18073. _ = enc
  18074. for *(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim {
  18075. v2 = toP
  18076. v1 = *(*uintptr)(unsafe.Pointer(v2))
  18077. *(*uintptr)(unsafe.Pointer(v2))++
  18078. v4 = fromP
  18079. v3 = *(*uintptr)(unsafe.Pointer(v4))
  18080. *(*uintptr)(unsafe.Pointer(v4))++
  18081. *(*int8)(unsafe.Pointer(v1)) = *(*int8)(unsafe.Pointer(v3))
  18082. }
  18083. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  18084. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18085. } else {
  18086. return int32(_XML_CONVERT_COMPLETED)
  18087. }
  18088. return r
  18089. }
  18090. var _ascii_encoding_ns = Tnormal_encoding{
  18091. Fenc: TENCODING{
  18092. Fscanners: [4]TSCANNER{},
  18093. FliteralScanners: [2]TSCANNER{},
  18094. FminBytesPerChar: int32(1),
  18095. FisUtf8: int8(1),
  18096. },
  18097. Ftype1: [256]uint8{
  18098. 9: uint8(_BT_S),
  18099. 10: uint8(_BT_LF),
  18100. 13: uint8(_BT_CR),
  18101. 32: uint8(_BT_S),
  18102. 33: uint8(_BT_EXCL),
  18103. 34: uint8(_BT_QUOT),
  18104. 35: uint8(_BT_NUM),
  18105. 36: uint8(_BT_OTHER),
  18106. 37: uint8(_BT_PERCNT),
  18107. 38: uint8(_BT_AMP),
  18108. 39: uint8(_BT_APOS),
  18109. 40: uint8(_BT_LPAR),
  18110. 41: uint8(_BT_RPAR),
  18111. 42: uint8(_BT_AST),
  18112. 43: uint8(_BT_PLUS),
  18113. 44: uint8(_BT_COMMA),
  18114. 45: uint8(_BT_MINUS),
  18115. 46: uint8(_BT_NAME),
  18116. 47: uint8(_BT_SOL),
  18117. 48: uint8(_BT_DIGIT),
  18118. 49: uint8(_BT_DIGIT),
  18119. 50: uint8(_BT_DIGIT),
  18120. 51: uint8(_BT_DIGIT),
  18121. 52: uint8(_BT_DIGIT),
  18122. 53: uint8(_BT_DIGIT),
  18123. 54: uint8(_BT_DIGIT),
  18124. 55: uint8(_BT_DIGIT),
  18125. 56: uint8(_BT_DIGIT),
  18126. 57: uint8(_BT_DIGIT),
  18127. 58: uint8(_BT_COLON),
  18128. 59: uint8(_BT_SEMI),
  18129. 60: uint8(_BT_LT),
  18130. 61: uint8(_BT_EQUALS),
  18131. 62: uint8(_BT_GT),
  18132. 63: uint8(_BT_QUEST),
  18133. 64: uint8(_BT_OTHER),
  18134. 65: uint8(_BT_HEX),
  18135. 66: uint8(_BT_HEX),
  18136. 67: uint8(_BT_HEX),
  18137. 68: uint8(_BT_HEX),
  18138. 69: uint8(_BT_HEX),
  18139. 70: uint8(_BT_HEX),
  18140. 71: uint8(_BT_NMSTRT),
  18141. 72: uint8(_BT_NMSTRT),
  18142. 73: uint8(_BT_NMSTRT),
  18143. 74: uint8(_BT_NMSTRT),
  18144. 75: uint8(_BT_NMSTRT),
  18145. 76: uint8(_BT_NMSTRT),
  18146. 77: uint8(_BT_NMSTRT),
  18147. 78: uint8(_BT_NMSTRT),
  18148. 79: uint8(_BT_NMSTRT),
  18149. 80: uint8(_BT_NMSTRT),
  18150. 81: uint8(_BT_NMSTRT),
  18151. 82: uint8(_BT_NMSTRT),
  18152. 83: uint8(_BT_NMSTRT),
  18153. 84: uint8(_BT_NMSTRT),
  18154. 85: uint8(_BT_NMSTRT),
  18155. 86: uint8(_BT_NMSTRT),
  18156. 87: uint8(_BT_NMSTRT),
  18157. 88: uint8(_BT_NMSTRT),
  18158. 89: uint8(_BT_NMSTRT),
  18159. 90: uint8(_BT_NMSTRT),
  18160. 91: uint8(_BT_LSQB),
  18161. 92: uint8(_BT_OTHER),
  18162. 93: uint8(_BT_RSQB),
  18163. 94: uint8(_BT_OTHER),
  18164. 95: uint8(_BT_NMSTRT),
  18165. 96: uint8(_BT_OTHER),
  18166. 97: uint8(_BT_HEX),
  18167. 98: uint8(_BT_HEX),
  18168. 99: uint8(_BT_HEX),
  18169. 100: uint8(_BT_HEX),
  18170. 101: uint8(_BT_HEX),
  18171. 102: uint8(_BT_HEX),
  18172. 103: uint8(_BT_NMSTRT),
  18173. 104: uint8(_BT_NMSTRT),
  18174. 105: uint8(_BT_NMSTRT),
  18175. 106: uint8(_BT_NMSTRT),
  18176. 107: uint8(_BT_NMSTRT),
  18177. 108: uint8(_BT_NMSTRT),
  18178. 109: uint8(_BT_NMSTRT),
  18179. 110: uint8(_BT_NMSTRT),
  18180. 111: uint8(_BT_NMSTRT),
  18181. 112: uint8(_BT_NMSTRT),
  18182. 113: uint8(_BT_NMSTRT),
  18183. 114: uint8(_BT_NMSTRT),
  18184. 115: uint8(_BT_NMSTRT),
  18185. 116: uint8(_BT_NMSTRT),
  18186. 117: uint8(_BT_NMSTRT),
  18187. 118: uint8(_BT_NMSTRT),
  18188. 119: uint8(_BT_NMSTRT),
  18189. 120: uint8(_BT_NMSTRT),
  18190. 121: uint8(_BT_NMSTRT),
  18191. 122: uint8(_BT_NMSTRT),
  18192. 123: uint8(_BT_OTHER),
  18193. 124: uint8(_BT_VERBAR),
  18194. 125: uint8(_BT_OTHER),
  18195. 126: uint8(_BT_OTHER),
  18196. 127: uint8(_BT_OTHER),
  18197. },
  18198. }
  18199. func init() {
  18200. p := unsafe.Pointer(&_ascii_encoding_ns)
  18201. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  18202. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  18203. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  18204. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  18205. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  18206. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  18207. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  18208. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  18209. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  18210. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  18211. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  18212. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  18213. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  18214. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  18215. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_ascii_toUtf8)
  18216. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  18217. }
  18218. var _ascii_encoding = Tnormal_encoding{
  18219. Fenc: TENCODING{
  18220. Fscanners: [4]TSCANNER{},
  18221. FliteralScanners: [2]TSCANNER{},
  18222. FminBytesPerChar: int32(1),
  18223. FisUtf8: int8(1),
  18224. },
  18225. Ftype1: [256]uint8{
  18226. 9: uint8(_BT_S),
  18227. 10: uint8(_BT_LF),
  18228. 13: uint8(_BT_CR),
  18229. 32: uint8(_BT_S),
  18230. 33: uint8(_BT_EXCL),
  18231. 34: uint8(_BT_QUOT),
  18232. 35: uint8(_BT_NUM),
  18233. 36: uint8(_BT_OTHER),
  18234. 37: uint8(_BT_PERCNT),
  18235. 38: uint8(_BT_AMP),
  18236. 39: uint8(_BT_APOS),
  18237. 40: uint8(_BT_LPAR),
  18238. 41: uint8(_BT_RPAR),
  18239. 42: uint8(_BT_AST),
  18240. 43: uint8(_BT_PLUS),
  18241. 44: uint8(_BT_COMMA),
  18242. 45: uint8(_BT_MINUS),
  18243. 46: uint8(_BT_NAME),
  18244. 47: uint8(_BT_SOL),
  18245. 48: uint8(_BT_DIGIT),
  18246. 49: uint8(_BT_DIGIT),
  18247. 50: uint8(_BT_DIGIT),
  18248. 51: uint8(_BT_DIGIT),
  18249. 52: uint8(_BT_DIGIT),
  18250. 53: uint8(_BT_DIGIT),
  18251. 54: uint8(_BT_DIGIT),
  18252. 55: uint8(_BT_DIGIT),
  18253. 56: uint8(_BT_DIGIT),
  18254. 57: uint8(_BT_DIGIT),
  18255. 58: uint8(_BT_NMSTRT),
  18256. 59: uint8(_BT_SEMI),
  18257. 60: uint8(_BT_LT),
  18258. 61: uint8(_BT_EQUALS),
  18259. 62: uint8(_BT_GT),
  18260. 63: uint8(_BT_QUEST),
  18261. 64: uint8(_BT_OTHER),
  18262. 65: uint8(_BT_HEX),
  18263. 66: uint8(_BT_HEX),
  18264. 67: uint8(_BT_HEX),
  18265. 68: uint8(_BT_HEX),
  18266. 69: uint8(_BT_HEX),
  18267. 70: uint8(_BT_HEX),
  18268. 71: uint8(_BT_NMSTRT),
  18269. 72: uint8(_BT_NMSTRT),
  18270. 73: uint8(_BT_NMSTRT),
  18271. 74: uint8(_BT_NMSTRT),
  18272. 75: uint8(_BT_NMSTRT),
  18273. 76: uint8(_BT_NMSTRT),
  18274. 77: uint8(_BT_NMSTRT),
  18275. 78: uint8(_BT_NMSTRT),
  18276. 79: uint8(_BT_NMSTRT),
  18277. 80: uint8(_BT_NMSTRT),
  18278. 81: uint8(_BT_NMSTRT),
  18279. 82: uint8(_BT_NMSTRT),
  18280. 83: uint8(_BT_NMSTRT),
  18281. 84: uint8(_BT_NMSTRT),
  18282. 85: uint8(_BT_NMSTRT),
  18283. 86: uint8(_BT_NMSTRT),
  18284. 87: uint8(_BT_NMSTRT),
  18285. 88: uint8(_BT_NMSTRT),
  18286. 89: uint8(_BT_NMSTRT),
  18287. 90: uint8(_BT_NMSTRT),
  18288. 91: uint8(_BT_LSQB),
  18289. 92: uint8(_BT_OTHER),
  18290. 93: uint8(_BT_RSQB),
  18291. 94: uint8(_BT_OTHER),
  18292. 95: uint8(_BT_NMSTRT),
  18293. 96: uint8(_BT_OTHER),
  18294. 97: uint8(_BT_HEX),
  18295. 98: uint8(_BT_HEX),
  18296. 99: uint8(_BT_HEX),
  18297. 100: uint8(_BT_HEX),
  18298. 101: uint8(_BT_HEX),
  18299. 102: uint8(_BT_HEX),
  18300. 103: uint8(_BT_NMSTRT),
  18301. 104: uint8(_BT_NMSTRT),
  18302. 105: uint8(_BT_NMSTRT),
  18303. 106: uint8(_BT_NMSTRT),
  18304. 107: uint8(_BT_NMSTRT),
  18305. 108: uint8(_BT_NMSTRT),
  18306. 109: uint8(_BT_NMSTRT),
  18307. 110: uint8(_BT_NMSTRT),
  18308. 111: uint8(_BT_NMSTRT),
  18309. 112: uint8(_BT_NMSTRT),
  18310. 113: uint8(_BT_NMSTRT),
  18311. 114: uint8(_BT_NMSTRT),
  18312. 115: uint8(_BT_NMSTRT),
  18313. 116: uint8(_BT_NMSTRT),
  18314. 117: uint8(_BT_NMSTRT),
  18315. 118: uint8(_BT_NMSTRT),
  18316. 119: uint8(_BT_NMSTRT),
  18317. 120: uint8(_BT_NMSTRT),
  18318. 121: uint8(_BT_NMSTRT),
  18319. 122: uint8(_BT_NMSTRT),
  18320. 123: uint8(_BT_OTHER),
  18321. 124: uint8(_BT_VERBAR),
  18322. 125: uint8(_BT_OTHER),
  18323. 126: uint8(_BT_OTHER),
  18324. 127: uint8(_BT_OTHER),
  18325. },
  18326. }
  18327. func init() {
  18328. p := unsafe.Pointer(&_ascii_encoding)
  18329. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  18330. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  18331. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  18332. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  18333. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  18334. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  18335. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  18336. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  18337. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  18338. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  18339. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  18340. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  18341. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  18342. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  18343. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_ascii_toUtf8)
  18344. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  18345. }
  18346. func _unicode_byte_type(tls *libc.TLS, hi int8, lo int8) (r int32) {
  18347. switch libc.Int32FromUint8(libc.Uint8FromInt8(hi)) {
  18348. /* 0xD800-0xDBFF first 16-bit code unit or high surrogate (W1) */
  18349. case int32(0xD8):
  18350. fallthrough
  18351. case int32(0xD9):
  18352. fallthrough
  18353. case int32(0xDA):
  18354. fallthrough
  18355. case int32(0xDB):
  18356. return int32(_BT_LEAD4)
  18357. /* 0xDC00-0xDFFF second 16-bit code unit or low surrogate (W2) */
  18358. fallthrough
  18359. case int32(0xDC):
  18360. fallthrough
  18361. case int32(0xDD):
  18362. fallthrough
  18363. case int32(0xDE):
  18364. fallthrough
  18365. case int32(0xDF):
  18366. return int32(_BT_TRAIL)
  18367. case int32(0xFF):
  18368. switch libc.Int32FromUint8(libc.Uint8FromInt8(lo)) {
  18369. case int32(0xFF): /* noncharacter-FFFF */
  18370. fallthrough
  18371. case int32(0xFE): /* noncharacter-FFFE */
  18372. return int32(_BT_NONXML)
  18373. }
  18374. break
  18375. }
  18376. return int32(_BT_NONASCII)
  18377. }
  18378. func _little2_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18379. var from, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v3, v4, v5, v6, v7, v8, v9 uintptr
  18380. var hi, lo, lo2 uint8
  18381. var plane int32
  18382. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  18383. from = *(*uintptr)(unsafe.Pointer(fromP))
  18384. _ = enc
  18385. fromLim = from + uintptr((int64(fromLim)-int64(from))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */
  18386. for {
  18387. if !(from < fromLim) {
  18388. break
  18389. }
  18390. lo = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from)))
  18391. hi = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from + 1)))
  18392. switch libc.Int32FromUint8(hi) {
  18393. case 0:
  18394. if libc.Int32FromUint8(lo) < int32(0x80) {
  18395. if *(*uintptr)(unsafe.Pointer(toP)) == toLim {
  18396. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18397. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18398. }
  18399. v3 = toP
  18400. v2 = *(*uintptr)(unsafe.Pointer(v3))
  18401. *(*uintptr)(unsafe.Pointer(v3))++
  18402. *(*int8)(unsafe.Pointer(v2)) = libc.Int8FromUint8(lo)
  18403. break
  18404. } /* fall through */
  18405. fallthrough
  18406. case int32(0x1):
  18407. fallthrough
  18408. case int32(0x2):
  18409. fallthrough
  18410. case int32(0x3):
  18411. fallthrough
  18412. case int32(0x4):
  18413. fallthrough
  18414. case int32(0x5):
  18415. fallthrough
  18416. case int32(0x6):
  18417. fallthrough
  18418. case int32(0x7):
  18419. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(2) {
  18420. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18421. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18422. }
  18423. v5 = toP
  18424. v4 = *(*uintptr)(unsafe.Pointer(v5))
  18425. *(*uintptr)(unsafe.Pointer(v5))++
  18426. *(*int8)(unsafe.Pointer(v4)) = int8(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromUint8(hi)<<libc.Int32FromInt32(2) | int32(_UTF8_cval2))
  18427. v7 = toP
  18428. v6 = *(*uintptr)(unsafe.Pointer(v7))
  18429. *(*uintptr)(unsafe.Pointer(v7))++
  18430. *(*int8)(unsafe.Pointer(v6)) = int8(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18431. default:
  18432. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(3) {
  18433. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18434. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18435. } /* 16 bits divided 4, 6, 6 amongst 3 bytes */
  18436. v9 = toP
  18437. v8 = *(*uintptr)(unsafe.Pointer(v9))
  18438. *(*uintptr)(unsafe.Pointer(v9))++
  18439. *(*int8)(unsafe.Pointer(v8)) = int8(libc.Int32FromUint8(hi)>>libc.Int32FromInt32(4) | int32(_UTF8_cval3))
  18440. v11 = toP
  18441. v10 = *(*uintptr)(unsafe.Pointer(v11))
  18442. *(*uintptr)(unsafe.Pointer(v11))++
  18443. *(*int8)(unsafe.Pointer(v10)) = int8(libc.Int32FromUint8(hi)&libc.Int32FromInt32(0xf)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  18444. v13 = toP
  18445. v12 = *(*uintptr)(unsafe.Pointer(v13))
  18446. *(*uintptr)(unsafe.Pointer(v13))++
  18447. *(*int8)(unsafe.Pointer(v12)) = int8(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18448. case int32(0xD8):
  18449. fallthrough
  18450. case int32(0xD9):
  18451. fallthrough
  18452. case int32(0xDA):
  18453. fallthrough
  18454. case int32(0xDB):
  18455. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(4) {
  18456. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18457. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18458. }
  18459. if int64(fromLim)-int64(from) < int64(4) {
  18460. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18461. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18462. }
  18463. plane = libc.Int32FromUint8(hi)&int32(0x3)<<int32(2) | libc.Int32FromUint8(lo)>>int32(6)&int32(0x3) + int32(1)
  18464. v15 = toP
  18465. v14 = *(*uintptr)(unsafe.Pointer(v15))
  18466. *(*uintptr)(unsafe.Pointer(v15))++
  18467. *(*int8)(unsafe.Pointer(v14)) = int8(plane>>libc.Int32FromInt32(2) | int32(_UTF8_cval4))
  18468. v17 = toP
  18469. v16 = *(*uintptr)(unsafe.Pointer(v17))
  18470. *(*uintptr)(unsafe.Pointer(v17))++
  18471. *(*int8)(unsafe.Pointer(v16)) = int8(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(2)&libc.Int32FromInt32(0xF) | plane&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromInt32(0x80))
  18472. from += uintptr(2)
  18473. lo2 = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from)))
  18474. v19 = toP
  18475. v18 = *(*uintptr)(unsafe.Pointer(v19))
  18476. *(*uintptr)(unsafe.Pointer(v19))++
  18477. *(*int8)(unsafe.Pointer(v18)) = int8(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from + 1))))&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo2)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  18478. v21 = toP
  18479. v20 = *(*uintptr)(unsafe.Pointer(v21))
  18480. *(*uintptr)(unsafe.Pointer(v21))++
  18481. *(*int8)(unsafe.Pointer(v20)) = int8(libc.Int32FromUint8(lo2)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18482. break
  18483. }
  18484. goto _1
  18485. _1:
  18486. ;
  18487. from += uintptr(2)
  18488. }
  18489. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18490. if from < fromLim {
  18491. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18492. } else {
  18493. return int32(_XML_CONVERT_COMPLETED)
  18494. }
  18495. return r
  18496. }
  18497. func _little2_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18498. var res _XML_Convert_Result
  18499. var v2, v3 uintptr
  18500. _, _, _ = res, v2, v3
  18501. res = int32(_XML_CONVERT_COMPLETED)
  18502. _ = enc
  18503. 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 */
  18504. if int64(fromLim)-int64(*(*uintptr)(unsafe.Pointer(fromP))) > (int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))))/2<<libc.Int32FromInt32(1) && libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(fromLim - libc.UintptrFromInt32(2) + 1))))&int32(0xF8) == int32(0xD8) {
  18505. fromLim -= uintptr(2)
  18506. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18507. }
  18508. for {
  18509. if !(*(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim) {
  18510. break
  18511. }
  18512. v3 = toP
  18513. v2 = *(*uintptr)(unsafe.Pointer(v3))
  18514. *(*uintptr)(unsafe.Pointer(v3)) += 2
  18515. *(*uint16)(unsafe.Pointer(v2)) = libc.Uint16FromInt32(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)) + 1))))<<int32(8) | libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)))))))
  18516. goto _1
  18517. _1:
  18518. ;
  18519. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(2)
  18520. }
  18521. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  18522. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18523. } else {
  18524. return res
  18525. }
  18526. return r
  18527. }
  18528. func _big2_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18529. var from, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v3, v4, v5, v6, v7, v8, v9 uintptr
  18530. var hi, lo, lo2 uint8
  18531. var plane int32
  18532. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  18533. from = *(*uintptr)(unsafe.Pointer(fromP))
  18534. _ = enc
  18535. fromLim = from + uintptr((int64(fromLim)-int64(from))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */
  18536. for {
  18537. if !(from < fromLim) {
  18538. break
  18539. }
  18540. lo = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from + 1)))
  18541. hi = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from)))
  18542. switch libc.Int32FromUint8(hi) {
  18543. case 0:
  18544. if libc.Int32FromUint8(lo) < int32(0x80) {
  18545. if *(*uintptr)(unsafe.Pointer(toP)) == toLim {
  18546. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18547. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18548. }
  18549. v3 = toP
  18550. v2 = *(*uintptr)(unsafe.Pointer(v3))
  18551. *(*uintptr)(unsafe.Pointer(v3))++
  18552. *(*int8)(unsafe.Pointer(v2)) = libc.Int8FromUint8(lo)
  18553. break
  18554. } /* fall through */
  18555. fallthrough
  18556. case int32(0x1):
  18557. fallthrough
  18558. case int32(0x2):
  18559. fallthrough
  18560. case int32(0x3):
  18561. fallthrough
  18562. case int32(0x4):
  18563. fallthrough
  18564. case int32(0x5):
  18565. fallthrough
  18566. case int32(0x6):
  18567. fallthrough
  18568. case int32(0x7):
  18569. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(2) {
  18570. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18571. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18572. }
  18573. v5 = toP
  18574. v4 = *(*uintptr)(unsafe.Pointer(v5))
  18575. *(*uintptr)(unsafe.Pointer(v5))++
  18576. *(*int8)(unsafe.Pointer(v4)) = int8(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromUint8(hi)<<libc.Int32FromInt32(2) | int32(_UTF8_cval2))
  18577. v7 = toP
  18578. v6 = *(*uintptr)(unsafe.Pointer(v7))
  18579. *(*uintptr)(unsafe.Pointer(v7))++
  18580. *(*int8)(unsafe.Pointer(v6)) = int8(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18581. default:
  18582. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(3) {
  18583. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18584. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18585. } /* 16 bits divided 4, 6, 6 amongst 3 bytes */
  18586. v9 = toP
  18587. v8 = *(*uintptr)(unsafe.Pointer(v9))
  18588. *(*uintptr)(unsafe.Pointer(v9))++
  18589. *(*int8)(unsafe.Pointer(v8)) = int8(libc.Int32FromUint8(hi)>>libc.Int32FromInt32(4) | int32(_UTF8_cval3))
  18590. v11 = toP
  18591. v10 = *(*uintptr)(unsafe.Pointer(v11))
  18592. *(*uintptr)(unsafe.Pointer(v11))++
  18593. *(*int8)(unsafe.Pointer(v10)) = int8(libc.Int32FromUint8(hi)&libc.Int32FromInt32(0xf)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  18594. v13 = toP
  18595. v12 = *(*uintptr)(unsafe.Pointer(v13))
  18596. *(*uintptr)(unsafe.Pointer(v13))++
  18597. *(*int8)(unsafe.Pointer(v12)) = int8(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18598. case int32(0xD8):
  18599. fallthrough
  18600. case int32(0xD9):
  18601. fallthrough
  18602. case int32(0xDA):
  18603. fallthrough
  18604. case int32(0xDB):
  18605. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(4) {
  18606. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18607. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18608. }
  18609. if int64(fromLim)-int64(from) < int64(4) {
  18610. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18611. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18612. }
  18613. plane = libc.Int32FromUint8(hi)&int32(0x3)<<int32(2) | libc.Int32FromUint8(lo)>>int32(6)&int32(0x3) + int32(1)
  18614. v15 = toP
  18615. v14 = *(*uintptr)(unsafe.Pointer(v15))
  18616. *(*uintptr)(unsafe.Pointer(v15))++
  18617. *(*int8)(unsafe.Pointer(v14)) = int8(plane>>libc.Int32FromInt32(2) | int32(_UTF8_cval4))
  18618. v17 = toP
  18619. v16 = *(*uintptr)(unsafe.Pointer(v17))
  18620. *(*uintptr)(unsafe.Pointer(v17))++
  18621. *(*int8)(unsafe.Pointer(v16)) = int8(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(2)&libc.Int32FromInt32(0xF) | plane&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromInt32(0x80))
  18622. from += uintptr(2)
  18623. lo2 = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from + 1)))
  18624. v19 = toP
  18625. v18 = *(*uintptr)(unsafe.Pointer(v19))
  18626. *(*uintptr)(unsafe.Pointer(v19))++
  18627. *(*int8)(unsafe.Pointer(v18)) = int8(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from))))&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo2)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  18628. v21 = toP
  18629. v20 = *(*uintptr)(unsafe.Pointer(v21))
  18630. *(*uintptr)(unsafe.Pointer(v21))++
  18631. *(*int8)(unsafe.Pointer(v20)) = int8(libc.Int32FromUint8(lo2)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18632. break
  18633. }
  18634. goto _1
  18635. _1:
  18636. ;
  18637. from += uintptr(2)
  18638. }
  18639. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18640. if from < fromLim {
  18641. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18642. } else {
  18643. return int32(_XML_CONVERT_COMPLETED)
  18644. }
  18645. return r
  18646. }
  18647. func _big2_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18648. var res _XML_Convert_Result
  18649. var v2, v3 uintptr
  18650. _, _, _ = res, v2, v3
  18651. res = int32(_XML_CONVERT_COMPLETED)
  18652. _ = enc
  18653. 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 */
  18654. if int64(fromLim)-int64(*(*uintptr)(unsafe.Pointer(fromP))) > (int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))))/2<<libc.Int32FromInt32(1) && libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(fromLim - libc.UintptrFromInt32(2)))))&int32(0xF8) == int32(0xD8) {
  18655. fromLim -= uintptr(2)
  18656. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18657. }
  18658. for {
  18659. if !(*(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim) {
  18660. break
  18661. }
  18662. v3 = toP
  18663. v2 = *(*uintptr)(unsafe.Pointer(v3))
  18664. *(*uintptr)(unsafe.Pointer(v3)) += 2
  18665. *(*uint16)(unsafe.Pointer(v2)) = libc.Uint16FromInt32(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP))))))<<int32(8) | libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)) + 1)))))
  18666. goto _1
  18667. _1:
  18668. ;
  18669. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(2)
  18670. }
  18671. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  18672. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18673. } else {
  18674. return res
  18675. }
  18676. return r
  18677. }
  18678. /* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
  18679. /* This file is included (from xmltok.c, 1-3 times depending on XML_MIN_SIZE)!
  18680. __ __ _
  18681. ___\ \/ /_ __ __ _| |_
  18682. / _ \\ /| '_ \ / _` | __|
  18683. | __// \| |_) | (_| | |_
  18684. \___/_/\_\ .__/ \__,_|\__|
  18685. |_| XML parser
  18686. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  18687. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  18688. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  18689. Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
  18690. Copyright (c) 2016-2022 Sebastian Pipping <sebastian@pipping.org>
  18691. Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
  18692. Copyright (c) 2018 Benjamin Peterson <benjamin@python.org>
  18693. Copyright (c) 2018 Anton Maklakov <antmak.pub@gmail.com>
  18694. Copyright (c) 2019 David Loffredo <loffredo@steptools.com>
  18695. Copyright (c) 2020 Boris Kolpackov <boris@codesynthesis.com>
  18696. Copyright (c) 2022 Martin Ettl <ettl.martin78@googlemail.com>
  18697. Licensed under the MIT license:
  18698. Permission is hereby granted, free of charge, to any person obtaining
  18699. a copy of this software and associated documentation files (the
  18700. "Software"), to deal in the Software without restriction, including
  18701. without limitation the rights to use, copy, modify, merge, publish,
  18702. distribute, sublicense, and/or sell copies of the Software, and to permit
  18703. persons to whom the Software is furnished to do so, subject to the
  18704. following conditions:
  18705. The above copyright notice and this permission notice shall be included
  18706. in all copies or substantial portions of the Software.
  18707. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  18708. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  18709. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  18710. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  18711. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  18712. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  18713. USE OR OTHER DEALINGS IN THE SOFTWARE.
  18714. */
  18715. /* ptr points to character following "<!-" */
  18716. func _little2_scanComment(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  18717. var v1 int32
  18718. _ = v1
  18719. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18720. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_MINUS1)) {
  18721. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18722. return m_XML_TOK_INVALID
  18723. }
  18724. ptr += uintptr(2)
  18725. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18726. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  18727. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  18728. } else {
  18729. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  18730. }
  18731. switch v1 {
  18732. case int32(_BT_LEAD2):
  18733. if int64(end)-int64(ptr) < int64(2) {
  18734. return -int32(2)
  18735. }
  18736. if 0 != 0 {
  18737. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18738. return m_XML_TOK_INVALID
  18739. }
  18740. ptr += uintptr(2)
  18741. case int32(_BT_LEAD3):
  18742. if int64(end)-int64(ptr) < int64(3) {
  18743. return -int32(2)
  18744. }
  18745. if 0 != 0 {
  18746. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18747. return m_XML_TOK_INVALID
  18748. }
  18749. ptr += uintptr(3)
  18750. case int32(_BT_LEAD4):
  18751. if int64(end)-int64(ptr) < int64(4) {
  18752. return -int32(2)
  18753. }
  18754. if 0 != 0 {
  18755. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18756. return m_XML_TOK_INVALID
  18757. }
  18758. ptr += uintptr(4)
  18759. case int32(_BT_NONXML):
  18760. fallthrough
  18761. case int32(_BT_MALFORM):
  18762. fallthrough
  18763. case int32(_BT_TRAIL):
  18764. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18765. return m_XML_TOK_INVALID
  18766. case int32(_BT_MINUS):
  18767. ptr += uintptr(2)
  18768. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18769. return -int32(1)
  18770. }
  18771. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_MINUS1) {
  18772. ptr += uintptr(2)
  18773. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18774. return -int32(1)
  18775. }
  18776. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  18777. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18778. return m_XML_TOK_INVALID
  18779. }
  18780. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18781. return int32(m_XML_TOK_COMMENT)
  18782. }
  18783. default:
  18784. ptr += uintptr(2)
  18785. break
  18786. }
  18787. }
  18788. }
  18789. return -int32(1)
  18790. }
  18791. /* ptr points to character following "<!" */
  18792. func _little2_scanDecl(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  18793. var v1, v2, v3 int32
  18794. _, _, _ = v1, v2, v3
  18795. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18796. return -int32(1)
  18797. }
  18798. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  18799. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  18800. } else {
  18801. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  18802. }
  18803. switch v1 {
  18804. case int32(_BT_MINUS):
  18805. return _little2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  18806. case int32(_BT_LSQB):
  18807. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18808. return int32(m_XML_TOK_COND_SECT_OPEN)
  18809. case int32(_BT_NMSTRT):
  18810. fallthrough
  18811. case int32(_BT_HEX):
  18812. ptr += uintptr(2)
  18813. default:
  18814. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18815. return m_XML_TOK_INVALID
  18816. }
  18817. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18818. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  18819. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  18820. } else {
  18821. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  18822. }
  18823. switch v2 {
  18824. case int32(_BT_PERCNT):
  18825. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  18826. return -int32(1)
  18827. }
  18828. /* don't allow <!ENTITY% foo "whatever"> */
  18829. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 {
  18830. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))))))
  18831. } else {
  18832. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)), *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))
  18833. }
  18834. switch v3 {
  18835. case int32(_BT_S):
  18836. fallthrough
  18837. case int32(_BT_CR):
  18838. fallthrough
  18839. case int32(_BT_LF):
  18840. fallthrough
  18841. case int32(_BT_PERCNT):
  18842. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18843. return m_XML_TOK_INVALID
  18844. }
  18845. /* fall through */
  18846. fallthrough
  18847. case int32(_BT_S):
  18848. fallthrough
  18849. case int32(_BT_CR):
  18850. fallthrough
  18851. case int32(_BT_LF):
  18852. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18853. return int32(m_XML_TOK_DECL_OPEN)
  18854. case int32(_BT_NMSTRT):
  18855. fallthrough
  18856. case int32(_BT_HEX):
  18857. ptr += uintptr(2)
  18858. default:
  18859. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18860. return m_XML_TOK_INVALID
  18861. }
  18862. }
  18863. return -int32(1)
  18864. }
  18865. func _little2_checkPiTarget(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, tokPtr uintptr) (r int32) {
  18866. var upper, v1, v2, v3 int32
  18867. _, _, _, _ = upper, v1, v2, v3
  18868. upper = 0
  18869. _ = enc
  18870. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_PI)
  18871. if int64(end)-int64(ptr) != int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(3)) {
  18872. return int32(1)
  18873. }
  18874. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  18875. v1 = int32(*(*int8)(unsafe.Pointer(ptr)))
  18876. } else {
  18877. v1 = -int32(1)
  18878. }
  18879. switch v1 {
  18880. case int32(m_ASCII_x2):
  18881. case int32(m_ASCII_X):
  18882. upper = int32(1)
  18883. default:
  18884. return int32(1)
  18885. }
  18886. ptr += uintptr(2)
  18887. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  18888. v2 = int32(*(*int8)(unsafe.Pointer(ptr)))
  18889. } else {
  18890. v2 = -int32(1)
  18891. }
  18892. switch v2 {
  18893. case int32(m_ASCII_m2):
  18894. case int32(m_ASCII_M):
  18895. upper = int32(1)
  18896. default:
  18897. return int32(1)
  18898. }
  18899. ptr += uintptr(2)
  18900. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  18901. v3 = int32(*(*int8)(unsafe.Pointer(ptr)))
  18902. } else {
  18903. v3 = -int32(1)
  18904. }
  18905. switch v3 {
  18906. case int32(m_ASCII_l2):
  18907. case int32(m_ASCII_L):
  18908. upper = int32(1)
  18909. default:
  18910. return int32(1)
  18911. }
  18912. if upper != 0 {
  18913. return 0
  18914. }
  18915. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_XML_DECL)
  18916. return int32(1)
  18917. }
  18918. /* ptr points to character following "<?" */
  18919. func _little2_scanPi(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  18920. bp := tls.Alloc(16)
  18921. defer tls.Free(16)
  18922. var target uintptr
  18923. var v1, v2, v3 int32
  18924. var _ /* tok at bp+0 */ int32
  18925. _, _, _, _ = target, v1, v2, v3
  18926. target = ptr
  18927. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18928. return -int32(1)
  18929. }
  18930. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  18931. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  18932. } else {
  18933. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  18934. }
  18935. switch v1 {
  18936. case int32(_BT_NONASCII):
  18937. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  18938. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18939. return m_XML_TOK_INVALID
  18940. } /* fall through */
  18941. fallthrough
  18942. case int32(_BT_NMSTRT):
  18943. fallthrough
  18944. case int32(_BT_HEX):
  18945. ptr += uintptr(2)
  18946. case int32(_BT_LEAD2):
  18947. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  18948. return -int32(2)
  18949. }
  18950. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  18951. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18952. return m_XML_TOK_INVALID
  18953. }
  18954. ptr += uintptr(2)
  18955. case int32(_BT_LEAD3):
  18956. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  18957. return -int32(2)
  18958. }
  18959. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  18960. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18961. return m_XML_TOK_INVALID
  18962. }
  18963. ptr += uintptr(3)
  18964. case int32(_BT_LEAD4):
  18965. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  18966. return -int32(2)
  18967. }
  18968. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  18969. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18970. return m_XML_TOK_INVALID
  18971. }
  18972. ptr += uintptr(4)
  18973. default:
  18974. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18975. return m_XML_TOK_INVALID
  18976. }
  18977. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18978. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  18979. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  18980. } else {
  18981. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  18982. }
  18983. switch v2 {
  18984. case int32(_BT_NONASCII):
  18985. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  18986. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18987. return m_XML_TOK_INVALID
  18988. } /* fall through */
  18989. fallthrough
  18990. case int32(_BT_NMSTRT):
  18991. fallthrough
  18992. case int32(_BT_HEX):
  18993. fallthrough
  18994. case int32(_BT_DIGIT):
  18995. fallthrough
  18996. case int32(_BT_NAME):
  18997. fallthrough
  18998. case int32(_BT_MINUS):
  18999. ptr += uintptr(2)
  19000. case int32(_BT_LEAD2):
  19001. if int64(end)-int64(ptr) < int64(2) {
  19002. return -int32(2)
  19003. }
  19004. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19005. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19006. return m_XML_TOK_INVALID
  19007. }
  19008. ptr += uintptr(2)
  19009. case int32(_BT_LEAD3):
  19010. if int64(end)-int64(ptr) < int64(3) {
  19011. return -int32(2)
  19012. }
  19013. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19014. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19015. return m_XML_TOK_INVALID
  19016. }
  19017. ptr += uintptr(3)
  19018. case int32(_BT_LEAD4):
  19019. if int64(end)-int64(ptr) < int64(4) {
  19020. return -int32(2)
  19021. }
  19022. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19023. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19024. return m_XML_TOK_INVALID
  19025. }
  19026. ptr += uintptr(4)
  19027. case int32(_BT_S):
  19028. fallthrough
  19029. case int32(_BT_CR):
  19030. fallthrough
  19031. case int32(_BT_LF):
  19032. if !(_little2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  19033. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19034. return m_XML_TOK_INVALID
  19035. }
  19036. ptr += uintptr(2)
  19037. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19038. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19039. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19040. } else {
  19041. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19042. }
  19043. switch v3 {
  19044. case int32(_BT_LEAD2):
  19045. if int64(end)-int64(ptr) < int64(2) {
  19046. return -int32(2)
  19047. }
  19048. if 0 != 0 {
  19049. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19050. return m_XML_TOK_INVALID
  19051. }
  19052. ptr += uintptr(2)
  19053. case int32(_BT_LEAD3):
  19054. if int64(end)-int64(ptr) < int64(3) {
  19055. return -int32(2)
  19056. }
  19057. if 0 != 0 {
  19058. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19059. return m_XML_TOK_INVALID
  19060. }
  19061. ptr += uintptr(3)
  19062. case int32(_BT_LEAD4):
  19063. if int64(end)-int64(ptr) < int64(4) {
  19064. return -int32(2)
  19065. }
  19066. if 0 != 0 {
  19067. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19068. return m_XML_TOK_INVALID
  19069. }
  19070. ptr += uintptr(4)
  19071. case int32(_BT_NONXML):
  19072. fallthrough
  19073. case int32(_BT_MALFORM):
  19074. fallthrough
  19075. case int32(_BT_TRAIL):
  19076. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19077. return m_XML_TOK_INVALID
  19078. case int32(_BT_QUEST):
  19079. ptr += uintptr(2)
  19080. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19081. return -int32(1)
  19082. }
  19083. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  19084. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19085. return *(*int32)(unsafe.Pointer(bp))
  19086. }
  19087. default:
  19088. ptr += uintptr(2)
  19089. break
  19090. }
  19091. }
  19092. return -int32(1)
  19093. case int32(_BT_QUEST):
  19094. if !(_little2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  19095. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19096. return m_XML_TOK_INVALID
  19097. }
  19098. ptr += uintptr(2)
  19099. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19100. return -int32(1)
  19101. }
  19102. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  19103. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19104. return *(*int32)(unsafe.Pointer(bp))
  19105. }
  19106. /* fall through */
  19107. fallthrough
  19108. default:
  19109. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19110. return m_XML_TOK_INVALID
  19111. }
  19112. }
  19113. return -int32(1)
  19114. }
  19115. func _little2_scanCdataSection(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19116. var i int32
  19117. _ = i
  19118. _ = enc
  19119. /* CDATA[ */
  19120. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(6)*libc.Int32FromInt32(2))) {
  19121. return -int32(1)
  19122. }
  19123. i = 0
  19124. for {
  19125. if !(i < int32(6)) {
  19126. break
  19127. }
  19128. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(_CDATA_LSQB1[i])) {
  19129. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19130. return m_XML_TOK_INVALID
  19131. }
  19132. goto _1
  19133. _1:
  19134. ;
  19135. i++
  19136. ptr += uintptr(2)
  19137. }
  19138. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19139. return int32(m_XML_TOK_CDATA_SECT_OPEN)
  19140. }
  19141. var _CDATA_LSQB1 = [6]int8{
  19142. 0: int8(m_ASCII_C),
  19143. 1: int8(m_ASCII_D),
  19144. 2: int8(m_ASCII_A),
  19145. 3: int8(m_ASCII_T),
  19146. 4: int8(m_ASCII_A),
  19147. 5: int8(m_ASCII_LSQB1),
  19148. }
  19149. func _little2_cdataSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19150. var n Tsize_t
  19151. var v1, v2, v3 int32
  19152. _, _, _, _ = n, v1, v2, v3
  19153. if ptr >= end {
  19154. return -int32(4)
  19155. }
  19156. if int32(2) > int32(1) {
  19157. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  19158. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  19159. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  19160. if n == uint64(0) {
  19161. return -int32(1)
  19162. }
  19163. end = ptr + uintptr(n)
  19164. }
  19165. }
  19166. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19167. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19168. } else {
  19169. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19170. }
  19171. switch v1 {
  19172. case int32(_BT_RSQB):
  19173. ptr += uintptr(2)
  19174. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19175. return -int32(1)
  19176. }
  19177. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1)) {
  19178. break
  19179. }
  19180. ptr += uintptr(2)
  19181. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19182. return -int32(1)
  19183. }
  19184. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  19185. ptr -= uintptr(2)
  19186. break
  19187. }
  19188. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19189. return int32(m_XML_TOK_CDATA_SECT_CLOSE)
  19190. case int32(_BT_CR):
  19191. ptr += uintptr(2)
  19192. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19193. return -int32(1)
  19194. }
  19195. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19196. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19197. } else {
  19198. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19199. }
  19200. if v2 == int32(_BT_LF) {
  19201. ptr += uintptr(2)
  19202. }
  19203. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19204. return int32(m_XML_TOK_DATA_NEWLINE)
  19205. case int32(_BT_LF):
  19206. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19207. return int32(m_XML_TOK_DATA_NEWLINE)
  19208. case int32(_BT_LEAD2):
  19209. if int64(end)-int64(ptr) < int64(2) {
  19210. return -int32(2)
  19211. }
  19212. if 0 != 0 {
  19213. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19214. return m_XML_TOK_INVALID
  19215. }
  19216. ptr += uintptr(2)
  19217. case int32(_BT_LEAD3):
  19218. if int64(end)-int64(ptr) < int64(3) {
  19219. return -int32(2)
  19220. }
  19221. if 0 != 0 {
  19222. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19223. return m_XML_TOK_INVALID
  19224. }
  19225. ptr += uintptr(3)
  19226. case int32(_BT_LEAD4):
  19227. if int64(end)-int64(ptr) < int64(4) {
  19228. return -int32(2)
  19229. }
  19230. if 0 != 0 {
  19231. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19232. return m_XML_TOK_INVALID
  19233. }
  19234. ptr += uintptr(4)
  19235. case int32(_BT_NONXML):
  19236. fallthrough
  19237. case int32(_BT_MALFORM):
  19238. fallthrough
  19239. case int32(_BT_TRAIL):
  19240. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19241. return m_XML_TOK_INVALID
  19242. default:
  19243. ptr += uintptr(2)
  19244. break
  19245. }
  19246. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19247. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19248. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19249. } else {
  19250. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19251. }
  19252. switch v3 {
  19253. case int32(_BT_LEAD2):
  19254. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  19255. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19256. return int32(m_XML_TOK_DATA_CHARS)
  19257. }
  19258. ptr += uintptr(2)
  19259. case int32(_BT_LEAD3):
  19260. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  19261. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19262. return int32(m_XML_TOK_DATA_CHARS)
  19263. }
  19264. ptr += uintptr(3)
  19265. case int32(_BT_LEAD4):
  19266. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  19267. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19268. return int32(m_XML_TOK_DATA_CHARS)
  19269. }
  19270. ptr += uintptr(4)
  19271. case int32(_BT_NONXML):
  19272. fallthrough
  19273. case int32(_BT_MALFORM):
  19274. fallthrough
  19275. case int32(_BT_TRAIL):
  19276. fallthrough
  19277. case int32(_BT_CR):
  19278. fallthrough
  19279. case int32(_BT_LF):
  19280. fallthrough
  19281. case int32(_BT_RSQB):
  19282. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19283. return int32(m_XML_TOK_DATA_CHARS)
  19284. default:
  19285. ptr += uintptr(2)
  19286. break
  19287. }
  19288. }
  19289. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19290. return int32(m_XML_TOK_DATA_CHARS)
  19291. }
  19292. /* ptr points to character following "</" */
  19293. func _little2_scanEndTag(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19294. var v1, v2, v22 int32
  19295. _, _, _ = v1, v2, v22
  19296. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19297. return -int32(1)
  19298. }
  19299. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19300. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19301. } else {
  19302. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19303. }
  19304. switch v1 {
  19305. case int32(_BT_NONASCII):
  19306. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  19307. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19308. return m_XML_TOK_INVALID
  19309. } /* fall through */
  19310. fallthrough
  19311. case int32(_BT_NMSTRT):
  19312. fallthrough
  19313. case int32(_BT_HEX):
  19314. ptr += uintptr(2)
  19315. case int32(_BT_LEAD2):
  19316. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  19317. return -int32(2)
  19318. }
  19319. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19320. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19321. return m_XML_TOK_INVALID
  19322. }
  19323. ptr += uintptr(2)
  19324. case int32(_BT_LEAD3):
  19325. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  19326. return -int32(2)
  19327. }
  19328. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19329. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19330. return m_XML_TOK_INVALID
  19331. }
  19332. ptr += uintptr(3)
  19333. case int32(_BT_LEAD4):
  19334. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  19335. return -int32(2)
  19336. }
  19337. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19338. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19339. return m_XML_TOK_INVALID
  19340. }
  19341. ptr += uintptr(4)
  19342. default:
  19343. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19344. return m_XML_TOK_INVALID
  19345. }
  19346. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19347. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19348. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19349. } else {
  19350. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19351. }
  19352. switch v2 {
  19353. case int32(_BT_NONASCII):
  19354. goto _3
  19355. case int32(_BT_MINUS):
  19356. goto _4
  19357. case int32(_BT_NAME):
  19358. goto _5
  19359. case int32(_BT_DIGIT):
  19360. goto _6
  19361. case int32(_BT_HEX):
  19362. goto _7
  19363. case int32(_BT_NMSTRT):
  19364. goto _8
  19365. case int32(_BT_LEAD2):
  19366. goto _9
  19367. case int32(_BT_LEAD3):
  19368. goto _10
  19369. case int32(_BT_LEAD4):
  19370. goto _11
  19371. case int32(_BT_LF):
  19372. goto _12
  19373. case int32(_BT_CR):
  19374. goto _13
  19375. case int32(_BT_S):
  19376. goto _14
  19377. case int32(_BT_COLON):
  19378. goto _15
  19379. case int32(_BT_GT):
  19380. goto _16
  19381. default:
  19382. goto _17
  19383. }
  19384. goto _18
  19385. _3:
  19386. ;
  19387. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  19388. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19389. return m_XML_TOK_INVALID
  19390. } /* fall through */
  19391. _8:
  19392. ;
  19393. _7:
  19394. ;
  19395. _6:
  19396. ;
  19397. _5:
  19398. ;
  19399. _4:
  19400. ;
  19401. ptr += uintptr(2)
  19402. goto _18
  19403. _9:
  19404. ;
  19405. if int64(end)-int64(ptr) < int64(2) {
  19406. return -int32(2)
  19407. }
  19408. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19409. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19410. return m_XML_TOK_INVALID
  19411. }
  19412. ptr += uintptr(2)
  19413. goto _18
  19414. _10:
  19415. ;
  19416. if int64(end)-int64(ptr) < int64(3) {
  19417. return -int32(2)
  19418. }
  19419. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19420. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19421. return m_XML_TOK_INVALID
  19422. }
  19423. ptr += uintptr(3)
  19424. goto _18
  19425. _11:
  19426. ;
  19427. if int64(end)-int64(ptr) < int64(4) {
  19428. return -int32(2)
  19429. }
  19430. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19431. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19432. return m_XML_TOK_INVALID
  19433. }
  19434. ptr += uintptr(4)
  19435. goto _18
  19436. _14:
  19437. ;
  19438. _13:
  19439. ;
  19440. _12:
  19441. ;
  19442. ptr += uintptr(2)
  19443. _21:
  19444. ;
  19445. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19446. goto _19
  19447. }
  19448. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19449. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19450. } else {
  19451. v22 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19452. }
  19453. switch v22 {
  19454. case int32(_BT_S):
  19455. fallthrough
  19456. case int32(_BT_CR):
  19457. fallthrough
  19458. case int32(_BT_LF):
  19459. case int32(_BT_GT):
  19460. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19461. return int32(m_XML_TOK_END_TAG)
  19462. default:
  19463. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19464. return m_XML_TOK_INVALID
  19465. }
  19466. goto _20
  19467. _20:
  19468. ;
  19469. ptr += uintptr(2)
  19470. goto _21
  19471. goto _19
  19472. _19:
  19473. ;
  19474. return -int32(1)
  19475. _15:
  19476. ;
  19477. /* no need to check qname syntax here,
  19478. since end-tag must match exactly */
  19479. ptr += uintptr(2)
  19480. goto _18
  19481. _16:
  19482. ;
  19483. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19484. return int32(m_XML_TOK_END_TAG)
  19485. _17:
  19486. ;
  19487. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19488. return m_XML_TOK_INVALID
  19489. _18:
  19490. }
  19491. return -int32(1)
  19492. }
  19493. /* ptr points to character following "&#X" */
  19494. func _little2_scanHexCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19495. var v1, v3 int32
  19496. _, _ = v1, v3
  19497. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19498. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19499. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19500. } else {
  19501. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19502. }
  19503. switch v1 {
  19504. case int32(_BT_DIGIT):
  19505. fallthrough
  19506. case int32(_BT_HEX):
  19507. default:
  19508. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19509. return m_XML_TOK_INVALID
  19510. }
  19511. ptr += uintptr(2)
  19512. for {
  19513. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19514. break
  19515. }
  19516. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19517. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19518. } else {
  19519. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19520. }
  19521. switch v3 {
  19522. case int32(_BT_DIGIT):
  19523. fallthrough
  19524. case int32(_BT_HEX):
  19525. case int32(_BT_SEMI):
  19526. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19527. return int32(m_XML_TOK_CHAR_REF)
  19528. default:
  19529. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19530. return m_XML_TOK_INVALID
  19531. }
  19532. goto _2
  19533. _2:
  19534. ;
  19535. ptr += uintptr(2)
  19536. }
  19537. }
  19538. return -int32(1)
  19539. }
  19540. /* ptr points to character following "&#" */
  19541. func _little2_scanCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19542. var v1, v3 int32
  19543. _, _ = v1, v3
  19544. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19545. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  19546. return _little2_scanHexCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  19547. }
  19548. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19549. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19550. } else {
  19551. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19552. }
  19553. switch v1 {
  19554. case int32(_BT_DIGIT):
  19555. default:
  19556. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19557. return m_XML_TOK_INVALID
  19558. }
  19559. ptr += uintptr(2)
  19560. for {
  19561. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19562. break
  19563. }
  19564. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19565. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19566. } else {
  19567. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19568. }
  19569. switch v3 {
  19570. case int32(_BT_DIGIT):
  19571. case int32(_BT_SEMI):
  19572. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19573. return int32(m_XML_TOK_CHAR_REF)
  19574. default:
  19575. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19576. return m_XML_TOK_INVALID
  19577. }
  19578. goto _2
  19579. _2:
  19580. ;
  19581. ptr += uintptr(2)
  19582. }
  19583. }
  19584. return -int32(1)
  19585. }
  19586. /* ptr points to character following "&" */
  19587. func _little2_scanRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19588. var v1, v2 int32
  19589. _, _ = v1, v2
  19590. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19591. return -int32(1)
  19592. }
  19593. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19594. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19595. } else {
  19596. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19597. }
  19598. switch v1 {
  19599. case int32(_BT_NONASCII):
  19600. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  19601. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19602. return m_XML_TOK_INVALID
  19603. } /* fall through */
  19604. fallthrough
  19605. case int32(_BT_NMSTRT):
  19606. fallthrough
  19607. case int32(_BT_HEX):
  19608. ptr += uintptr(2)
  19609. case int32(_BT_LEAD2):
  19610. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  19611. return -int32(2)
  19612. }
  19613. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19614. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19615. return m_XML_TOK_INVALID
  19616. }
  19617. ptr += uintptr(2)
  19618. case int32(_BT_LEAD3):
  19619. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  19620. return -int32(2)
  19621. }
  19622. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19623. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19624. return m_XML_TOK_INVALID
  19625. }
  19626. ptr += uintptr(3)
  19627. case int32(_BT_LEAD4):
  19628. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  19629. return -int32(2)
  19630. }
  19631. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19632. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19633. return m_XML_TOK_INVALID
  19634. }
  19635. ptr += uintptr(4)
  19636. case int32(_BT_NUM):
  19637. return _little2_scanCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  19638. default:
  19639. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19640. return m_XML_TOK_INVALID
  19641. }
  19642. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19643. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19644. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19645. } else {
  19646. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19647. }
  19648. switch v2 {
  19649. case int32(_BT_NONASCII):
  19650. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  19651. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19652. return m_XML_TOK_INVALID
  19653. } /* fall through */
  19654. fallthrough
  19655. case int32(_BT_NMSTRT):
  19656. fallthrough
  19657. case int32(_BT_HEX):
  19658. fallthrough
  19659. case int32(_BT_DIGIT):
  19660. fallthrough
  19661. case int32(_BT_NAME):
  19662. fallthrough
  19663. case int32(_BT_MINUS):
  19664. ptr += uintptr(2)
  19665. case int32(_BT_LEAD2):
  19666. if int64(end)-int64(ptr) < int64(2) {
  19667. return -int32(2)
  19668. }
  19669. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19670. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19671. return m_XML_TOK_INVALID
  19672. }
  19673. ptr += uintptr(2)
  19674. case int32(_BT_LEAD3):
  19675. if int64(end)-int64(ptr) < int64(3) {
  19676. return -int32(2)
  19677. }
  19678. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19679. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19680. return m_XML_TOK_INVALID
  19681. }
  19682. ptr += uintptr(3)
  19683. case int32(_BT_LEAD4):
  19684. if int64(end)-int64(ptr) < int64(4) {
  19685. return -int32(2)
  19686. }
  19687. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19688. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19689. return m_XML_TOK_INVALID
  19690. }
  19691. ptr += uintptr(4)
  19692. case int32(_BT_SEMI):
  19693. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19694. return int32(m_XML_TOK_ENTITY_REF)
  19695. default:
  19696. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19697. return m_XML_TOK_INVALID
  19698. }
  19699. }
  19700. return -int32(1)
  19701. }
  19702. /* ptr points to character following first character of attribute name */
  19703. func _little2_scanAtts(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19704. bp := tls.Alloc(16)
  19705. defer tls.Free(16)
  19706. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  19707. var hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31 int32
  19708. _, _, _, _, _, _, _, _, _, _, _, _ = hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31
  19709. hadColon = 0
  19710. for int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19711. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  19712. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  19713. } else {
  19714. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  19715. }
  19716. switch v1 {
  19717. case int32(_BT_NONASCII):
  19718. goto _2
  19719. case int32(_BT_MINUS):
  19720. goto _3
  19721. case int32(_BT_NAME):
  19722. goto _4
  19723. case int32(_BT_DIGIT):
  19724. goto _5
  19725. case int32(_BT_HEX):
  19726. goto _6
  19727. case int32(_BT_NMSTRT):
  19728. goto _7
  19729. case int32(_BT_LEAD2):
  19730. goto _8
  19731. case int32(_BT_LEAD3):
  19732. goto _9
  19733. case int32(_BT_LEAD4):
  19734. goto _10
  19735. case int32(_BT_COLON):
  19736. goto _11
  19737. case int32(_BT_LF):
  19738. goto _12
  19739. case int32(_BT_CR):
  19740. goto _13
  19741. case int32(_BT_S):
  19742. goto _14
  19743. case int32(_BT_EQUALS):
  19744. goto _15
  19745. default:
  19746. goto _16
  19747. }
  19748. goto _17
  19749. _2:
  19750. ;
  19751. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))&libc.Int32FromInt32(0x1F))) != 0) {
  19752. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19753. return m_XML_TOK_INVALID
  19754. } /* fall through */
  19755. _7:
  19756. ;
  19757. _6:
  19758. ;
  19759. _5:
  19760. ;
  19761. _4:
  19762. ;
  19763. _3:
  19764. ;
  19765. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19766. goto _17
  19767. _8:
  19768. ;
  19769. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  19770. return -int32(2)
  19771. }
  19772. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19773. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19774. return m_XML_TOK_INVALID
  19775. }
  19776. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19777. goto _17
  19778. _9:
  19779. ;
  19780. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  19781. return -int32(2)
  19782. }
  19783. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19784. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19785. return m_XML_TOK_INVALID
  19786. }
  19787. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  19788. goto _17
  19789. _10:
  19790. ;
  19791. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  19792. return -int32(2)
  19793. }
  19794. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19795. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19796. return m_XML_TOK_INVALID
  19797. }
  19798. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  19799. goto _17
  19800. _11:
  19801. ;
  19802. if hadColon != 0 {
  19803. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19804. return m_XML_TOK_INVALID
  19805. }
  19806. hadColon = int32(1)
  19807. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19808. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19809. return -int32(1)
  19810. }
  19811. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  19812. v18 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  19813. } else {
  19814. v18 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  19815. }
  19816. switch v18 {
  19817. case int32(_BT_NONASCII):
  19818. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))&libc.Int32FromInt32(0x1F))) != 0) {
  19819. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19820. return m_XML_TOK_INVALID
  19821. } /* fall through */
  19822. fallthrough
  19823. case int32(_BT_NMSTRT):
  19824. fallthrough
  19825. case int32(_BT_HEX):
  19826. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19827. case int32(_BT_LEAD2):
  19828. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  19829. return -int32(2)
  19830. }
  19831. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19832. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19833. return m_XML_TOK_INVALID
  19834. }
  19835. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19836. case int32(_BT_LEAD3):
  19837. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  19838. return -int32(2)
  19839. }
  19840. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19841. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19842. return m_XML_TOK_INVALID
  19843. }
  19844. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  19845. case int32(_BT_LEAD4):
  19846. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  19847. return -int32(2)
  19848. }
  19849. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19850. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19851. return m_XML_TOK_INVALID
  19852. }
  19853. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  19854. default:
  19855. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19856. return m_XML_TOK_INVALID
  19857. }
  19858. goto _17
  19859. _14:
  19860. ;
  19861. _13:
  19862. ;
  19863. _12:
  19864. ;
  19865. _21:
  19866. ;
  19867. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19868. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19869. return -int32(1)
  19870. }
  19871. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  19872. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  19873. } else {
  19874. v22 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  19875. }
  19876. t = v22
  19877. if t == int32(_BT_EQUALS) {
  19878. goto _19
  19879. }
  19880. switch t {
  19881. case int32(_BT_S):
  19882. fallthrough
  19883. case int32(_BT_LF):
  19884. fallthrough
  19885. case int32(_BT_CR):
  19886. default:
  19887. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19888. return m_XML_TOK_INVALID
  19889. }
  19890. goto _20
  19891. _20:
  19892. ;
  19893. goto _21
  19894. goto _19
  19895. _19:
  19896. ;
  19897. /* fall through */
  19898. _15:
  19899. ;
  19900. hadColon = 0
  19901. for {
  19902. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19903. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19904. return -int32(1)
  19905. }
  19906. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  19907. v24 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  19908. } else {
  19909. v24 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  19910. }
  19911. open = v24
  19912. if open == int32(_BT_QUOT) || open == int32(_BT_APOS) {
  19913. break
  19914. }
  19915. switch open {
  19916. case int32(_BT_S):
  19917. fallthrough
  19918. case int32(_BT_LF):
  19919. fallthrough
  19920. case int32(_BT_CR):
  19921. default:
  19922. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19923. return m_XML_TOK_INVALID
  19924. }
  19925. goto _23
  19926. _23:
  19927. }
  19928. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19929. /* in attribute value */
  19930. for {
  19931. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19932. return -int32(1)
  19933. }
  19934. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  19935. v26 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  19936. } else {
  19937. v26 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  19938. }
  19939. t1 = v26
  19940. if t1 == open {
  19941. break
  19942. }
  19943. switch t1 {
  19944. case int32(_BT_LEAD2):
  19945. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  19946. return -int32(2)
  19947. }
  19948. if 0 != 0 {
  19949. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19950. return m_XML_TOK_INVALID
  19951. }
  19952. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19953. case int32(_BT_LEAD3):
  19954. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  19955. return -int32(2)
  19956. }
  19957. if 0 != 0 {
  19958. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19959. return m_XML_TOK_INVALID
  19960. }
  19961. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  19962. case int32(_BT_LEAD4):
  19963. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  19964. return -int32(2)
  19965. }
  19966. if 0 != 0 {
  19967. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19968. return m_XML_TOK_INVALID
  19969. }
  19970. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  19971. case int32(_BT_NONXML):
  19972. fallthrough
  19973. case int32(_BT_MALFORM):
  19974. fallthrough
  19975. case int32(_BT_TRAIL):
  19976. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19977. return m_XML_TOK_INVALID
  19978. case int32(_BT_AMP):
  19979. tok = _little2_scanRef(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr(2), end, bp)
  19980. if tok <= 0 {
  19981. if tok == m_XML_TOK_INVALID {
  19982. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19983. }
  19984. return tok
  19985. }
  19986. case int32(_BT_LT):
  19987. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19988. return m_XML_TOK_INVALID
  19989. default:
  19990. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19991. break
  19992. }
  19993. goto _25
  19994. _25:
  19995. }
  19996. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19997. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19998. return -int32(1)
  19999. }
  20000. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  20001. v27 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  20002. } else {
  20003. v27 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  20004. }
  20005. switch v27 {
  20006. case int32(_BT_S):
  20007. fallthrough
  20008. case int32(_BT_CR):
  20009. fallthrough
  20010. case int32(_BT_LF):
  20011. case int32(_BT_SOL):
  20012. goto sol
  20013. case int32(_BT_GT):
  20014. goto gt
  20015. default:
  20016. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20017. return m_XML_TOK_INVALID
  20018. }
  20019. /* ptr points to closing quote */
  20020. _30:
  20021. ;
  20022. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20023. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20024. return -int32(1)
  20025. }
  20026. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  20027. v31 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  20028. } else {
  20029. v31 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  20030. }
  20031. switch v31 {
  20032. case int32(_BT_NONASCII):
  20033. goto _32
  20034. case int32(_BT_HEX):
  20035. goto _33
  20036. case int32(_BT_NMSTRT):
  20037. goto _34
  20038. case int32(_BT_LEAD2):
  20039. goto _35
  20040. case int32(_BT_LEAD3):
  20041. goto _36
  20042. case int32(_BT_LEAD4):
  20043. goto _37
  20044. case int32(_BT_LF):
  20045. goto _38
  20046. case int32(_BT_CR):
  20047. goto _39
  20048. case int32(_BT_S):
  20049. goto _40
  20050. case int32(_BT_GT):
  20051. goto _41
  20052. case int32(_BT_SOL):
  20053. goto _42
  20054. default:
  20055. goto _43
  20056. }
  20057. goto _44
  20058. _32:
  20059. ;
  20060. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))&libc.Int32FromInt32(0x1F))) != 0) {
  20061. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20062. return m_XML_TOK_INVALID
  20063. } /* fall through */
  20064. _34:
  20065. ;
  20066. _33:
  20067. ;
  20068. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20069. goto _44
  20070. _35:
  20071. ;
  20072. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  20073. return -int32(2)
  20074. }
  20075. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20076. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20077. return m_XML_TOK_INVALID
  20078. }
  20079. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20080. goto _44
  20081. _36:
  20082. ;
  20083. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  20084. return -int32(2)
  20085. }
  20086. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20087. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20088. return m_XML_TOK_INVALID
  20089. }
  20090. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  20091. goto _44
  20092. _37:
  20093. ;
  20094. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  20095. return -int32(2)
  20096. }
  20097. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20098. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20099. return m_XML_TOK_INVALID
  20100. }
  20101. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  20102. goto _44
  20103. _40:
  20104. ;
  20105. _39:
  20106. ;
  20107. _38:
  20108. ;
  20109. goto _29
  20110. _41:
  20111. ;
  20112. goto gt
  20113. gt:
  20114. ;
  20115. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  20116. return int32(m_XML_TOK_START_TAG_WITH_ATTS)
  20117. _42:
  20118. ;
  20119. goto sol
  20120. sol:
  20121. ;
  20122. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20123. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20124. return -int32(1)
  20125. }
  20126. if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == int32(m_ASCII_GT1)) {
  20127. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20128. return m_XML_TOK_INVALID
  20129. }
  20130. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  20131. return int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS)
  20132. _43:
  20133. ;
  20134. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20135. return m_XML_TOK_INVALID
  20136. _44:
  20137. ;
  20138. goto _28
  20139. goto _29
  20140. _29:
  20141. ;
  20142. goto _30
  20143. goto _28
  20144. _28:
  20145. ;
  20146. goto _17
  20147. _16:
  20148. ;
  20149. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20150. return m_XML_TOK_INVALID
  20151. _17:
  20152. }
  20153. return -int32(1)
  20154. }
  20155. /* ptr points to character following "<" */
  20156. func _little2_scanLt(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20157. var hadColon, v1, v2, v21, v22, v3 int32
  20158. _, _, _, _, _, _ = hadColon, v1, v2, v21, v22, v3
  20159. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20160. return -int32(1)
  20161. }
  20162. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20163. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20164. } else {
  20165. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20166. }
  20167. switch v1 {
  20168. case int32(_BT_NONASCII):
  20169. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  20170. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20171. return m_XML_TOK_INVALID
  20172. } /* fall through */
  20173. fallthrough
  20174. case int32(_BT_NMSTRT):
  20175. fallthrough
  20176. case int32(_BT_HEX):
  20177. ptr += uintptr(2)
  20178. case int32(_BT_LEAD2):
  20179. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  20180. return -int32(2)
  20181. }
  20182. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20183. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20184. return m_XML_TOK_INVALID
  20185. }
  20186. ptr += uintptr(2)
  20187. case int32(_BT_LEAD3):
  20188. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  20189. return -int32(2)
  20190. }
  20191. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20192. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20193. return m_XML_TOK_INVALID
  20194. }
  20195. ptr += uintptr(3)
  20196. case int32(_BT_LEAD4):
  20197. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  20198. return -int32(2)
  20199. }
  20200. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20201. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20202. return m_XML_TOK_INVALID
  20203. }
  20204. ptr += uintptr(4)
  20205. case int32(_BT_EXCL):
  20206. ptr += uintptr(2)
  20207. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20208. return -int32(1)
  20209. }
  20210. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20211. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20212. } else {
  20213. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20214. }
  20215. switch v2 {
  20216. case int32(_BT_MINUS):
  20217. return _little2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20218. case int32(_BT_LSQB):
  20219. return _little2_scanCdataSection(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20220. }
  20221. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20222. return m_XML_TOK_INVALID
  20223. case int32(_BT_QUEST):
  20224. return _little2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20225. case int32(_BT_SOL):
  20226. return _little2_scanEndTag(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20227. default:
  20228. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20229. return m_XML_TOK_INVALID
  20230. }
  20231. hadColon = 0
  20232. /* we have a start-tag */
  20233. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20234. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20235. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20236. } else {
  20237. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20238. }
  20239. switch v3 {
  20240. case int32(_BT_NONASCII):
  20241. goto _4
  20242. case int32(_BT_MINUS):
  20243. goto _5
  20244. case int32(_BT_NAME):
  20245. goto _6
  20246. case int32(_BT_DIGIT):
  20247. goto _7
  20248. case int32(_BT_HEX):
  20249. goto _8
  20250. case int32(_BT_NMSTRT):
  20251. goto _9
  20252. case int32(_BT_LEAD2):
  20253. goto _10
  20254. case int32(_BT_LEAD3):
  20255. goto _11
  20256. case int32(_BT_LEAD4):
  20257. goto _12
  20258. case int32(_BT_COLON):
  20259. goto _13
  20260. case int32(_BT_LF):
  20261. goto _14
  20262. case int32(_BT_CR):
  20263. goto _15
  20264. case int32(_BT_S):
  20265. goto _16
  20266. case int32(_BT_GT):
  20267. goto _17
  20268. case int32(_BT_SOL):
  20269. goto _18
  20270. default:
  20271. goto _19
  20272. }
  20273. goto _20
  20274. _4:
  20275. ;
  20276. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  20277. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20278. return m_XML_TOK_INVALID
  20279. } /* fall through */
  20280. _9:
  20281. ;
  20282. _8:
  20283. ;
  20284. _7:
  20285. ;
  20286. _6:
  20287. ;
  20288. _5:
  20289. ;
  20290. ptr += uintptr(2)
  20291. goto _20
  20292. _10:
  20293. ;
  20294. if int64(end)-int64(ptr) < int64(2) {
  20295. return -int32(2)
  20296. }
  20297. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20298. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20299. return m_XML_TOK_INVALID
  20300. }
  20301. ptr += uintptr(2)
  20302. goto _20
  20303. _11:
  20304. ;
  20305. if int64(end)-int64(ptr) < int64(3) {
  20306. return -int32(2)
  20307. }
  20308. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20309. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20310. return m_XML_TOK_INVALID
  20311. }
  20312. ptr += uintptr(3)
  20313. goto _20
  20314. _12:
  20315. ;
  20316. if int64(end)-int64(ptr) < int64(4) {
  20317. return -int32(2)
  20318. }
  20319. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20320. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20321. return m_XML_TOK_INVALID
  20322. }
  20323. ptr += uintptr(4)
  20324. goto _20
  20325. _13:
  20326. ;
  20327. if hadColon != 0 {
  20328. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20329. return m_XML_TOK_INVALID
  20330. }
  20331. hadColon = int32(1)
  20332. ptr += uintptr(2)
  20333. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20334. return -int32(1)
  20335. }
  20336. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20337. v21 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20338. } else {
  20339. v21 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20340. }
  20341. switch v21 {
  20342. case int32(_BT_NONASCII):
  20343. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  20344. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20345. return m_XML_TOK_INVALID
  20346. } /* fall through */
  20347. fallthrough
  20348. case int32(_BT_NMSTRT):
  20349. fallthrough
  20350. case int32(_BT_HEX):
  20351. ptr += uintptr(2)
  20352. case int32(_BT_LEAD2):
  20353. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  20354. return -int32(2)
  20355. }
  20356. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20357. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20358. return m_XML_TOK_INVALID
  20359. }
  20360. ptr += uintptr(2)
  20361. case int32(_BT_LEAD3):
  20362. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  20363. return -int32(2)
  20364. }
  20365. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20366. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20367. return m_XML_TOK_INVALID
  20368. }
  20369. ptr += uintptr(3)
  20370. case int32(_BT_LEAD4):
  20371. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  20372. return -int32(2)
  20373. }
  20374. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20375. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20376. return m_XML_TOK_INVALID
  20377. }
  20378. ptr += uintptr(4)
  20379. default:
  20380. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20381. return m_XML_TOK_INVALID
  20382. }
  20383. goto _20
  20384. _16:
  20385. ;
  20386. _15:
  20387. ;
  20388. _14:
  20389. ;
  20390. ptr += uintptr(2)
  20391. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20392. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20393. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20394. } else {
  20395. v22 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20396. }
  20397. switch v22 {
  20398. case int32(_BT_NONASCII):
  20399. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  20400. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20401. return m_XML_TOK_INVALID
  20402. } /* fall through */
  20403. fallthrough
  20404. case int32(_BT_NMSTRT):
  20405. fallthrough
  20406. case int32(_BT_HEX):
  20407. ptr += uintptr(2)
  20408. case int32(_BT_LEAD2):
  20409. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  20410. return -int32(2)
  20411. }
  20412. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20413. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20414. return m_XML_TOK_INVALID
  20415. }
  20416. ptr += uintptr(2)
  20417. case int32(_BT_LEAD3):
  20418. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  20419. return -int32(2)
  20420. }
  20421. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20422. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20423. return m_XML_TOK_INVALID
  20424. }
  20425. ptr += uintptr(3)
  20426. case int32(_BT_LEAD4):
  20427. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  20428. return -int32(2)
  20429. }
  20430. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20431. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20432. return m_XML_TOK_INVALID
  20433. }
  20434. ptr += uintptr(4)
  20435. case int32(_BT_GT):
  20436. goto gt
  20437. case int32(_BT_SOL):
  20438. goto sol
  20439. case int32(_BT_S):
  20440. fallthrough
  20441. case int32(_BT_CR):
  20442. fallthrough
  20443. case int32(_BT_LF):
  20444. ptr += uintptr(2)
  20445. continue
  20446. default:
  20447. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20448. return m_XML_TOK_INVALID
  20449. }
  20450. return _little2_scanAtts(tls, enc, ptr, end, nextTokPtr)
  20451. }
  20452. return -int32(1)
  20453. _17:
  20454. ;
  20455. goto gt
  20456. gt:
  20457. ;
  20458. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20459. return int32(m_XML_TOK_START_TAG_NO_ATTS)
  20460. _18:
  20461. ;
  20462. goto sol
  20463. sol:
  20464. ;
  20465. ptr += uintptr(2)
  20466. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20467. return -int32(1)
  20468. }
  20469. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  20470. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20471. return m_XML_TOK_INVALID
  20472. }
  20473. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20474. return int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS)
  20475. _19:
  20476. ;
  20477. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20478. return m_XML_TOK_INVALID
  20479. _20:
  20480. }
  20481. return -int32(1)
  20482. }
  20483. func _little2_contentTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20484. var n Tsize_t
  20485. var v1, v2, v3 int32
  20486. _, _, _, _ = n, v1, v2, v3
  20487. if ptr >= end {
  20488. return -int32(4)
  20489. }
  20490. if int32(2) > int32(1) {
  20491. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  20492. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  20493. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  20494. if n == uint64(0) {
  20495. return -int32(1)
  20496. }
  20497. end = ptr + uintptr(n)
  20498. }
  20499. }
  20500. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20501. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20502. } else {
  20503. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20504. }
  20505. switch v1 {
  20506. case int32(_BT_LT):
  20507. return _little2_scanLt(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20508. case int32(_BT_AMP):
  20509. return _little2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20510. case int32(_BT_CR):
  20511. ptr += uintptr(2)
  20512. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20513. return -int32(3)
  20514. }
  20515. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20516. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20517. } else {
  20518. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20519. }
  20520. if v2 == int32(_BT_LF) {
  20521. ptr += uintptr(2)
  20522. }
  20523. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20524. return int32(m_XML_TOK_DATA_NEWLINE)
  20525. case int32(_BT_LF):
  20526. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20527. return int32(m_XML_TOK_DATA_NEWLINE)
  20528. case int32(_BT_RSQB):
  20529. ptr += uintptr(2)
  20530. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20531. return -int32(5)
  20532. }
  20533. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1)) {
  20534. break
  20535. }
  20536. ptr += uintptr(2)
  20537. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20538. return -int32(5)
  20539. }
  20540. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  20541. ptr -= uintptr(2)
  20542. break
  20543. }
  20544. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20545. return m_XML_TOK_INVALID
  20546. case int32(_BT_LEAD2):
  20547. if int64(end)-int64(ptr) < int64(2) {
  20548. return -int32(2)
  20549. }
  20550. if 0 != 0 {
  20551. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20552. return m_XML_TOK_INVALID
  20553. }
  20554. ptr += uintptr(2)
  20555. case int32(_BT_LEAD3):
  20556. if int64(end)-int64(ptr) < int64(3) {
  20557. return -int32(2)
  20558. }
  20559. if 0 != 0 {
  20560. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20561. return m_XML_TOK_INVALID
  20562. }
  20563. ptr += uintptr(3)
  20564. case int32(_BT_LEAD4):
  20565. if int64(end)-int64(ptr) < int64(4) {
  20566. return -int32(2)
  20567. }
  20568. if 0 != 0 {
  20569. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20570. return m_XML_TOK_INVALID
  20571. }
  20572. ptr += uintptr(4)
  20573. case int32(_BT_NONXML):
  20574. fallthrough
  20575. case int32(_BT_MALFORM):
  20576. fallthrough
  20577. case int32(_BT_TRAIL):
  20578. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20579. return m_XML_TOK_INVALID
  20580. default:
  20581. ptr += uintptr(2)
  20582. break
  20583. }
  20584. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20585. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20586. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20587. } else {
  20588. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20589. }
  20590. switch v3 {
  20591. case int32(_BT_LEAD2):
  20592. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  20593. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20594. return int32(m_XML_TOK_DATA_CHARS)
  20595. }
  20596. ptr += uintptr(2)
  20597. case int32(_BT_LEAD3):
  20598. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  20599. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20600. return int32(m_XML_TOK_DATA_CHARS)
  20601. }
  20602. ptr += uintptr(3)
  20603. case int32(_BT_LEAD4):
  20604. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  20605. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20606. return int32(m_XML_TOK_DATA_CHARS)
  20607. }
  20608. ptr += uintptr(4)
  20609. case int32(_BT_RSQB):
  20610. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) {
  20611. if !(int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == int32(m_ASCII_RSQB1)) {
  20612. ptr += uintptr(2)
  20613. break
  20614. }
  20615. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(3)*libc.Int32FromInt32(2)) {
  20616. if !(int32(*(*int8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))))) == int32(m_ASCII_GT1)) {
  20617. ptr += uintptr(2)
  20618. break
  20619. }
  20620. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  20621. return m_XML_TOK_INVALID
  20622. }
  20623. }
  20624. /* fall through */
  20625. fallthrough
  20626. case int32(_BT_AMP):
  20627. fallthrough
  20628. case int32(_BT_LT):
  20629. fallthrough
  20630. case int32(_BT_NONXML):
  20631. fallthrough
  20632. case int32(_BT_MALFORM):
  20633. fallthrough
  20634. case int32(_BT_TRAIL):
  20635. fallthrough
  20636. case int32(_BT_CR):
  20637. fallthrough
  20638. case int32(_BT_LF):
  20639. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20640. return int32(m_XML_TOK_DATA_CHARS)
  20641. default:
  20642. ptr += uintptr(2)
  20643. break
  20644. }
  20645. }
  20646. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20647. return int32(m_XML_TOK_DATA_CHARS)
  20648. }
  20649. /* ptr points to character following "%" */
  20650. func _little2_scanPercent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20651. var v1, v2 int32
  20652. _, _ = v1, v2
  20653. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20654. return -int32(1)
  20655. }
  20656. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20657. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20658. } else {
  20659. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20660. }
  20661. switch v1 {
  20662. case int32(_BT_NONASCII):
  20663. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  20664. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20665. return m_XML_TOK_INVALID
  20666. } /* fall through */
  20667. fallthrough
  20668. case int32(_BT_NMSTRT):
  20669. fallthrough
  20670. case int32(_BT_HEX):
  20671. ptr += uintptr(2)
  20672. case int32(_BT_LEAD2):
  20673. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  20674. return -int32(2)
  20675. }
  20676. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20677. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20678. return m_XML_TOK_INVALID
  20679. }
  20680. ptr += uintptr(2)
  20681. case int32(_BT_LEAD3):
  20682. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  20683. return -int32(2)
  20684. }
  20685. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20686. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20687. return m_XML_TOK_INVALID
  20688. }
  20689. ptr += uintptr(3)
  20690. case int32(_BT_LEAD4):
  20691. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  20692. return -int32(2)
  20693. }
  20694. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20695. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20696. return m_XML_TOK_INVALID
  20697. }
  20698. ptr += uintptr(4)
  20699. case int32(_BT_S):
  20700. fallthrough
  20701. case int32(_BT_LF):
  20702. fallthrough
  20703. case int32(_BT_CR):
  20704. fallthrough
  20705. case int32(_BT_PERCNT):
  20706. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20707. return int32(m_XML_TOK_PERCENT)
  20708. default:
  20709. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20710. return m_XML_TOK_INVALID
  20711. }
  20712. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20713. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20714. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20715. } else {
  20716. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20717. }
  20718. switch v2 {
  20719. case int32(_BT_NONASCII):
  20720. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  20721. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20722. return m_XML_TOK_INVALID
  20723. } /* fall through */
  20724. fallthrough
  20725. case int32(_BT_NMSTRT):
  20726. fallthrough
  20727. case int32(_BT_HEX):
  20728. fallthrough
  20729. case int32(_BT_DIGIT):
  20730. fallthrough
  20731. case int32(_BT_NAME):
  20732. fallthrough
  20733. case int32(_BT_MINUS):
  20734. ptr += uintptr(2)
  20735. case int32(_BT_LEAD2):
  20736. if int64(end)-int64(ptr) < int64(2) {
  20737. return -int32(2)
  20738. }
  20739. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20740. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20741. return m_XML_TOK_INVALID
  20742. }
  20743. ptr += uintptr(2)
  20744. case int32(_BT_LEAD3):
  20745. if int64(end)-int64(ptr) < int64(3) {
  20746. return -int32(2)
  20747. }
  20748. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20749. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20750. return m_XML_TOK_INVALID
  20751. }
  20752. ptr += uintptr(3)
  20753. case int32(_BT_LEAD4):
  20754. if int64(end)-int64(ptr) < int64(4) {
  20755. return -int32(2)
  20756. }
  20757. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20758. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20759. return m_XML_TOK_INVALID
  20760. }
  20761. ptr += uintptr(4)
  20762. case int32(_BT_SEMI):
  20763. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20764. return int32(m_XML_TOK_PARAM_ENTITY_REF)
  20765. default:
  20766. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20767. return m_XML_TOK_INVALID
  20768. }
  20769. }
  20770. return -int32(1)
  20771. }
  20772. func _little2_scanPoundName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20773. var v1, v2 int32
  20774. _, _ = v1, v2
  20775. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20776. return -int32(1)
  20777. }
  20778. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20779. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20780. } else {
  20781. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20782. }
  20783. switch v1 {
  20784. case int32(_BT_NONASCII):
  20785. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  20786. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20787. return m_XML_TOK_INVALID
  20788. } /* fall through */
  20789. fallthrough
  20790. case int32(_BT_NMSTRT):
  20791. fallthrough
  20792. case int32(_BT_HEX):
  20793. ptr += uintptr(2)
  20794. case int32(_BT_LEAD2):
  20795. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  20796. return -int32(2)
  20797. }
  20798. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20799. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20800. return m_XML_TOK_INVALID
  20801. }
  20802. ptr += uintptr(2)
  20803. case int32(_BT_LEAD3):
  20804. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  20805. return -int32(2)
  20806. }
  20807. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20808. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20809. return m_XML_TOK_INVALID
  20810. }
  20811. ptr += uintptr(3)
  20812. case int32(_BT_LEAD4):
  20813. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  20814. return -int32(2)
  20815. }
  20816. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20817. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20818. return m_XML_TOK_INVALID
  20819. }
  20820. ptr += uintptr(4)
  20821. default:
  20822. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20823. return m_XML_TOK_INVALID
  20824. }
  20825. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20826. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20827. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20828. } else {
  20829. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20830. }
  20831. switch v2 {
  20832. case int32(_BT_NONASCII):
  20833. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  20834. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20835. return m_XML_TOK_INVALID
  20836. } /* fall through */
  20837. fallthrough
  20838. case int32(_BT_NMSTRT):
  20839. fallthrough
  20840. case int32(_BT_HEX):
  20841. fallthrough
  20842. case int32(_BT_DIGIT):
  20843. fallthrough
  20844. case int32(_BT_NAME):
  20845. fallthrough
  20846. case int32(_BT_MINUS):
  20847. ptr += uintptr(2)
  20848. case int32(_BT_LEAD2):
  20849. if int64(end)-int64(ptr) < int64(2) {
  20850. return -int32(2)
  20851. }
  20852. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20853. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20854. return m_XML_TOK_INVALID
  20855. }
  20856. ptr += uintptr(2)
  20857. case int32(_BT_LEAD3):
  20858. if int64(end)-int64(ptr) < int64(3) {
  20859. return -int32(2)
  20860. }
  20861. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20862. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20863. return m_XML_TOK_INVALID
  20864. }
  20865. ptr += uintptr(3)
  20866. case int32(_BT_LEAD4):
  20867. if int64(end)-int64(ptr) < int64(4) {
  20868. return -int32(2)
  20869. }
  20870. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20871. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20872. return m_XML_TOK_INVALID
  20873. }
  20874. ptr += uintptr(4)
  20875. case int32(_BT_CR):
  20876. fallthrough
  20877. case int32(_BT_LF):
  20878. fallthrough
  20879. case int32(_BT_S):
  20880. fallthrough
  20881. case int32(_BT_RPAR):
  20882. fallthrough
  20883. case int32(_BT_GT):
  20884. fallthrough
  20885. case int32(_BT_PERCNT):
  20886. fallthrough
  20887. case int32(_BT_VERBAR):
  20888. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20889. return int32(m_XML_TOK_POUND_NAME)
  20890. default:
  20891. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20892. return m_XML_TOK_INVALID
  20893. }
  20894. }
  20895. return -int32(m_XML_TOK_POUND_NAME)
  20896. }
  20897. func _little2_scanLit(tls *libc.TLS, open int32, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20898. var t, v1, v2 int32
  20899. _, _, _ = t, v1, v2
  20900. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20901. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20902. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20903. } else {
  20904. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20905. }
  20906. t = v1
  20907. switch t {
  20908. case int32(_BT_LEAD2):
  20909. if int64(end)-int64(ptr) < int64(2) {
  20910. return -int32(2)
  20911. }
  20912. if 0 != 0 {
  20913. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20914. return m_XML_TOK_INVALID
  20915. }
  20916. ptr += uintptr(2)
  20917. case int32(_BT_LEAD3):
  20918. if int64(end)-int64(ptr) < int64(3) {
  20919. return -int32(2)
  20920. }
  20921. if 0 != 0 {
  20922. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20923. return m_XML_TOK_INVALID
  20924. }
  20925. ptr += uintptr(3)
  20926. case int32(_BT_LEAD4):
  20927. if int64(end)-int64(ptr) < int64(4) {
  20928. return -int32(2)
  20929. }
  20930. if 0 != 0 {
  20931. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20932. return m_XML_TOK_INVALID
  20933. }
  20934. ptr += uintptr(4)
  20935. case int32(_BT_NONXML):
  20936. fallthrough
  20937. case int32(_BT_MALFORM):
  20938. fallthrough
  20939. case int32(_BT_TRAIL):
  20940. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20941. return m_XML_TOK_INVALID
  20942. case int32(_BT_QUOT):
  20943. fallthrough
  20944. case int32(_BT_APOS):
  20945. ptr += uintptr(2)
  20946. if t != open {
  20947. break
  20948. }
  20949. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20950. return -int32(m_XML_TOK_LITERAL)
  20951. }
  20952. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20953. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20954. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20955. } else {
  20956. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20957. }
  20958. switch v2 {
  20959. case int32(_BT_S):
  20960. fallthrough
  20961. case int32(_BT_CR):
  20962. fallthrough
  20963. case int32(_BT_LF):
  20964. fallthrough
  20965. case int32(_BT_GT):
  20966. fallthrough
  20967. case int32(_BT_PERCNT):
  20968. fallthrough
  20969. case int32(_BT_LSQB):
  20970. return int32(m_XML_TOK_LITERAL)
  20971. default:
  20972. return m_XML_TOK_INVALID
  20973. }
  20974. fallthrough
  20975. default:
  20976. ptr += uintptr(2)
  20977. break
  20978. }
  20979. }
  20980. return -int32(1)
  20981. }
  20982. func _little2_prologTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20983. var n Tsize_t
  20984. var tok, v1, v29, v33, v34, v35, v36 int32
  20985. _, _, _, _, _, _, _, _ = n, tok, v1, v29, v33, v34, v35, v36
  20986. if ptr >= end {
  20987. return -int32(4)
  20988. }
  20989. if int32(2) > int32(1) {
  20990. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  20991. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  20992. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  20993. if n == uint64(0) {
  20994. return -int32(1)
  20995. }
  20996. end = ptr + uintptr(n)
  20997. }
  20998. }
  20999. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21000. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21001. } else {
  21002. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21003. }
  21004. switch v1 {
  21005. case int32(_BT_QUOT):
  21006. goto _2
  21007. case int32(_BT_APOS):
  21008. goto _3
  21009. case int32(_BT_LT):
  21010. goto _4
  21011. case int32(_BT_CR):
  21012. goto _5
  21013. case int32(_BT_LF):
  21014. goto _6
  21015. case int32(_BT_S):
  21016. goto _7
  21017. case int32(_BT_PERCNT):
  21018. goto _8
  21019. case int32(_BT_COMMA):
  21020. goto _9
  21021. case int32(_BT_LSQB):
  21022. goto _10
  21023. case int32(_BT_RSQB):
  21024. goto _11
  21025. case int32(_BT_LPAR):
  21026. goto _12
  21027. case int32(_BT_RPAR):
  21028. goto _13
  21029. case int32(_BT_VERBAR):
  21030. goto _14
  21031. case int32(_BT_GT):
  21032. goto _15
  21033. case int32(_BT_NUM):
  21034. goto _16
  21035. case int32(_BT_LEAD2):
  21036. goto _17
  21037. case int32(_BT_LEAD3):
  21038. goto _18
  21039. case int32(_BT_LEAD4):
  21040. goto _19
  21041. case int32(_BT_HEX):
  21042. goto _20
  21043. case int32(_BT_NMSTRT):
  21044. goto _21
  21045. case int32(_BT_COLON):
  21046. goto _22
  21047. case int32(_BT_MINUS):
  21048. goto _23
  21049. case int32(_BT_NAME):
  21050. goto _24
  21051. case int32(_BT_DIGIT):
  21052. goto _25
  21053. case int32(_BT_NONASCII):
  21054. goto _26
  21055. default:
  21056. goto _27
  21057. }
  21058. goto _28
  21059. _2:
  21060. ;
  21061. return _little2_scanLit(tls, int32(_BT_QUOT), enc, ptr+uintptr(2), end, nextTokPtr)
  21062. _3:
  21063. ;
  21064. return _little2_scanLit(tls, int32(_BT_APOS), enc, ptr+uintptr(2), end, nextTokPtr)
  21065. _4:
  21066. ;
  21067. ptr += uintptr(2)
  21068. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21069. return -int32(1)
  21070. }
  21071. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21072. v29 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21073. } else {
  21074. v29 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21075. }
  21076. switch v29 {
  21077. case int32(_BT_EXCL):
  21078. return _little2_scanDecl(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21079. case int32(_BT_QUEST):
  21080. return _little2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21081. case int32(_BT_NMSTRT):
  21082. fallthrough
  21083. case int32(_BT_HEX):
  21084. fallthrough
  21085. case int32(_BT_NONASCII):
  21086. fallthrough
  21087. case int32(_BT_LEAD2):
  21088. fallthrough
  21089. case int32(_BT_LEAD3):
  21090. fallthrough
  21091. case int32(_BT_LEAD4):
  21092. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr - uintptr(2)
  21093. return int32(m_XML_TOK_INSTANCE_START)
  21094. }
  21095. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21096. return m_XML_TOK_INVALID
  21097. _5:
  21098. ;
  21099. if ptr+uintptr(2) == end {
  21100. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = end
  21101. /* indicate that this might be part of a CR/LF pair */
  21102. return -int32(m_XML_TOK_PROLOG_S)
  21103. }
  21104. /* fall through */
  21105. _7:
  21106. ;
  21107. _6:
  21108. ;
  21109. _32:
  21110. ;
  21111. ptr += uintptr(2)
  21112. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21113. goto _30
  21114. }
  21115. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21116. v33 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21117. } else {
  21118. v33 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21119. }
  21120. switch v33 {
  21121. case int32(_BT_S):
  21122. fallthrough
  21123. case int32(_BT_LF):
  21124. case int32(_BT_CR):
  21125. /* don't split CR/LF pair */
  21126. if ptr+uintptr(2) != end {
  21127. break
  21128. }
  21129. /* fall through */
  21130. fallthrough
  21131. default:
  21132. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21133. return int32(m_XML_TOK_PROLOG_S)
  21134. }
  21135. goto _31
  21136. _31:
  21137. ;
  21138. goto _32
  21139. goto _30
  21140. _30:
  21141. ;
  21142. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21143. return int32(m_XML_TOK_PROLOG_S)
  21144. _8:
  21145. ;
  21146. return _little2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21147. _9:
  21148. ;
  21149. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21150. return int32(m_XML_TOK_COMMA)
  21151. _10:
  21152. ;
  21153. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21154. return int32(m_XML_TOK_OPEN_BRACKET)
  21155. _11:
  21156. ;
  21157. ptr += uintptr(2)
  21158. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21159. return -int32(m_XML_TOK_CLOSE_BRACKET)
  21160. }
  21161. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  21162. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  21163. return -int32(1)
  21164. }
  21165. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == int32(m_ASCII_GT1) {
  21166. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  21167. return int32(m_XML_TOK_COND_SECT_CLOSE)
  21168. }
  21169. }
  21170. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21171. return int32(m_XML_TOK_CLOSE_BRACKET)
  21172. _12:
  21173. ;
  21174. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21175. return int32(m_XML_TOK_OPEN_PAREN)
  21176. _13:
  21177. ;
  21178. ptr += uintptr(2)
  21179. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21180. return -int32(m_XML_TOK_CLOSE_PAREN)
  21181. }
  21182. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21183. v34 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21184. } else {
  21185. v34 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21186. }
  21187. switch v34 {
  21188. case int32(_BT_AST):
  21189. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21190. return int32(m_XML_TOK_CLOSE_PAREN_ASTERISK)
  21191. case int32(_BT_QUEST):
  21192. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21193. return int32(m_XML_TOK_CLOSE_PAREN_QUESTION)
  21194. case int32(_BT_PLUS):
  21195. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21196. return int32(m_XML_TOK_CLOSE_PAREN_PLUS)
  21197. case int32(_BT_CR):
  21198. fallthrough
  21199. case int32(_BT_LF):
  21200. fallthrough
  21201. case int32(_BT_S):
  21202. fallthrough
  21203. case int32(_BT_GT):
  21204. fallthrough
  21205. case int32(_BT_COMMA):
  21206. fallthrough
  21207. case int32(_BT_VERBAR):
  21208. fallthrough
  21209. case int32(_BT_RPAR):
  21210. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21211. return int32(m_XML_TOK_CLOSE_PAREN)
  21212. }
  21213. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21214. return m_XML_TOK_INVALID
  21215. _14:
  21216. ;
  21217. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21218. return int32(m_XML_TOK_OR)
  21219. _15:
  21220. ;
  21221. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21222. return int32(m_XML_TOK_DECL_CLOSE)
  21223. _16:
  21224. ;
  21225. return _little2_scanPoundName(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21226. _17:
  21227. ;
  21228. if int64(end)-int64(ptr) < int64(2) {
  21229. return -int32(2)
  21230. }
  21231. if 0 != 0 {
  21232. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21233. return m_XML_TOK_INVALID
  21234. }
  21235. if 0 != 0 {
  21236. ptr += uintptr(2)
  21237. tok = int32(m_XML_TOK_NAME)
  21238. goto _28
  21239. }
  21240. if 0 != 0 {
  21241. ptr += uintptr(2)
  21242. tok = int32(m_XML_TOK_NMTOKEN)
  21243. goto _28
  21244. }
  21245. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21246. return m_XML_TOK_INVALID
  21247. _18:
  21248. ;
  21249. if int64(end)-int64(ptr) < int64(3) {
  21250. return -int32(2)
  21251. }
  21252. if 0 != 0 {
  21253. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21254. return m_XML_TOK_INVALID
  21255. }
  21256. if 0 != 0 {
  21257. ptr += uintptr(3)
  21258. tok = int32(m_XML_TOK_NAME)
  21259. goto _28
  21260. }
  21261. if 0 != 0 {
  21262. ptr += uintptr(3)
  21263. tok = int32(m_XML_TOK_NMTOKEN)
  21264. goto _28
  21265. }
  21266. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21267. return m_XML_TOK_INVALID
  21268. _19:
  21269. ;
  21270. if int64(end)-int64(ptr) < int64(4) {
  21271. return -int32(2)
  21272. }
  21273. if 0 != 0 {
  21274. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21275. return m_XML_TOK_INVALID
  21276. }
  21277. if 0 != 0 {
  21278. ptr += uintptr(4)
  21279. tok = int32(m_XML_TOK_NAME)
  21280. goto _28
  21281. }
  21282. if 0 != 0 {
  21283. ptr += uintptr(4)
  21284. tok = int32(m_XML_TOK_NMTOKEN)
  21285. goto _28
  21286. }
  21287. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21288. return m_XML_TOK_INVALID
  21289. _21:
  21290. ;
  21291. _20:
  21292. ;
  21293. tok = int32(m_XML_TOK_NAME)
  21294. ptr += uintptr(2)
  21295. goto _28
  21296. _25:
  21297. ;
  21298. _24:
  21299. ;
  21300. _23:
  21301. ;
  21302. _22:
  21303. ;
  21304. tok = int32(m_XML_TOK_NMTOKEN)
  21305. ptr += uintptr(2)
  21306. goto _28
  21307. _26:
  21308. ;
  21309. if _namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&int32(0x1F))) != 0 {
  21310. ptr += uintptr(2)
  21311. tok = int32(m_XML_TOK_NAME)
  21312. goto _28
  21313. }
  21314. if _namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&int32(0x1F))) != 0 {
  21315. ptr += uintptr(2)
  21316. tok = int32(m_XML_TOK_NMTOKEN)
  21317. goto _28
  21318. }
  21319. /* fall through */
  21320. _27:
  21321. ;
  21322. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21323. return m_XML_TOK_INVALID
  21324. _28:
  21325. ;
  21326. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21327. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21328. v35 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21329. } else {
  21330. v35 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21331. }
  21332. switch v35 {
  21333. case int32(_BT_NONASCII):
  21334. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  21335. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21336. return m_XML_TOK_INVALID
  21337. } /* fall through */
  21338. fallthrough
  21339. case int32(_BT_NMSTRT):
  21340. fallthrough
  21341. case int32(_BT_HEX):
  21342. fallthrough
  21343. case int32(_BT_DIGIT):
  21344. fallthrough
  21345. case int32(_BT_NAME):
  21346. fallthrough
  21347. case int32(_BT_MINUS):
  21348. ptr += uintptr(2)
  21349. case int32(_BT_LEAD2):
  21350. if int64(end)-int64(ptr) < int64(2) {
  21351. return -int32(2)
  21352. }
  21353. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21354. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21355. return m_XML_TOK_INVALID
  21356. }
  21357. ptr += uintptr(2)
  21358. case int32(_BT_LEAD3):
  21359. if int64(end)-int64(ptr) < int64(3) {
  21360. return -int32(2)
  21361. }
  21362. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21363. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21364. return m_XML_TOK_INVALID
  21365. }
  21366. ptr += uintptr(3)
  21367. case int32(_BT_LEAD4):
  21368. if int64(end)-int64(ptr) < int64(4) {
  21369. return -int32(2)
  21370. }
  21371. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21372. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21373. return m_XML_TOK_INVALID
  21374. }
  21375. ptr += uintptr(4)
  21376. case int32(_BT_GT):
  21377. fallthrough
  21378. case int32(_BT_RPAR):
  21379. fallthrough
  21380. case int32(_BT_COMMA):
  21381. fallthrough
  21382. case int32(_BT_VERBAR):
  21383. fallthrough
  21384. case int32(_BT_LSQB):
  21385. fallthrough
  21386. case int32(_BT_PERCNT):
  21387. fallthrough
  21388. case int32(_BT_S):
  21389. fallthrough
  21390. case int32(_BT_CR):
  21391. fallthrough
  21392. case int32(_BT_LF):
  21393. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21394. return tok
  21395. case int32(_BT_COLON):
  21396. ptr += uintptr(2)
  21397. switch tok {
  21398. case int32(m_XML_TOK_NAME):
  21399. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21400. return -int32(1)
  21401. }
  21402. tok = int32(m_XML_TOK_PREFIXED_NAME)
  21403. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21404. v36 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21405. } else {
  21406. v36 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21407. }
  21408. switch v36 {
  21409. case int32(_BT_NONASCII):
  21410. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  21411. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21412. return m_XML_TOK_INVALID
  21413. } /* fall through */
  21414. fallthrough
  21415. case int32(_BT_NMSTRT):
  21416. fallthrough
  21417. case int32(_BT_HEX):
  21418. fallthrough
  21419. case int32(_BT_DIGIT):
  21420. fallthrough
  21421. case int32(_BT_NAME):
  21422. fallthrough
  21423. case int32(_BT_MINUS):
  21424. ptr += uintptr(2)
  21425. case int32(_BT_LEAD2):
  21426. if int64(end)-int64(ptr) < int64(2) {
  21427. return -int32(2)
  21428. }
  21429. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21430. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21431. return m_XML_TOK_INVALID
  21432. }
  21433. ptr += uintptr(2)
  21434. case int32(_BT_LEAD3):
  21435. if int64(end)-int64(ptr) < int64(3) {
  21436. return -int32(2)
  21437. }
  21438. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21439. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21440. return m_XML_TOK_INVALID
  21441. }
  21442. ptr += uintptr(3)
  21443. case int32(_BT_LEAD4):
  21444. if int64(end)-int64(ptr) < int64(4) {
  21445. return -int32(2)
  21446. }
  21447. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21448. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21449. return m_XML_TOK_INVALID
  21450. }
  21451. ptr += uintptr(4)
  21452. default:
  21453. tok = int32(m_XML_TOK_NMTOKEN)
  21454. break
  21455. }
  21456. case int32(m_XML_TOK_PREFIXED_NAME):
  21457. tok = int32(m_XML_TOK_NMTOKEN)
  21458. break
  21459. }
  21460. case int32(_BT_PLUS):
  21461. if tok == int32(m_XML_TOK_NMTOKEN) {
  21462. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21463. return m_XML_TOK_INVALID
  21464. }
  21465. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21466. return int32(m_XML_TOK_NAME_PLUS)
  21467. case int32(_BT_AST):
  21468. if tok == int32(m_XML_TOK_NMTOKEN) {
  21469. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21470. return m_XML_TOK_INVALID
  21471. }
  21472. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21473. return int32(m_XML_TOK_NAME_ASTERISK)
  21474. case int32(_BT_QUEST):
  21475. if tok == int32(m_XML_TOK_NMTOKEN) {
  21476. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21477. return m_XML_TOK_INVALID
  21478. }
  21479. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21480. return int32(m_XML_TOK_NAME_QUESTION)
  21481. default:
  21482. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21483. return m_XML_TOK_INVALID
  21484. }
  21485. }
  21486. return -tok
  21487. }
  21488. func _little2_attributeValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21489. var start uintptr
  21490. var v1, v2 int32
  21491. _, _, _ = start, v1, v2
  21492. if ptr >= end {
  21493. return -int32(4)
  21494. } else {
  21495. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21496. /* This line cannot be executed. The incoming data has already
  21497. * been tokenized once, so incomplete characters like this have
  21498. * already been eliminated from the input. Retaining the paranoia
  21499. * check is still valuable, however.
  21500. */
  21501. return -int32(1) /* LCOV_EXCL_LINE */
  21502. }
  21503. }
  21504. start = ptr
  21505. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21506. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21507. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21508. } else {
  21509. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21510. }
  21511. switch v1 {
  21512. case int32(_BT_LEAD2):
  21513. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  21514. case int32(_BT_LEAD3):
  21515. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  21516. case int32(_BT_LEAD4):
  21517. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  21518. case int32(_BT_AMP):
  21519. if ptr == start {
  21520. return _little2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21521. }
  21522. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21523. return int32(m_XML_TOK_DATA_CHARS)
  21524. case int32(_BT_LT):
  21525. /* this is for inside entity references */
  21526. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21527. return m_XML_TOK_INVALID
  21528. case int32(_BT_LF):
  21529. if ptr == start {
  21530. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21531. return int32(m_XML_TOK_DATA_NEWLINE)
  21532. }
  21533. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21534. return int32(m_XML_TOK_DATA_CHARS)
  21535. case int32(_BT_CR):
  21536. if ptr == start {
  21537. ptr += uintptr(2)
  21538. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21539. return -int32(3)
  21540. }
  21541. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21542. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21543. } else {
  21544. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21545. }
  21546. if v2 == int32(_BT_LF) {
  21547. ptr += uintptr(2)
  21548. }
  21549. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21550. return int32(m_XML_TOK_DATA_NEWLINE)
  21551. }
  21552. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21553. return int32(m_XML_TOK_DATA_CHARS)
  21554. case int32(_BT_S):
  21555. if ptr == start {
  21556. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21557. return int32(m_XML_TOK_ATTRIBUTE_VALUE_S)
  21558. }
  21559. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21560. return int32(m_XML_TOK_DATA_CHARS)
  21561. default:
  21562. ptr += uintptr(2)
  21563. break
  21564. }
  21565. }
  21566. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21567. return int32(m_XML_TOK_DATA_CHARS)
  21568. }
  21569. func _little2_entityValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21570. var start uintptr
  21571. var tok, v1, v2, v3 int32
  21572. _, _, _, _, _ = start, tok, v1, v2, v3
  21573. if ptr >= end {
  21574. return -int32(4)
  21575. } else {
  21576. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21577. /* This line cannot be executed. The incoming data has already
  21578. * been tokenized once, so incomplete characters like this have
  21579. * already been eliminated from the input. Retaining the paranoia
  21580. * check is still valuable, however.
  21581. */
  21582. return -int32(1) /* LCOV_EXCL_LINE */
  21583. }
  21584. }
  21585. start = ptr
  21586. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21587. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21588. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21589. } else {
  21590. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21591. }
  21592. switch v1 {
  21593. case int32(_BT_LEAD2):
  21594. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  21595. case int32(_BT_LEAD3):
  21596. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  21597. case int32(_BT_LEAD4):
  21598. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  21599. case int32(_BT_AMP):
  21600. if ptr == start {
  21601. return _little2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21602. }
  21603. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21604. return int32(m_XML_TOK_DATA_CHARS)
  21605. case int32(_BT_PERCNT):
  21606. if ptr == start {
  21607. tok = _little2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21608. if tok == int32(m_XML_TOK_PERCENT) {
  21609. v2 = m_XML_TOK_INVALID
  21610. } else {
  21611. v2 = tok
  21612. }
  21613. return v2
  21614. }
  21615. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21616. return int32(m_XML_TOK_DATA_CHARS)
  21617. case int32(_BT_LF):
  21618. if ptr == start {
  21619. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21620. return int32(m_XML_TOK_DATA_NEWLINE)
  21621. }
  21622. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21623. return int32(m_XML_TOK_DATA_CHARS)
  21624. case int32(_BT_CR):
  21625. if ptr == start {
  21626. ptr += uintptr(2)
  21627. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21628. return -int32(3)
  21629. }
  21630. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21631. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21632. } else {
  21633. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21634. }
  21635. if v3 == int32(_BT_LF) {
  21636. ptr += uintptr(2)
  21637. }
  21638. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21639. return int32(m_XML_TOK_DATA_NEWLINE)
  21640. }
  21641. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21642. return int32(m_XML_TOK_DATA_CHARS)
  21643. default:
  21644. ptr += uintptr(2)
  21645. break
  21646. }
  21647. }
  21648. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21649. return int32(m_XML_TOK_DATA_CHARS)
  21650. }
  21651. func _little2_ignoreSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21652. var level, v1 int32
  21653. var n Tsize_t
  21654. _, _, _ = level, n, v1
  21655. level = 0
  21656. if int32(2) > int32(1) {
  21657. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  21658. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  21659. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  21660. end = ptr + uintptr(n)
  21661. }
  21662. }
  21663. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21664. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21665. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21666. } else {
  21667. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21668. }
  21669. switch v1 {
  21670. case int32(_BT_LEAD2):
  21671. if int64(end)-int64(ptr) < int64(2) {
  21672. return -int32(2)
  21673. }
  21674. if 0 != 0 {
  21675. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21676. return m_XML_TOK_INVALID
  21677. }
  21678. ptr += uintptr(2)
  21679. case int32(_BT_LEAD3):
  21680. if int64(end)-int64(ptr) < int64(3) {
  21681. return -int32(2)
  21682. }
  21683. if 0 != 0 {
  21684. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21685. return m_XML_TOK_INVALID
  21686. }
  21687. ptr += uintptr(3)
  21688. case int32(_BT_LEAD4):
  21689. if int64(end)-int64(ptr) < int64(4) {
  21690. return -int32(2)
  21691. }
  21692. if 0 != 0 {
  21693. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21694. return m_XML_TOK_INVALID
  21695. }
  21696. ptr += uintptr(4)
  21697. case int32(_BT_NONXML):
  21698. fallthrough
  21699. case int32(_BT_MALFORM):
  21700. fallthrough
  21701. case int32(_BT_TRAIL):
  21702. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21703. return m_XML_TOK_INVALID
  21704. case int32(_BT_LT):
  21705. ptr += uintptr(2)
  21706. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21707. return -int32(1)
  21708. }
  21709. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_EXCL2) {
  21710. ptr += uintptr(2)
  21711. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21712. return -int32(1)
  21713. }
  21714. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_LSQB1) {
  21715. level++
  21716. ptr += uintptr(2)
  21717. }
  21718. }
  21719. case int32(_BT_RSQB):
  21720. ptr += uintptr(2)
  21721. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21722. return -int32(1)
  21723. }
  21724. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  21725. ptr += uintptr(2)
  21726. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21727. return -int32(1)
  21728. }
  21729. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  21730. ptr += uintptr(2)
  21731. if level == 0 {
  21732. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21733. return int32(m_XML_TOK_IGNORE_SECT)
  21734. }
  21735. level--
  21736. }
  21737. }
  21738. default:
  21739. ptr += uintptr(2)
  21740. break
  21741. }
  21742. }
  21743. return -int32(1)
  21744. }
  21745. func _little2_isPublicId(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr) (r int32) {
  21746. var v2, v3, v4 int32
  21747. _, _, _ = v2, v3, v4
  21748. ptr += uintptr(2)
  21749. end -= uintptr(2)
  21750. for {
  21751. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21752. break
  21753. }
  21754. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21755. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21756. } else {
  21757. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21758. }
  21759. switch v2 {
  21760. case int32(_BT_DIGIT):
  21761. fallthrough
  21762. case int32(_BT_HEX):
  21763. fallthrough
  21764. case int32(_BT_MINUS):
  21765. fallthrough
  21766. case int32(_BT_APOS):
  21767. fallthrough
  21768. case int32(_BT_LPAR):
  21769. fallthrough
  21770. case int32(_BT_RPAR):
  21771. fallthrough
  21772. case int32(_BT_PLUS):
  21773. fallthrough
  21774. case int32(_BT_COMMA):
  21775. fallthrough
  21776. case int32(_BT_SOL):
  21777. fallthrough
  21778. case int32(_BT_EQUALS):
  21779. fallthrough
  21780. case int32(_BT_QUEST):
  21781. fallthrough
  21782. case int32(_BT_CR):
  21783. fallthrough
  21784. case int32(_BT_LF):
  21785. fallthrough
  21786. case int32(_BT_SEMI):
  21787. fallthrough
  21788. case int32(_BT_EXCL):
  21789. fallthrough
  21790. case int32(_BT_AST):
  21791. fallthrough
  21792. case int32(_BT_PERCNT):
  21793. fallthrough
  21794. case int32(_BT_NUM):
  21795. fallthrough
  21796. case int32(_BT_COLON):
  21797. case int32(_BT_S):
  21798. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_TAB1) {
  21799. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  21800. return 0
  21801. }
  21802. case int32(_BT_NAME):
  21803. fallthrough
  21804. case int32(_BT_NMSTRT):
  21805. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21806. v3 = int32(*(*int8)(unsafe.Pointer(ptr)))
  21807. } else {
  21808. v3 = -int32(1)
  21809. }
  21810. if !(v3 & ^libc.Int32FromInt32(0x7f) != 0) {
  21811. break
  21812. }
  21813. /* fall through */
  21814. fallthrough
  21815. default:
  21816. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21817. v4 = int32(*(*int8)(unsafe.Pointer(ptr)))
  21818. } else {
  21819. v4 = -int32(1)
  21820. }
  21821. switch v4 {
  21822. case int32(0x24): /* $ */
  21823. fallthrough
  21824. case int32(0x40): /* @ */
  21825. default:
  21826. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  21827. return 0
  21828. }
  21829. break
  21830. }
  21831. goto _1
  21832. _1:
  21833. ;
  21834. ptr += uintptr(2)
  21835. }
  21836. return int32(1)
  21837. }
  21838. /* This must only be called for a well-formed start-tag or empty
  21839. element tag. Returns the number of attributes. Pointers to the
  21840. first attsMax attributes are stored in atts.
  21841. */
  21842. func _little2_getAtts(tls *libc.TLS, enc uintptr, ptr uintptr, attsMax int32, atts uintptr) (r int32) {
  21843. var nAtts, open, state, v2, v3, v5, v7 int32
  21844. var v4, v6, v8, v9 bool
  21845. _, _, _, _, _, _, _, _, _, _, _ = nAtts, open, state, v2, v3, v4, v5, v6, v7, v8, v9
  21846. state = 1
  21847. nAtts = 0
  21848. open = 0 /* defined when state == inValue;
  21849. initialization just to shut up compilers */
  21850. ptr += uintptr(2)
  21851. for {
  21852. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21853. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21854. } else {
  21855. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21856. }
  21857. switch v2 {
  21858. case int32(_BT_LEAD2):
  21859. if state == 0 {
  21860. if nAtts < attsMax {
  21861. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  21862. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  21863. }
  21864. state = 1
  21865. }
  21866. ptr += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(2))
  21867. case int32(_BT_LEAD3):
  21868. if state == 0 {
  21869. if nAtts < attsMax {
  21870. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  21871. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  21872. }
  21873. state = 1
  21874. }
  21875. ptr += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(2))
  21876. case int32(_BT_LEAD4):
  21877. if state == 0 {
  21878. if nAtts < attsMax {
  21879. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  21880. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  21881. }
  21882. state = 1
  21883. }
  21884. ptr += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(2))
  21885. case int32(_BT_NONASCII):
  21886. fallthrough
  21887. case int32(_BT_NMSTRT):
  21888. fallthrough
  21889. case int32(_BT_HEX):
  21890. if state == 0 {
  21891. if nAtts < attsMax {
  21892. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  21893. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  21894. }
  21895. state = 1
  21896. }
  21897. case int32(_BT_QUOT):
  21898. if state != 2 {
  21899. if nAtts < attsMax {
  21900. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  21901. }
  21902. state = 2
  21903. open = int32(_BT_QUOT)
  21904. } else {
  21905. if open == int32(_BT_QUOT) {
  21906. state = 0
  21907. if nAtts < attsMax {
  21908. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  21909. }
  21910. nAtts++
  21911. }
  21912. }
  21913. case int32(_BT_APOS):
  21914. if state != 2 {
  21915. if nAtts < attsMax {
  21916. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  21917. }
  21918. state = 2
  21919. open = int32(_BT_APOS)
  21920. } else {
  21921. if open == int32(_BT_APOS) {
  21922. state = 0
  21923. if nAtts < attsMax {
  21924. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  21925. }
  21926. nAtts++
  21927. }
  21928. }
  21929. case int32(_BT_AMP):
  21930. if nAtts < attsMax {
  21931. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  21932. }
  21933. case int32(_BT_S):
  21934. if state == 1 {
  21935. state = 0
  21936. } else {
  21937. if v9 = state == 2 && nAtts < attsMax && (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized != 0; v9 {
  21938. if v4 = ptr == (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr; !v4 {
  21939. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21940. v3 = int32(*(*int8)(unsafe.Pointer(ptr)))
  21941. } else {
  21942. v3 = -int32(1)
  21943. }
  21944. }
  21945. if v6 = v4 || v3 != int32(m_ASCII_SPACE1); !v6 {
  21946. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 {
  21947. v5 = int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))
  21948. } else {
  21949. v5 = -int32(1)
  21950. }
  21951. }
  21952. if v8 = v6 || v5 == int32(m_ASCII_SPACE1); !v8 {
  21953. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 {
  21954. v7 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))))))
  21955. } else {
  21956. v7 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)), *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))
  21957. }
  21958. }
  21959. }
  21960. if v9 && (v8 || v7 == open) {
  21961. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  21962. }
  21963. }
  21964. case int32(_BT_CR):
  21965. fallthrough
  21966. case int32(_BT_LF):
  21967. /* This case ensures that the first attribute name is counted
  21968. Apart from that we could just change state on the quote. */
  21969. if state == 1 {
  21970. state = 0
  21971. } else {
  21972. if state == 2 && nAtts < attsMax {
  21973. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  21974. }
  21975. }
  21976. case int32(_BT_GT):
  21977. fallthrough
  21978. case int32(_BT_SOL):
  21979. if state != 2 {
  21980. return nAtts
  21981. }
  21982. default:
  21983. break
  21984. }
  21985. goto _1
  21986. _1:
  21987. ;
  21988. ptr += uintptr(2)
  21989. }
  21990. /* not reached */
  21991. return r
  21992. }
  21993. func _little2_charRefNumber(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  21994. var c, c1, result, v2, v4 int32
  21995. _, _, _, _, _ = c, c1, result, v2, v4
  21996. result = 0
  21997. /* skip &# */
  21998. _ = enc
  21999. ptr += uintptr(libc.Int32FromInt32(2) * libc.Int32FromInt32(2))
  22000. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  22001. ptr += uintptr(2)
  22002. for {
  22003. if !!(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_SEMI1)) {
  22004. break
  22005. }
  22006. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22007. v2 = int32(*(*int8)(unsafe.Pointer(ptr)))
  22008. } else {
  22009. v2 = -int32(1)
  22010. }
  22011. c = v2
  22012. switch c {
  22013. case int32(m_ASCII_02):
  22014. fallthrough
  22015. case int32(m_ASCII_12):
  22016. fallthrough
  22017. case int32(m_ASCII_22):
  22018. fallthrough
  22019. case int32(m_ASCII_32):
  22020. fallthrough
  22021. case int32(m_ASCII_41):
  22022. fallthrough
  22023. case int32(m_ASCII_51):
  22024. fallthrough
  22025. case int32(m_ASCII_61):
  22026. fallthrough
  22027. case int32(m_ASCII_71):
  22028. fallthrough
  22029. case int32(m_ASCII_82):
  22030. fallthrough
  22031. case int32(m_ASCII_92):
  22032. result <<= int32(4)
  22033. result |= c - int32(m_ASCII_02)
  22034. case int32(m_ASCII_A):
  22035. fallthrough
  22036. case int32(m_ASCII_B1):
  22037. fallthrough
  22038. case int32(m_ASCII_C):
  22039. fallthrough
  22040. case int32(m_ASCII_D):
  22041. fallthrough
  22042. case int32(m_ASCII_E):
  22043. fallthrough
  22044. case int32(m_ASCII_F):
  22045. result <<= int32(4)
  22046. result += int32(10) + (c - int32(m_ASCII_A))
  22047. case int32(m_ASCII_a2):
  22048. fallthrough
  22049. case int32(m_ASCII_b1):
  22050. fallthrough
  22051. case int32(m_ASCII_c2):
  22052. fallthrough
  22053. case int32(m_ASCII_d1):
  22054. fallthrough
  22055. case int32(m_ASCII_e2):
  22056. fallthrough
  22057. case int32(m_ASCII_f1):
  22058. result <<= int32(4)
  22059. result += int32(10) + (c - int32(m_ASCII_a2))
  22060. break
  22061. }
  22062. if result >= int32(0x110000) {
  22063. return -int32(1)
  22064. }
  22065. goto _1
  22066. _1:
  22067. ;
  22068. ptr += uintptr(2)
  22069. }
  22070. } else {
  22071. for {
  22072. if !!(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_SEMI1)) {
  22073. break
  22074. }
  22075. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22076. v4 = int32(*(*int8)(unsafe.Pointer(ptr)))
  22077. } else {
  22078. v4 = -int32(1)
  22079. }
  22080. c1 = v4
  22081. result *= int32(10)
  22082. result += c1 - int32(m_ASCII_02)
  22083. if result >= int32(0x110000) {
  22084. return -int32(1)
  22085. }
  22086. goto _3
  22087. _3:
  22088. ;
  22089. ptr += uintptr(2)
  22090. }
  22091. }
  22092. return _checkCharRefNumber(tls, result)
  22093. }
  22094. func _little2_predefinedEntityName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr) (r int32) {
  22095. var v1, v2 int32
  22096. _, _ = v1, v2
  22097. _ = enc
  22098. switch (int64(end) - int64(ptr)) / libc.Int64FromInt32(2) {
  22099. case int64(2):
  22100. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == int32(m_ASCII_t2) {
  22101. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22102. v1 = int32(*(*int8)(unsafe.Pointer(ptr)))
  22103. } else {
  22104. v1 = -int32(1)
  22105. }
  22106. switch v1 {
  22107. case int32(m_ASCII_l2):
  22108. return int32(m_ASCII_LT1)
  22109. case int32(m_ASCII_g2):
  22110. return int32(m_ASCII_GT1)
  22111. }
  22112. }
  22113. case int64(3):
  22114. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_a2) {
  22115. ptr += uintptr(2)
  22116. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_m2) {
  22117. ptr += uintptr(2)
  22118. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  22119. return int32(m_ASCII_AMP1)
  22120. }
  22121. }
  22122. }
  22123. case int64(4):
  22124. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22125. v2 = int32(*(*int8)(unsafe.Pointer(ptr)))
  22126. } else {
  22127. v2 = -int32(1)
  22128. }
  22129. switch v2 {
  22130. case int32(m_ASCII_q1):
  22131. ptr += uintptr(2)
  22132. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_u1) {
  22133. ptr += uintptr(2)
  22134. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  22135. ptr += uintptr(2)
  22136. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_t2) {
  22137. return int32(m_ASCII_QUOT1)
  22138. }
  22139. }
  22140. }
  22141. case int32(m_ASCII_a2):
  22142. ptr += uintptr(2)
  22143. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  22144. ptr += uintptr(2)
  22145. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  22146. ptr += uintptr(2)
  22147. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_s2) {
  22148. return int32(m_ASCII_APOS1)
  22149. }
  22150. }
  22151. }
  22152. break
  22153. }
  22154. }
  22155. return 0
  22156. }
  22157. func _little2_nameMatchesAscii(tls *libc.TLS, enc uintptr, ptr1 uintptr, end1 uintptr, ptr2 uintptr) (r int32) {
  22158. _ = enc
  22159. for {
  22160. if !(*(*int8)(unsafe.Pointer(ptr2)) != 0) {
  22161. break
  22162. }
  22163. if int64(end1)-int64(ptr1) < int64(2) {
  22164. /* This line cannot be executed. The incoming data has already
  22165. * been tokenized once, so incomplete characters like this have
  22166. * already been eliminated from the input. Retaining the
  22167. * paranoia check is still valuable, however.
  22168. */
  22169. return 0 /* LCOV_EXCL_LINE */
  22170. }
  22171. if !(int32(*(*int8)(unsafe.Pointer(ptr1 + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr1))) == int32(*(*int8)(unsafe.Pointer(ptr2)))) {
  22172. return 0
  22173. }
  22174. goto _1
  22175. _1:
  22176. ;
  22177. ptr1 += uintptr(2)
  22178. ptr2++
  22179. }
  22180. return libc.BoolInt32(ptr1 == end1)
  22181. }
  22182. func _little2_nameLength(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  22183. var start uintptr
  22184. var v2 int32
  22185. _, _ = start, v2
  22186. start = ptr
  22187. for {
  22188. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22189. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22190. } else {
  22191. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22192. }
  22193. switch v2 {
  22194. case int32(_BT_LEAD2):
  22195. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  22196. case int32(_BT_LEAD3):
  22197. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  22198. case int32(_BT_LEAD4):
  22199. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  22200. case int32(_BT_NONASCII):
  22201. fallthrough
  22202. case int32(_BT_NMSTRT):
  22203. fallthrough
  22204. case int32(_BT_COLON):
  22205. fallthrough
  22206. case int32(_BT_HEX):
  22207. fallthrough
  22208. case int32(_BT_DIGIT):
  22209. fallthrough
  22210. case int32(_BT_NAME):
  22211. fallthrough
  22212. case int32(_BT_MINUS):
  22213. ptr += uintptr(2)
  22214. default:
  22215. return int32(int64(ptr) - int64(start))
  22216. }
  22217. goto _1
  22218. _1:
  22219. }
  22220. return r
  22221. }
  22222. func _little2_skipS(tls *libc.TLS, enc uintptr, ptr uintptr) (r uintptr) {
  22223. var v2 int32
  22224. _ = v2
  22225. for {
  22226. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22227. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22228. } else {
  22229. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22230. }
  22231. switch v2 {
  22232. case int32(_BT_LF):
  22233. fallthrough
  22234. case int32(_BT_CR):
  22235. fallthrough
  22236. case int32(_BT_S):
  22237. ptr += uintptr(2)
  22238. default:
  22239. return ptr
  22240. }
  22241. goto _1
  22242. _1:
  22243. }
  22244. return r
  22245. }
  22246. func _little2_updatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  22247. var v1, v2 int32
  22248. var v3 bool
  22249. _, _, _ = v1, v2, v3
  22250. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  22251. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22252. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22253. } else {
  22254. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22255. }
  22256. switch v1 {
  22257. case int32(_BT_LEAD2):
  22258. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  22259. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  22260. case int32(_BT_LEAD3):
  22261. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  22262. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  22263. case int32(_BT_LEAD4):
  22264. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  22265. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  22266. case int32(_BT_LF):
  22267. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  22268. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  22269. ptr += uintptr(2)
  22270. case int32(_BT_CR):
  22271. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  22272. ptr += uintptr(2)
  22273. if v3 = int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)); v3 {
  22274. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22275. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22276. } else {
  22277. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22278. }
  22279. }
  22280. if v3 && v2 == int32(_BT_LF) {
  22281. ptr += uintptr(2)
  22282. }
  22283. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  22284. default:
  22285. ptr += uintptr(2)
  22286. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  22287. break
  22288. }
  22289. }
  22290. }
  22291. var _little2_encoding_ns = Tnormal_encoding{
  22292. Fenc: TENCODING{
  22293. Fscanners: [4]TSCANNER{},
  22294. FliteralScanners: [2]TSCANNER{},
  22295. FminBytesPerChar: int32(2),
  22296. FisUtf16: int8(1),
  22297. },
  22298. Ftype1: [256]uint8{
  22299. 9: uint8(_BT_S),
  22300. 10: uint8(_BT_LF),
  22301. 13: uint8(_BT_CR),
  22302. 32: uint8(_BT_S),
  22303. 33: uint8(_BT_EXCL),
  22304. 34: uint8(_BT_QUOT),
  22305. 35: uint8(_BT_NUM),
  22306. 36: uint8(_BT_OTHER),
  22307. 37: uint8(_BT_PERCNT),
  22308. 38: uint8(_BT_AMP),
  22309. 39: uint8(_BT_APOS),
  22310. 40: uint8(_BT_LPAR),
  22311. 41: uint8(_BT_RPAR),
  22312. 42: uint8(_BT_AST),
  22313. 43: uint8(_BT_PLUS),
  22314. 44: uint8(_BT_COMMA),
  22315. 45: uint8(_BT_MINUS),
  22316. 46: uint8(_BT_NAME),
  22317. 47: uint8(_BT_SOL),
  22318. 48: uint8(_BT_DIGIT),
  22319. 49: uint8(_BT_DIGIT),
  22320. 50: uint8(_BT_DIGIT),
  22321. 51: uint8(_BT_DIGIT),
  22322. 52: uint8(_BT_DIGIT),
  22323. 53: uint8(_BT_DIGIT),
  22324. 54: uint8(_BT_DIGIT),
  22325. 55: uint8(_BT_DIGIT),
  22326. 56: uint8(_BT_DIGIT),
  22327. 57: uint8(_BT_DIGIT),
  22328. 58: uint8(_BT_COLON),
  22329. 59: uint8(_BT_SEMI),
  22330. 60: uint8(_BT_LT),
  22331. 61: uint8(_BT_EQUALS),
  22332. 62: uint8(_BT_GT),
  22333. 63: uint8(_BT_QUEST),
  22334. 64: uint8(_BT_OTHER),
  22335. 65: uint8(_BT_HEX),
  22336. 66: uint8(_BT_HEX),
  22337. 67: uint8(_BT_HEX),
  22338. 68: uint8(_BT_HEX),
  22339. 69: uint8(_BT_HEX),
  22340. 70: uint8(_BT_HEX),
  22341. 71: uint8(_BT_NMSTRT),
  22342. 72: uint8(_BT_NMSTRT),
  22343. 73: uint8(_BT_NMSTRT),
  22344. 74: uint8(_BT_NMSTRT),
  22345. 75: uint8(_BT_NMSTRT),
  22346. 76: uint8(_BT_NMSTRT),
  22347. 77: uint8(_BT_NMSTRT),
  22348. 78: uint8(_BT_NMSTRT),
  22349. 79: uint8(_BT_NMSTRT),
  22350. 80: uint8(_BT_NMSTRT),
  22351. 81: uint8(_BT_NMSTRT),
  22352. 82: uint8(_BT_NMSTRT),
  22353. 83: uint8(_BT_NMSTRT),
  22354. 84: uint8(_BT_NMSTRT),
  22355. 85: uint8(_BT_NMSTRT),
  22356. 86: uint8(_BT_NMSTRT),
  22357. 87: uint8(_BT_NMSTRT),
  22358. 88: uint8(_BT_NMSTRT),
  22359. 89: uint8(_BT_NMSTRT),
  22360. 90: uint8(_BT_NMSTRT),
  22361. 91: uint8(_BT_LSQB),
  22362. 92: uint8(_BT_OTHER),
  22363. 93: uint8(_BT_RSQB),
  22364. 94: uint8(_BT_OTHER),
  22365. 95: uint8(_BT_NMSTRT),
  22366. 96: uint8(_BT_OTHER),
  22367. 97: uint8(_BT_HEX),
  22368. 98: uint8(_BT_HEX),
  22369. 99: uint8(_BT_HEX),
  22370. 100: uint8(_BT_HEX),
  22371. 101: uint8(_BT_HEX),
  22372. 102: uint8(_BT_HEX),
  22373. 103: uint8(_BT_NMSTRT),
  22374. 104: uint8(_BT_NMSTRT),
  22375. 105: uint8(_BT_NMSTRT),
  22376. 106: uint8(_BT_NMSTRT),
  22377. 107: uint8(_BT_NMSTRT),
  22378. 108: uint8(_BT_NMSTRT),
  22379. 109: uint8(_BT_NMSTRT),
  22380. 110: uint8(_BT_NMSTRT),
  22381. 111: uint8(_BT_NMSTRT),
  22382. 112: uint8(_BT_NMSTRT),
  22383. 113: uint8(_BT_NMSTRT),
  22384. 114: uint8(_BT_NMSTRT),
  22385. 115: uint8(_BT_NMSTRT),
  22386. 116: uint8(_BT_NMSTRT),
  22387. 117: uint8(_BT_NMSTRT),
  22388. 118: uint8(_BT_NMSTRT),
  22389. 119: uint8(_BT_NMSTRT),
  22390. 120: uint8(_BT_NMSTRT),
  22391. 121: uint8(_BT_NMSTRT),
  22392. 122: uint8(_BT_NMSTRT),
  22393. 123: uint8(_BT_OTHER),
  22394. 124: uint8(_BT_VERBAR),
  22395. 125: uint8(_BT_OTHER),
  22396. 126: uint8(_BT_OTHER),
  22397. 127: uint8(_BT_OTHER),
  22398. 128: uint8(_BT_OTHER),
  22399. 129: uint8(_BT_OTHER),
  22400. 130: uint8(_BT_OTHER),
  22401. 131: uint8(_BT_OTHER),
  22402. 132: uint8(_BT_OTHER),
  22403. 133: uint8(_BT_OTHER),
  22404. 134: uint8(_BT_OTHER),
  22405. 135: uint8(_BT_OTHER),
  22406. 136: uint8(_BT_OTHER),
  22407. 137: uint8(_BT_OTHER),
  22408. 138: uint8(_BT_OTHER),
  22409. 139: uint8(_BT_OTHER),
  22410. 140: uint8(_BT_OTHER),
  22411. 141: uint8(_BT_OTHER),
  22412. 142: uint8(_BT_OTHER),
  22413. 143: uint8(_BT_OTHER),
  22414. 144: uint8(_BT_OTHER),
  22415. 145: uint8(_BT_OTHER),
  22416. 146: uint8(_BT_OTHER),
  22417. 147: uint8(_BT_OTHER),
  22418. 148: uint8(_BT_OTHER),
  22419. 149: uint8(_BT_OTHER),
  22420. 150: uint8(_BT_OTHER),
  22421. 151: uint8(_BT_OTHER),
  22422. 152: uint8(_BT_OTHER),
  22423. 153: uint8(_BT_OTHER),
  22424. 154: uint8(_BT_OTHER),
  22425. 155: uint8(_BT_OTHER),
  22426. 156: uint8(_BT_OTHER),
  22427. 157: uint8(_BT_OTHER),
  22428. 158: uint8(_BT_OTHER),
  22429. 159: uint8(_BT_OTHER),
  22430. 160: uint8(_BT_OTHER),
  22431. 161: uint8(_BT_OTHER),
  22432. 162: uint8(_BT_OTHER),
  22433. 163: uint8(_BT_OTHER),
  22434. 164: uint8(_BT_OTHER),
  22435. 165: uint8(_BT_OTHER),
  22436. 166: uint8(_BT_OTHER),
  22437. 167: uint8(_BT_OTHER),
  22438. 168: uint8(_BT_OTHER),
  22439. 169: uint8(_BT_OTHER),
  22440. 170: uint8(_BT_NMSTRT),
  22441. 171: uint8(_BT_OTHER),
  22442. 172: uint8(_BT_OTHER),
  22443. 173: uint8(_BT_OTHER),
  22444. 174: uint8(_BT_OTHER),
  22445. 175: uint8(_BT_OTHER),
  22446. 176: uint8(_BT_OTHER),
  22447. 177: uint8(_BT_OTHER),
  22448. 178: uint8(_BT_OTHER),
  22449. 179: uint8(_BT_OTHER),
  22450. 180: uint8(_BT_OTHER),
  22451. 181: uint8(_BT_NMSTRT),
  22452. 182: uint8(_BT_OTHER),
  22453. 183: uint8(_BT_NAME),
  22454. 184: uint8(_BT_OTHER),
  22455. 185: uint8(_BT_OTHER),
  22456. 186: uint8(_BT_NMSTRT),
  22457. 187: uint8(_BT_OTHER),
  22458. 188: uint8(_BT_OTHER),
  22459. 189: uint8(_BT_OTHER),
  22460. 190: uint8(_BT_OTHER),
  22461. 191: uint8(_BT_OTHER),
  22462. 192: uint8(_BT_NMSTRT),
  22463. 193: uint8(_BT_NMSTRT),
  22464. 194: uint8(_BT_NMSTRT),
  22465. 195: uint8(_BT_NMSTRT),
  22466. 196: uint8(_BT_NMSTRT),
  22467. 197: uint8(_BT_NMSTRT),
  22468. 198: uint8(_BT_NMSTRT),
  22469. 199: uint8(_BT_NMSTRT),
  22470. 200: uint8(_BT_NMSTRT),
  22471. 201: uint8(_BT_NMSTRT),
  22472. 202: uint8(_BT_NMSTRT),
  22473. 203: uint8(_BT_NMSTRT),
  22474. 204: uint8(_BT_NMSTRT),
  22475. 205: uint8(_BT_NMSTRT),
  22476. 206: uint8(_BT_NMSTRT),
  22477. 207: uint8(_BT_NMSTRT),
  22478. 208: uint8(_BT_NMSTRT),
  22479. 209: uint8(_BT_NMSTRT),
  22480. 210: uint8(_BT_NMSTRT),
  22481. 211: uint8(_BT_NMSTRT),
  22482. 212: uint8(_BT_NMSTRT),
  22483. 213: uint8(_BT_NMSTRT),
  22484. 214: uint8(_BT_NMSTRT),
  22485. 215: uint8(_BT_OTHER),
  22486. 216: uint8(_BT_NMSTRT),
  22487. 217: uint8(_BT_NMSTRT),
  22488. 218: uint8(_BT_NMSTRT),
  22489. 219: uint8(_BT_NMSTRT),
  22490. 220: uint8(_BT_NMSTRT),
  22491. 221: uint8(_BT_NMSTRT),
  22492. 222: uint8(_BT_NMSTRT),
  22493. 223: uint8(_BT_NMSTRT),
  22494. 224: uint8(_BT_NMSTRT),
  22495. 225: uint8(_BT_NMSTRT),
  22496. 226: uint8(_BT_NMSTRT),
  22497. 227: uint8(_BT_NMSTRT),
  22498. 228: uint8(_BT_NMSTRT),
  22499. 229: uint8(_BT_NMSTRT),
  22500. 230: uint8(_BT_NMSTRT),
  22501. 231: uint8(_BT_NMSTRT),
  22502. 232: uint8(_BT_NMSTRT),
  22503. 233: uint8(_BT_NMSTRT),
  22504. 234: uint8(_BT_NMSTRT),
  22505. 235: uint8(_BT_NMSTRT),
  22506. 236: uint8(_BT_NMSTRT),
  22507. 237: uint8(_BT_NMSTRT),
  22508. 238: uint8(_BT_NMSTRT),
  22509. 239: uint8(_BT_NMSTRT),
  22510. 240: uint8(_BT_NMSTRT),
  22511. 241: uint8(_BT_NMSTRT),
  22512. 242: uint8(_BT_NMSTRT),
  22513. 243: uint8(_BT_NMSTRT),
  22514. 244: uint8(_BT_NMSTRT),
  22515. 245: uint8(_BT_NMSTRT),
  22516. 246: uint8(_BT_NMSTRT),
  22517. 247: uint8(_BT_OTHER),
  22518. 248: uint8(_BT_NMSTRT),
  22519. 249: uint8(_BT_NMSTRT),
  22520. 250: uint8(_BT_NMSTRT),
  22521. 251: uint8(_BT_NMSTRT),
  22522. 252: uint8(_BT_NMSTRT),
  22523. 253: uint8(_BT_NMSTRT),
  22524. 254: uint8(_BT_NMSTRT),
  22525. 255: uint8(_BT_NMSTRT),
  22526. },
  22527. }
  22528. func init() {
  22529. p := unsafe.Pointer(&_little2_encoding_ns)
  22530. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  22531. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_contentTok)
  22532. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_cdataSectionTok)
  22533. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_ignoreSectionTok)
  22534. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_attributeValueTok)
  22535. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_entityValueTok)
  22536. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_nameMatchesAscii)
  22537. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_nameLength)
  22538. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_little2_skipS)
  22539. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_little2_getAtts)
  22540. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_little2_charRefNumber)
  22541. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_little2_predefinedEntityName)
  22542. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_little2_updatePosition)
  22543. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_little2_isPublicId)
  22544. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_little2_toUtf8)
  22545. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_little2_toUtf16)
  22546. }
  22547. var _little2_encoding = Tnormal_encoding{
  22548. Fenc: TENCODING{
  22549. Fscanners: [4]TSCANNER{},
  22550. FliteralScanners: [2]TSCANNER{},
  22551. FminBytesPerChar: int32(2),
  22552. FisUtf16: int8(1),
  22553. },
  22554. Ftype1: [256]uint8{
  22555. 9: uint8(_BT_S),
  22556. 10: uint8(_BT_LF),
  22557. 13: uint8(_BT_CR),
  22558. 32: uint8(_BT_S),
  22559. 33: uint8(_BT_EXCL),
  22560. 34: uint8(_BT_QUOT),
  22561. 35: uint8(_BT_NUM),
  22562. 36: uint8(_BT_OTHER),
  22563. 37: uint8(_BT_PERCNT),
  22564. 38: uint8(_BT_AMP),
  22565. 39: uint8(_BT_APOS),
  22566. 40: uint8(_BT_LPAR),
  22567. 41: uint8(_BT_RPAR),
  22568. 42: uint8(_BT_AST),
  22569. 43: uint8(_BT_PLUS),
  22570. 44: uint8(_BT_COMMA),
  22571. 45: uint8(_BT_MINUS),
  22572. 46: uint8(_BT_NAME),
  22573. 47: uint8(_BT_SOL),
  22574. 48: uint8(_BT_DIGIT),
  22575. 49: uint8(_BT_DIGIT),
  22576. 50: uint8(_BT_DIGIT),
  22577. 51: uint8(_BT_DIGIT),
  22578. 52: uint8(_BT_DIGIT),
  22579. 53: uint8(_BT_DIGIT),
  22580. 54: uint8(_BT_DIGIT),
  22581. 55: uint8(_BT_DIGIT),
  22582. 56: uint8(_BT_DIGIT),
  22583. 57: uint8(_BT_DIGIT),
  22584. 58: uint8(_BT_NMSTRT),
  22585. 59: uint8(_BT_SEMI),
  22586. 60: uint8(_BT_LT),
  22587. 61: uint8(_BT_EQUALS),
  22588. 62: uint8(_BT_GT),
  22589. 63: uint8(_BT_QUEST),
  22590. 64: uint8(_BT_OTHER),
  22591. 65: uint8(_BT_HEX),
  22592. 66: uint8(_BT_HEX),
  22593. 67: uint8(_BT_HEX),
  22594. 68: uint8(_BT_HEX),
  22595. 69: uint8(_BT_HEX),
  22596. 70: uint8(_BT_HEX),
  22597. 71: uint8(_BT_NMSTRT),
  22598. 72: uint8(_BT_NMSTRT),
  22599. 73: uint8(_BT_NMSTRT),
  22600. 74: uint8(_BT_NMSTRT),
  22601. 75: uint8(_BT_NMSTRT),
  22602. 76: uint8(_BT_NMSTRT),
  22603. 77: uint8(_BT_NMSTRT),
  22604. 78: uint8(_BT_NMSTRT),
  22605. 79: uint8(_BT_NMSTRT),
  22606. 80: uint8(_BT_NMSTRT),
  22607. 81: uint8(_BT_NMSTRT),
  22608. 82: uint8(_BT_NMSTRT),
  22609. 83: uint8(_BT_NMSTRT),
  22610. 84: uint8(_BT_NMSTRT),
  22611. 85: uint8(_BT_NMSTRT),
  22612. 86: uint8(_BT_NMSTRT),
  22613. 87: uint8(_BT_NMSTRT),
  22614. 88: uint8(_BT_NMSTRT),
  22615. 89: uint8(_BT_NMSTRT),
  22616. 90: uint8(_BT_NMSTRT),
  22617. 91: uint8(_BT_LSQB),
  22618. 92: uint8(_BT_OTHER),
  22619. 93: uint8(_BT_RSQB),
  22620. 94: uint8(_BT_OTHER),
  22621. 95: uint8(_BT_NMSTRT),
  22622. 96: uint8(_BT_OTHER),
  22623. 97: uint8(_BT_HEX),
  22624. 98: uint8(_BT_HEX),
  22625. 99: uint8(_BT_HEX),
  22626. 100: uint8(_BT_HEX),
  22627. 101: uint8(_BT_HEX),
  22628. 102: uint8(_BT_HEX),
  22629. 103: uint8(_BT_NMSTRT),
  22630. 104: uint8(_BT_NMSTRT),
  22631. 105: uint8(_BT_NMSTRT),
  22632. 106: uint8(_BT_NMSTRT),
  22633. 107: uint8(_BT_NMSTRT),
  22634. 108: uint8(_BT_NMSTRT),
  22635. 109: uint8(_BT_NMSTRT),
  22636. 110: uint8(_BT_NMSTRT),
  22637. 111: uint8(_BT_NMSTRT),
  22638. 112: uint8(_BT_NMSTRT),
  22639. 113: uint8(_BT_NMSTRT),
  22640. 114: uint8(_BT_NMSTRT),
  22641. 115: uint8(_BT_NMSTRT),
  22642. 116: uint8(_BT_NMSTRT),
  22643. 117: uint8(_BT_NMSTRT),
  22644. 118: uint8(_BT_NMSTRT),
  22645. 119: uint8(_BT_NMSTRT),
  22646. 120: uint8(_BT_NMSTRT),
  22647. 121: uint8(_BT_NMSTRT),
  22648. 122: uint8(_BT_NMSTRT),
  22649. 123: uint8(_BT_OTHER),
  22650. 124: uint8(_BT_VERBAR),
  22651. 125: uint8(_BT_OTHER),
  22652. 126: uint8(_BT_OTHER),
  22653. 127: uint8(_BT_OTHER),
  22654. 128: uint8(_BT_OTHER),
  22655. 129: uint8(_BT_OTHER),
  22656. 130: uint8(_BT_OTHER),
  22657. 131: uint8(_BT_OTHER),
  22658. 132: uint8(_BT_OTHER),
  22659. 133: uint8(_BT_OTHER),
  22660. 134: uint8(_BT_OTHER),
  22661. 135: uint8(_BT_OTHER),
  22662. 136: uint8(_BT_OTHER),
  22663. 137: uint8(_BT_OTHER),
  22664. 138: uint8(_BT_OTHER),
  22665. 139: uint8(_BT_OTHER),
  22666. 140: uint8(_BT_OTHER),
  22667. 141: uint8(_BT_OTHER),
  22668. 142: uint8(_BT_OTHER),
  22669. 143: uint8(_BT_OTHER),
  22670. 144: uint8(_BT_OTHER),
  22671. 145: uint8(_BT_OTHER),
  22672. 146: uint8(_BT_OTHER),
  22673. 147: uint8(_BT_OTHER),
  22674. 148: uint8(_BT_OTHER),
  22675. 149: uint8(_BT_OTHER),
  22676. 150: uint8(_BT_OTHER),
  22677. 151: uint8(_BT_OTHER),
  22678. 152: uint8(_BT_OTHER),
  22679. 153: uint8(_BT_OTHER),
  22680. 154: uint8(_BT_OTHER),
  22681. 155: uint8(_BT_OTHER),
  22682. 156: uint8(_BT_OTHER),
  22683. 157: uint8(_BT_OTHER),
  22684. 158: uint8(_BT_OTHER),
  22685. 159: uint8(_BT_OTHER),
  22686. 160: uint8(_BT_OTHER),
  22687. 161: uint8(_BT_OTHER),
  22688. 162: uint8(_BT_OTHER),
  22689. 163: uint8(_BT_OTHER),
  22690. 164: uint8(_BT_OTHER),
  22691. 165: uint8(_BT_OTHER),
  22692. 166: uint8(_BT_OTHER),
  22693. 167: uint8(_BT_OTHER),
  22694. 168: uint8(_BT_OTHER),
  22695. 169: uint8(_BT_OTHER),
  22696. 170: uint8(_BT_NMSTRT),
  22697. 171: uint8(_BT_OTHER),
  22698. 172: uint8(_BT_OTHER),
  22699. 173: uint8(_BT_OTHER),
  22700. 174: uint8(_BT_OTHER),
  22701. 175: uint8(_BT_OTHER),
  22702. 176: uint8(_BT_OTHER),
  22703. 177: uint8(_BT_OTHER),
  22704. 178: uint8(_BT_OTHER),
  22705. 179: uint8(_BT_OTHER),
  22706. 180: uint8(_BT_OTHER),
  22707. 181: uint8(_BT_NMSTRT),
  22708. 182: uint8(_BT_OTHER),
  22709. 183: uint8(_BT_NAME),
  22710. 184: uint8(_BT_OTHER),
  22711. 185: uint8(_BT_OTHER),
  22712. 186: uint8(_BT_NMSTRT),
  22713. 187: uint8(_BT_OTHER),
  22714. 188: uint8(_BT_OTHER),
  22715. 189: uint8(_BT_OTHER),
  22716. 190: uint8(_BT_OTHER),
  22717. 191: uint8(_BT_OTHER),
  22718. 192: uint8(_BT_NMSTRT),
  22719. 193: uint8(_BT_NMSTRT),
  22720. 194: uint8(_BT_NMSTRT),
  22721. 195: uint8(_BT_NMSTRT),
  22722. 196: uint8(_BT_NMSTRT),
  22723. 197: uint8(_BT_NMSTRT),
  22724. 198: uint8(_BT_NMSTRT),
  22725. 199: uint8(_BT_NMSTRT),
  22726. 200: uint8(_BT_NMSTRT),
  22727. 201: uint8(_BT_NMSTRT),
  22728. 202: uint8(_BT_NMSTRT),
  22729. 203: uint8(_BT_NMSTRT),
  22730. 204: uint8(_BT_NMSTRT),
  22731. 205: uint8(_BT_NMSTRT),
  22732. 206: uint8(_BT_NMSTRT),
  22733. 207: uint8(_BT_NMSTRT),
  22734. 208: uint8(_BT_NMSTRT),
  22735. 209: uint8(_BT_NMSTRT),
  22736. 210: uint8(_BT_NMSTRT),
  22737. 211: uint8(_BT_NMSTRT),
  22738. 212: uint8(_BT_NMSTRT),
  22739. 213: uint8(_BT_NMSTRT),
  22740. 214: uint8(_BT_NMSTRT),
  22741. 215: uint8(_BT_OTHER),
  22742. 216: uint8(_BT_NMSTRT),
  22743. 217: uint8(_BT_NMSTRT),
  22744. 218: uint8(_BT_NMSTRT),
  22745. 219: uint8(_BT_NMSTRT),
  22746. 220: uint8(_BT_NMSTRT),
  22747. 221: uint8(_BT_NMSTRT),
  22748. 222: uint8(_BT_NMSTRT),
  22749. 223: uint8(_BT_NMSTRT),
  22750. 224: uint8(_BT_NMSTRT),
  22751. 225: uint8(_BT_NMSTRT),
  22752. 226: uint8(_BT_NMSTRT),
  22753. 227: uint8(_BT_NMSTRT),
  22754. 228: uint8(_BT_NMSTRT),
  22755. 229: uint8(_BT_NMSTRT),
  22756. 230: uint8(_BT_NMSTRT),
  22757. 231: uint8(_BT_NMSTRT),
  22758. 232: uint8(_BT_NMSTRT),
  22759. 233: uint8(_BT_NMSTRT),
  22760. 234: uint8(_BT_NMSTRT),
  22761. 235: uint8(_BT_NMSTRT),
  22762. 236: uint8(_BT_NMSTRT),
  22763. 237: uint8(_BT_NMSTRT),
  22764. 238: uint8(_BT_NMSTRT),
  22765. 239: uint8(_BT_NMSTRT),
  22766. 240: uint8(_BT_NMSTRT),
  22767. 241: uint8(_BT_NMSTRT),
  22768. 242: uint8(_BT_NMSTRT),
  22769. 243: uint8(_BT_NMSTRT),
  22770. 244: uint8(_BT_NMSTRT),
  22771. 245: uint8(_BT_NMSTRT),
  22772. 246: uint8(_BT_NMSTRT),
  22773. 247: uint8(_BT_OTHER),
  22774. 248: uint8(_BT_NMSTRT),
  22775. 249: uint8(_BT_NMSTRT),
  22776. 250: uint8(_BT_NMSTRT),
  22777. 251: uint8(_BT_NMSTRT),
  22778. 252: uint8(_BT_NMSTRT),
  22779. 253: uint8(_BT_NMSTRT),
  22780. 254: uint8(_BT_NMSTRT),
  22781. 255: uint8(_BT_NMSTRT),
  22782. },
  22783. }
  22784. func init() {
  22785. p := unsafe.Pointer(&_little2_encoding)
  22786. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  22787. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_contentTok)
  22788. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_cdataSectionTok)
  22789. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_ignoreSectionTok)
  22790. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_attributeValueTok)
  22791. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_entityValueTok)
  22792. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_nameMatchesAscii)
  22793. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_nameLength)
  22794. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_little2_skipS)
  22795. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_little2_getAtts)
  22796. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_little2_charRefNumber)
  22797. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_little2_predefinedEntityName)
  22798. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_little2_updatePosition)
  22799. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_little2_isPublicId)
  22800. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_little2_toUtf8)
  22801. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_little2_toUtf16)
  22802. }
  22803. var _internal_little2_encoding_ns = Tnormal_encoding{
  22804. Fenc: TENCODING{
  22805. Fscanners: [4]TSCANNER{},
  22806. FliteralScanners: [2]TSCANNER{},
  22807. FminBytesPerChar: int32(2),
  22808. FisUtf16: int8(1),
  22809. },
  22810. Ftype1: [256]uint8{
  22811. 9: uint8(_BT_S),
  22812. 10: uint8(_BT_LF),
  22813. 13: uint8(_BT_S),
  22814. 32: uint8(_BT_S),
  22815. 33: uint8(_BT_EXCL),
  22816. 34: uint8(_BT_QUOT),
  22817. 35: uint8(_BT_NUM),
  22818. 36: uint8(_BT_OTHER),
  22819. 37: uint8(_BT_PERCNT),
  22820. 38: uint8(_BT_AMP),
  22821. 39: uint8(_BT_APOS),
  22822. 40: uint8(_BT_LPAR),
  22823. 41: uint8(_BT_RPAR),
  22824. 42: uint8(_BT_AST),
  22825. 43: uint8(_BT_PLUS),
  22826. 44: uint8(_BT_COMMA),
  22827. 45: uint8(_BT_MINUS),
  22828. 46: uint8(_BT_NAME),
  22829. 47: uint8(_BT_SOL),
  22830. 48: uint8(_BT_DIGIT),
  22831. 49: uint8(_BT_DIGIT),
  22832. 50: uint8(_BT_DIGIT),
  22833. 51: uint8(_BT_DIGIT),
  22834. 52: uint8(_BT_DIGIT),
  22835. 53: uint8(_BT_DIGIT),
  22836. 54: uint8(_BT_DIGIT),
  22837. 55: uint8(_BT_DIGIT),
  22838. 56: uint8(_BT_DIGIT),
  22839. 57: uint8(_BT_DIGIT),
  22840. 58: uint8(_BT_COLON),
  22841. 59: uint8(_BT_SEMI),
  22842. 60: uint8(_BT_LT),
  22843. 61: uint8(_BT_EQUALS),
  22844. 62: uint8(_BT_GT),
  22845. 63: uint8(_BT_QUEST),
  22846. 64: uint8(_BT_OTHER),
  22847. 65: uint8(_BT_HEX),
  22848. 66: uint8(_BT_HEX),
  22849. 67: uint8(_BT_HEX),
  22850. 68: uint8(_BT_HEX),
  22851. 69: uint8(_BT_HEX),
  22852. 70: uint8(_BT_HEX),
  22853. 71: uint8(_BT_NMSTRT),
  22854. 72: uint8(_BT_NMSTRT),
  22855. 73: uint8(_BT_NMSTRT),
  22856. 74: uint8(_BT_NMSTRT),
  22857. 75: uint8(_BT_NMSTRT),
  22858. 76: uint8(_BT_NMSTRT),
  22859. 77: uint8(_BT_NMSTRT),
  22860. 78: uint8(_BT_NMSTRT),
  22861. 79: uint8(_BT_NMSTRT),
  22862. 80: uint8(_BT_NMSTRT),
  22863. 81: uint8(_BT_NMSTRT),
  22864. 82: uint8(_BT_NMSTRT),
  22865. 83: uint8(_BT_NMSTRT),
  22866. 84: uint8(_BT_NMSTRT),
  22867. 85: uint8(_BT_NMSTRT),
  22868. 86: uint8(_BT_NMSTRT),
  22869. 87: uint8(_BT_NMSTRT),
  22870. 88: uint8(_BT_NMSTRT),
  22871. 89: uint8(_BT_NMSTRT),
  22872. 90: uint8(_BT_NMSTRT),
  22873. 91: uint8(_BT_LSQB),
  22874. 92: uint8(_BT_OTHER),
  22875. 93: uint8(_BT_RSQB),
  22876. 94: uint8(_BT_OTHER),
  22877. 95: uint8(_BT_NMSTRT),
  22878. 96: uint8(_BT_OTHER),
  22879. 97: uint8(_BT_HEX),
  22880. 98: uint8(_BT_HEX),
  22881. 99: uint8(_BT_HEX),
  22882. 100: uint8(_BT_HEX),
  22883. 101: uint8(_BT_HEX),
  22884. 102: uint8(_BT_HEX),
  22885. 103: uint8(_BT_NMSTRT),
  22886. 104: uint8(_BT_NMSTRT),
  22887. 105: uint8(_BT_NMSTRT),
  22888. 106: uint8(_BT_NMSTRT),
  22889. 107: uint8(_BT_NMSTRT),
  22890. 108: uint8(_BT_NMSTRT),
  22891. 109: uint8(_BT_NMSTRT),
  22892. 110: uint8(_BT_NMSTRT),
  22893. 111: uint8(_BT_NMSTRT),
  22894. 112: uint8(_BT_NMSTRT),
  22895. 113: uint8(_BT_NMSTRT),
  22896. 114: uint8(_BT_NMSTRT),
  22897. 115: uint8(_BT_NMSTRT),
  22898. 116: uint8(_BT_NMSTRT),
  22899. 117: uint8(_BT_NMSTRT),
  22900. 118: uint8(_BT_NMSTRT),
  22901. 119: uint8(_BT_NMSTRT),
  22902. 120: uint8(_BT_NMSTRT),
  22903. 121: uint8(_BT_NMSTRT),
  22904. 122: uint8(_BT_NMSTRT),
  22905. 123: uint8(_BT_OTHER),
  22906. 124: uint8(_BT_VERBAR),
  22907. 125: uint8(_BT_OTHER),
  22908. 126: uint8(_BT_OTHER),
  22909. 127: uint8(_BT_OTHER),
  22910. 128: uint8(_BT_OTHER),
  22911. 129: uint8(_BT_OTHER),
  22912. 130: uint8(_BT_OTHER),
  22913. 131: uint8(_BT_OTHER),
  22914. 132: uint8(_BT_OTHER),
  22915. 133: uint8(_BT_OTHER),
  22916. 134: uint8(_BT_OTHER),
  22917. 135: uint8(_BT_OTHER),
  22918. 136: uint8(_BT_OTHER),
  22919. 137: uint8(_BT_OTHER),
  22920. 138: uint8(_BT_OTHER),
  22921. 139: uint8(_BT_OTHER),
  22922. 140: uint8(_BT_OTHER),
  22923. 141: uint8(_BT_OTHER),
  22924. 142: uint8(_BT_OTHER),
  22925. 143: uint8(_BT_OTHER),
  22926. 144: uint8(_BT_OTHER),
  22927. 145: uint8(_BT_OTHER),
  22928. 146: uint8(_BT_OTHER),
  22929. 147: uint8(_BT_OTHER),
  22930. 148: uint8(_BT_OTHER),
  22931. 149: uint8(_BT_OTHER),
  22932. 150: uint8(_BT_OTHER),
  22933. 151: uint8(_BT_OTHER),
  22934. 152: uint8(_BT_OTHER),
  22935. 153: uint8(_BT_OTHER),
  22936. 154: uint8(_BT_OTHER),
  22937. 155: uint8(_BT_OTHER),
  22938. 156: uint8(_BT_OTHER),
  22939. 157: uint8(_BT_OTHER),
  22940. 158: uint8(_BT_OTHER),
  22941. 159: uint8(_BT_OTHER),
  22942. 160: uint8(_BT_OTHER),
  22943. 161: uint8(_BT_OTHER),
  22944. 162: uint8(_BT_OTHER),
  22945. 163: uint8(_BT_OTHER),
  22946. 164: uint8(_BT_OTHER),
  22947. 165: uint8(_BT_OTHER),
  22948. 166: uint8(_BT_OTHER),
  22949. 167: uint8(_BT_OTHER),
  22950. 168: uint8(_BT_OTHER),
  22951. 169: uint8(_BT_OTHER),
  22952. 170: uint8(_BT_NMSTRT),
  22953. 171: uint8(_BT_OTHER),
  22954. 172: uint8(_BT_OTHER),
  22955. 173: uint8(_BT_OTHER),
  22956. 174: uint8(_BT_OTHER),
  22957. 175: uint8(_BT_OTHER),
  22958. 176: uint8(_BT_OTHER),
  22959. 177: uint8(_BT_OTHER),
  22960. 178: uint8(_BT_OTHER),
  22961. 179: uint8(_BT_OTHER),
  22962. 180: uint8(_BT_OTHER),
  22963. 181: uint8(_BT_NMSTRT),
  22964. 182: uint8(_BT_OTHER),
  22965. 183: uint8(_BT_NAME),
  22966. 184: uint8(_BT_OTHER),
  22967. 185: uint8(_BT_OTHER),
  22968. 186: uint8(_BT_NMSTRT),
  22969. 187: uint8(_BT_OTHER),
  22970. 188: uint8(_BT_OTHER),
  22971. 189: uint8(_BT_OTHER),
  22972. 190: uint8(_BT_OTHER),
  22973. 191: uint8(_BT_OTHER),
  22974. 192: uint8(_BT_NMSTRT),
  22975. 193: uint8(_BT_NMSTRT),
  22976. 194: uint8(_BT_NMSTRT),
  22977. 195: uint8(_BT_NMSTRT),
  22978. 196: uint8(_BT_NMSTRT),
  22979. 197: uint8(_BT_NMSTRT),
  22980. 198: uint8(_BT_NMSTRT),
  22981. 199: uint8(_BT_NMSTRT),
  22982. 200: uint8(_BT_NMSTRT),
  22983. 201: uint8(_BT_NMSTRT),
  22984. 202: uint8(_BT_NMSTRT),
  22985. 203: uint8(_BT_NMSTRT),
  22986. 204: uint8(_BT_NMSTRT),
  22987. 205: uint8(_BT_NMSTRT),
  22988. 206: uint8(_BT_NMSTRT),
  22989. 207: uint8(_BT_NMSTRT),
  22990. 208: uint8(_BT_NMSTRT),
  22991. 209: uint8(_BT_NMSTRT),
  22992. 210: uint8(_BT_NMSTRT),
  22993. 211: uint8(_BT_NMSTRT),
  22994. 212: uint8(_BT_NMSTRT),
  22995. 213: uint8(_BT_NMSTRT),
  22996. 214: uint8(_BT_NMSTRT),
  22997. 215: uint8(_BT_OTHER),
  22998. 216: uint8(_BT_NMSTRT),
  22999. 217: uint8(_BT_NMSTRT),
  23000. 218: uint8(_BT_NMSTRT),
  23001. 219: uint8(_BT_NMSTRT),
  23002. 220: uint8(_BT_NMSTRT),
  23003. 221: uint8(_BT_NMSTRT),
  23004. 222: uint8(_BT_NMSTRT),
  23005. 223: uint8(_BT_NMSTRT),
  23006. 224: uint8(_BT_NMSTRT),
  23007. 225: uint8(_BT_NMSTRT),
  23008. 226: uint8(_BT_NMSTRT),
  23009. 227: uint8(_BT_NMSTRT),
  23010. 228: uint8(_BT_NMSTRT),
  23011. 229: uint8(_BT_NMSTRT),
  23012. 230: uint8(_BT_NMSTRT),
  23013. 231: uint8(_BT_NMSTRT),
  23014. 232: uint8(_BT_NMSTRT),
  23015. 233: uint8(_BT_NMSTRT),
  23016. 234: uint8(_BT_NMSTRT),
  23017. 235: uint8(_BT_NMSTRT),
  23018. 236: uint8(_BT_NMSTRT),
  23019. 237: uint8(_BT_NMSTRT),
  23020. 238: uint8(_BT_NMSTRT),
  23021. 239: uint8(_BT_NMSTRT),
  23022. 240: uint8(_BT_NMSTRT),
  23023. 241: uint8(_BT_NMSTRT),
  23024. 242: uint8(_BT_NMSTRT),
  23025. 243: uint8(_BT_NMSTRT),
  23026. 244: uint8(_BT_NMSTRT),
  23027. 245: uint8(_BT_NMSTRT),
  23028. 246: uint8(_BT_NMSTRT),
  23029. 247: uint8(_BT_OTHER),
  23030. 248: uint8(_BT_NMSTRT),
  23031. 249: uint8(_BT_NMSTRT),
  23032. 250: uint8(_BT_NMSTRT),
  23033. 251: uint8(_BT_NMSTRT),
  23034. 252: uint8(_BT_NMSTRT),
  23035. 253: uint8(_BT_NMSTRT),
  23036. 254: uint8(_BT_NMSTRT),
  23037. 255: uint8(_BT_NMSTRT),
  23038. },
  23039. }
  23040. func init() {
  23041. p := unsafe.Pointer(&_internal_little2_encoding_ns)
  23042. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  23043. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_contentTok)
  23044. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_cdataSectionTok)
  23045. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_ignoreSectionTok)
  23046. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_attributeValueTok)
  23047. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_entityValueTok)
  23048. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_nameMatchesAscii)
  23049. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_nameLength)
  23050. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_little2_skipS)
  23051. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_little2_getAtts)
  23052. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_little2_charRefNumber)
  23053. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_little2_predefinedEntityName)
  23054. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_little2_updatePosition)
  23055. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_little2_isPublicId)
  23056. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_little2_toUtf8)
  23057. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_little2_toUtf16)
  23058. }
  23059. var _internal_little2_encoding = Tnormal_encoding{
  23060. Fenc: TENCODING{
  23061. Fscanners: [4]TSCANNER{},
  23062. FliteralScanners: [2]TSCANNER{},
  23063. FminBytesPerChar: int32(2),
  23064. FisUtf16: int8(1),
  23065. },
  23066. Ftype1: [256]uint8{
  23067. 9: uint8(_BT_S),
  23068. 10: uint8(_BT_LF),
  23069. 13: uint8(_BT_S),
  23070. 32: uint8(_BT_S),
  23071. 33: uint8(_BT_EXCL),
  23072. 34: uint8(_BT_QUOT),
  23073. 35: uint8(_BT_NUM),
  23074. 36: uint8(_BT_OTHER),
  23075. 37: uint8(_BT_PERCNT),
  23076. 38: uint8(_BT_AMP),
  23077. 39: uint8(_BT_APOS),
  23078. 40: uint8(_BT_LPAR),
  23079. 41: uint8(_BT_RPAR),
  23080. 42: uint8(_BT_AST),
  23081. 43: uint8(_BT_PLUS),
  23082. 44: uint8(_BT_COMMA),
  23083. 45: uint8(_BT_MINUS),
  23084. 46: uint8(_BT_NAME),
  23085. 47: uint8(_BT_SOL),
  23086. 48: uint8(_BT_DIGIT),
  23087. 49: uint8(_BT_DIGIT),
  23088. 50: uint8(_BT_DIGIT),
  23089. 51: uint8(_BT_DIGIT),
  23090. 52: uint8(_BT_DIGIT),
  23091. 53: uint8(_BT_DIGIT),
  23092. 54: uint8(_BT_DIGIT),
  23093. 55: uint8(_BT_DIGIT),
  23094. 56: uint8(_BT_DIGIT),
  23095. 57: uint8(_BT_DIGIT),
  23096. 58: uint8(_BT_NMSTRT),
  23097. 59: uint8(_BT_SEMI),
  23098. 60: uint8(_BT_LT),
  23099. 61: uint8(_BT_EQUALS),
  23100. 62: uint8(_BT_GT),
  23101. 63: uint8(_BT_QUEST),
  23102. 64: uint8(_BT_OTHER),
  23103. 65: uint8(_BT_HEX),
  23104. 66: uint8(_BT_HEX),
  23105. 67: uint8(_BT_HEX),
  23106. 68: uint8(_BT_HEX),
  23107. 69: uint8(_BT_HEX),
  23108. 70: uint8(_BT_HEX),
  23109. 71: uint8(_BT_NMSTRT),
  23110. 72: uint8(_BT_NMSTRT),
  23111. 73: uint8(_BT_NMSTRT),
  23112. 74: uint8(_BT_NMSTRT),
  23113. 75: uint8(_BT_NMSTRT),
  23114. 76: uint8(_BT_NMSTRT),
  23115. 77: uint8(_BT_NMSTRT),
  23116. 78: uint8(_BT_NMSTRT),
  23117. 79: uint8(_BT_NMSTRT),
  23118. 80: uint8(_BT_NMSTRT),
  23119. 81: uint8(_BT_NMSTRT),
  23120. 82: uint8(_BT_NMSTRT),
  23121. 83: uint8(_BT_NMSTRT),
  23122. 84: uint8(_BT_NMSTRT),
  23123. 85: uint8(_BT_NMSTRT),
  23124. 86: uint8(_BT_NMSTRT),
  23125. 87: uint8(_BT_NMSTRT),
  23126. 88: uint8(_BT_NMSTRT),
  23127. 89: uint8(_BT_NMSTRT),
  23128. 90: uint8(_BT_NMSTRT),
  23129. 91: uint8(_BT_LSQB),
  23130. 92: uint8(_BT_OTHER),
  23131. 93: uint8(_BT_RSQB),
  23132. 94: uint8(_BT_OTHER),
  23133. 95: uint8(_BT_NMSTRT),
  23134. 96: uint8(_BT_OTHER),
  23135. 97: uint8(_BT_HEX),
  23136. 98: uint8(_BT_HEX),
  23137. 99: uint8(_BT_HEX),
  23138. 100: uint8(_BT_HEX),
  23139. 101: uint8(_BT_HEX),
  23140. 102: uint8(_BT_HEX),
  23141. 103: uint8(_BT_NMSTRT),
  23142. 104: uint8(_BT_NMSTRT),
  23143. 105: uint8(_BT_NMSTRT),
  23144. 106: uint8(_BT_NMSTRT),
  23145. 107: uint8(_BT_NMSTRT),
  23146. 108: uint8(_BT_NMSTRT),
  23147. 109: uint8(_BT_NMSTRT),
  23148. 110: uint8(_BT_NMSTRT),
  23149. 111: uint8(_BT_NMSTRT),
  23150. 112: uint8(_BT_NMSTRT),
  23151. 113: uint8(_BT_NMSTRT),
  23152. 114: uint8(_BT_NMSTRT),
  23153. 115: uint8(_BT_NMSTRT),
  23154. 116: uint8(_BT_NMSTRT),
  23155. 117: uint8(_BT_NMSTRT),
  23156. 118: uint8(_BT_NMSTRT),
  23157. 119: uint8(_BT_NMSTRT),
  23158. 120: uint8(_BT_NMSTRT),
  23159. 121: uint8(_BT_NMSTRT),
  23160. 122: uint8(_BT_NMSTRT),
  23161. 123: uint8(_BT_OTHER),
  23162. 124: uint8(_BT_VERBAR),
  23163. 125: uint8(_BT_OTHER),
  23164. 126: uint8(_BT_OTHER),
  23165. 127: uint8(_BT_OTHER),
  23166. 128: uint8(_BT_OTHER),
  23167. 129: uint8(_BT_OTHER),
  23168. 130: uint8(_BT_OTHER),
  23169. 131: uint8(_BT_OTHER),
  23170. 132: uint8(_BT_OTHER),
  23171. 133: uint8(_BT_OTHER),
  23172. 134: uint8(_BT_OTHER),
  23173. 135: uint8(_BT_OTHER),
  23174. 136: uint8(_BT_OTHER),
  23175. 137: uint8(_BT_OTHER),
  23176. 138: uint8(_BT_OTHER),
  23177. 139: uint8(_BT_OTHER),
  23178. 140: uint8(_BT_OTHER),
  23179. 141: uint8(_BT_OTHER),
  23180. 142: uint8(_BT_OTHER),
  23181. 143: uint8(_BT_OTHER),
  23182. 144: uint8(_BT_OTHER),
  23183. 145: uint8(_BT_OTHER),
  23184. 146: uint8(_BT_OTHER),
  23185. 147: uint8(_BT_OTHER),
  23186. 148: uint8(_BT_OTHER),
  23187. 149: uint8(_BT_OTHER),
  23188. 150: uint8(_BT_OTHER),
  23189. 151: uint8(_BT_OTHER),
  23190. 152: uint8(_BT_OTHER),
  23191. 153: uint8(_BT_OTHER),
  23192. 154: uint8(_BT_OTHER),
  23193. 155: uint8(_BT_OTHER),
  23194. 156: uint8(_BT_OTHER),
  23195. 157: uint8(_BT_OTHER),
  23196. 158: uint8(_BT_OTHER),
  23197. 159: uint8(_BT_OTHER),
  23198. 160: uint8(_BT_OTHER),
  23199. 161: uint8(_BT_OTHER),
  23200. 162: uint8(_BT_OTHER),
  23201. 163: uint8(_BT_OTHER),
  23202. 164: uint8(_BT_OTHER),
  23203. 165: uint8(_BT_OTHER),
  23204. 166: uint8(_BT_OTHER),
  23205. 167: uint8(_BT_OTHER),
  23206. 168: uint8(_BT_OTHER),
  23207. 169: uint8(_BT_OTHER),
  23208. 170: uint8(_BT_NMSTRT),
  23209. 171: uint8(_BT_OTHER),
  23210. 172: uint8(_BT_OTHER),
  23211. 173: uint8(_BT_OTHER),
  23212. 174: uint8(_BT_OTHER),
  23213. 175: uint8(_BT_OTHER),
  23214. 176: uint8(_BT_OTHER),
  23215. 177: uint8(_BT_OTHER),
  23216. 178: uint8(_BT_OTHER),
  23217. 179: uint8(_BT_OTHER),
  23218. 180: uint8(_BT_OTHER),
  23219. 181: uint8(_BT_NMSTRT),
  23220. 182: uint8(_BT_OTHER),
  23221. 183: uint8(_BT_NAME),
  23222. 184: uint8(_BT_OTHER),
  23223. 185: uint8(_BT_OTHER),
  23224. 186: uint8(_BT_NMSTRT),
  23225. 187: uint8(_BT_OTHER),
  23226. 188: uint8(_BT_OTHER),
  23227. 189: uint8(_BT_OTHER),
  23228. 190: uint8(_BT_OTHER),
  23229. 191: uint8(_BT_OTHER),
  23230. 192: uint8(_BT_NMSTRT),
  23231. 193: uint8(_BT_NMSTRT),
  23232. 194: uint8(_BT_NMSTRT),
  23233. 195: uint8(_BT_NMSTRT),
  23234. 196: uint8(_BT_NMSTRT),
  23235. 197: uint8(_BT_NMSTRT),
  23236. 198: uint8(_BT_NMSTRT),
  23237. 199: uint8(_BT_NMSTRT),
  23238. 200: uint8(_BT_NMSTRT),
  23239. 201: uint8(_BT_NMSTRT),
  23240. 202: uint8(_BT_NMSTRT),
  23241. 203: uint8(_BT_NMSTRT),
  23242. 204: uint8(_BT_NMSTRT),
  23243. 205: uint8(_BT_NMSTRT),
  23244. 206: uint8(_BT_NMSTRT),
  23245. 207: uint8(_BT_NMSTRT),
  23246. 208: uint8(_BT_NMSTRT),
  23247. 209: uint8(_BT_NMSTRT),
  23248. 210: uint8(_BT_NMSTRT),
  23249. 211: uint8(_BT_NMSTRT),
  23250. 212: uint8(_BT_NMSTRT),
  23251. 213: uint8(_BT_NMSTRT),
  23252. 214: uint8(_BT_NMSTRT),
  23253. 215: uint8(_BT_OTHER),
  23254. 216: uint8(_BT_NMSTRT),
  23255. 217: uint8(_BT_NMSTRT),
  23256. 218: uint8(_BT_NMSTRT),
  23257. 219: uint8(_BT_NMSTRT),
  23258. 220: uint8(_BT_NMSTRT),
  23259. 221: uint8(_BT_NMSTRT),
  23260. 222: uint8(_BT_NMSTRT),
  23261. 223: uint8(_BT_NMSTRT),
  23262. 224: uint8(_BT_NMSTRT),
  23263. 225: uint8(_BT_NMSTRT),
  23264. 226: uint8(_BT_NMSTRT),
  23265. 227: uint8(_BT_NMSTRT),
  23266. 228: uint8(_BT_NMSTRT),
  23267. 229: uint8(_BT_NMSTRT),
  23268. 230: uint8(_BT_NMSTRT),
  23269. 231: uint8(_BT_NMSTRT),
  23270. 232: uint8(_BT_NMSTRT),
  23271. 233: uint8(_BT_NMSTRT),
  23272. 234: uint8(_BT_NMSTRT),
  23273. 235: uint8(_BT_NMSTRT),
  23274. 236: uint8(_BT_NMSTRT),
  23275. 237: uint8(_BT_NMSTRT),
  23276. 238: uint8(_BT_NMSTRT),
  23277. 239: uint8(_BT_NMSTRT),
  23278. 240: uint8(_BT_NMSTRT),
  23279. 241: uint8(_BT_NMSTRT),
  23280. 242: uint8(_BT_NMSTRT),
  23281. 243: uint8(_BT_NMSTRT),
  23282. 244: uint8(_BT_NMSTRT),
  23283. 245: uint8(_BT_NMSTRT),
  23284. 246: uint8(_BT_NMSTRT),
  23285. 247: uint8(_BT_OTHER),
  23286. 248: uint8(_BT_NMSTRT),
  23287. 249: uint8(_BT_NMSTRT),
  23288. 250: uint8(_BT_NMSTRT),
  23289. 251: uint8(_BT_NMSTRT),
  23290. 252: uint8(_BT_NMSTRT),
  23291. 253: uint8(_BT_NMSTRT),
  23292. 254: uint8(_BT_NMSTRT),
  23293. 255: uint8(_BT_NMSTRT),
  23294. },
  23295. }
  23296. func init() {
  23297. p := unsafe.Pointer(&_internal_little2_encoding)
  23298. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  23299. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_contentTok)
  23300. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_cdataSectionTok)
  23301. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_ignoreSectionTok)
  23302. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_attributeValueTok)
  23303. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_entityValueTok)
  23304. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_nameMatchesAscii)
  23305. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_nameLength)
  23306. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_little2_skipS)
  23307. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_little2_getAtts)
  23308. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_little2_charRefNumber)
  23309. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_little2_predefinedEntityName)
  23310. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_little2_updatePosition)
  23311. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_little2_isPublicId)
  23312. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_little2_toUtf8)
  23313. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_little2_toUtf16)
  23314. }
  23315. /* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
  23316. /* This file is included (from xmltok.c, 1-3 times depending on XML_MIN_SIZE)!
  23317. __ __ _
  23318. ___\ \/ /_ __ __ _| |_
  23319. / _ \\ /| '_ \ / _` | __|
  23320. | __// \| |_) | (_| | |_
  23321. \___/_/\_\ .__/ \__,_|\__|
  23322. |_| XML parser
  23323. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  23324. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  23325. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  23326. Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
  23327. Copyright (c) 2016-2022 Sebastian Pipping <sebastian@pipping.org>
  23328. Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
  23329. Copyright (c) 2018 Benjamin Peterson <benjamin@python.org>
  23330. Copyright (c) 2018 Anton Maklakov <antmak.pub@gmail.com>
  23331. Copyright (c) 2019 David Loffredo <loffredo@steptools.com>
  23332. Copyright (c) 2020 Boris Kolpackov <boris@codesynthesis.com>
  23333. Copyright (c) 2022 Martin Ettl <ettl.martin78@googlemail.com>
  23334. Licensed under the MIT license:
  23335. Permission is hereby granted, free of charge, to any person obtaining
  23336. a copy of this software and associated documentation files (the
  23337. "Software"), to deal in the Software without restriction, including
  23338. without limitation the rights to use, copy, modify, merge, publish,
  23339. distribute, sublicense, and/or sell copies of the Software, and to permit
  23340. persons to whom the Software is furnished to do so, subject to the
  23341. following conditions:
  23342. The above copyright notice and this permission notice shall be included
  23343. in all copies or substantial portions of the Software.
  23344. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  23345. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23346. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  23347. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  23348. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  23349. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  23350. USE OR OTHER DEALINGS IN THE SOFTWARE.
  23351. */
  23352. /* ptr points to character following "<!-" */
  23353. func _big2_scanComment(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23354. var v1 int32
  23355. _ = v1
  23356. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23357. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_MINUS1)) {
  23358. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23359. return m_XML_TOK_INVALID
  23360. }
  23361. ptr += uintptr(2)
  23362. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23363. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23364. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23365. } else {
  23366. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23367. }
  23368. switch v1 {
  23369. case int32(_BT_LEAD2):
  23370. if int64(end)-int64(ptr) < int64(2) {
  23371. return -int32(2)
  23372. }
  23373. if 0 != 0 {
  23374. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23375. return m_XML_TOK_INVALID
  23376. }
  23377. ptr += uintptr(2)
  23378. case int32(_BT_LEAD3):
  23379. if int64(end)-int64(ptr) < int64(3) {
  23380. return -int32(2)
  23381. }
  23382. if 0 != 0 {
  23383. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23384. return m_XML_TOK_INVALID
  23385. }
  23386. ptr += uintptr(3)
  23387. case int32(_BT_LEAD4):
  23388. if int64(end)-int64(ptr) < int64(4) {
  23389. return -int32(2)
  23390. }
  23391. if 0 != 0 {
  23392. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23393. return m_XML_TOK_INVALID
  23394. }
  23395. ptr += uintptr(4)
  23396. case int32(_BT_NONXML):
  23397. fallthrough
  23398. case int32(_BT_MALFORM):
  23399. fallthrough
  23400. case int32(_BT_TRAIL):
  23401. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23402. return m_XML_TOK_INVALID
  23403. case int32(_BT_MINUS):
  23404. ptr += uintptr(2)
  23405. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23406. return -int32(1)
  23407. }
  23408. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_MINUS1) {
  23409. ptr += uintptr(2)
  23410. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23411. return -int32(1)
  23412. }
  23413. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  23414. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23415. return m_XML_TOK_INVALID
  23416. }
  23417. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23418. return int32(m_XML_TOK_COMMENT)
  23419. }
  23420. default:
  23421. ptr += uintptr(2)
  23422. break
  23423. }
  23424. }
  23425. }
  23426. return -int32(1)
  23427. }
  23428. /* ptr points to character following "<!" */
  23429. func _big2_scanDecl(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23430. var v1, v2, v3 int32
  23431. _, _, _ = v1, v2, v3
  23432. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23433. return -int32(1)
  23434. }
  23435. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23436. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23437. } else {
  23438. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23439. }
  23440. switch v1 {
  23441. case int32(_BT_MINUS):
  23442. return _big2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  23443. case int32(_BT_LSQB):
  23444. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23445. return int32(m_XML_TOK_COND_SECT_OPEN)
  23446. case int32(_BT_NMSTRT):
  23447. fallthrough
  23448. case int32(_BT_HEX):
  23449. ptr += uintptr(2)
  23450. default:
  23451. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23452. return m_XML_TOK_INVALID
  23453. }
  23454. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23455. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23456. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23457. } else {
  23458. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23459. }
  23460. switch v2 {
  23461. case int32(_BT_PERCNT):
  23462. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  23463. return -int32(1)
  23464. }
  23465. /* don't allow <!ENTITY% foo "whatever"> */
  23466. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 {
  23467. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))))))
  23468. } else {
  23469. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))), *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))
  23470. }
  23471. switch v3 {
  23472. case int32(_BT_S):
  23473. fallthrough
  23474. case int32(_BT_CR):
  23475. fallthrough
  23476. case int32(_BT_LF):
  23477. fallthrough
  23478. case int32(_BT_PERCNT):
  23479. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23480. return m_XML_TOK_INVALID
  23481. }
  23482. /* fall through */
  23483. fallthrough
  23484. case int32(_BT_S):
  23485. fallthrough
  23486. case int32(_BT_CR):
  23487. fallthrough
  23488. case int32(_BT_LF):
  23489. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23490. return int32(m_XML_TOK_DECL_OPEN)
  23491. case int32(_BT_NMSTRT):
  23492. fallthrough
  23493. case int32(_BT_HEX):
  23494. ptr += uintptr(2)
  23495. default:
  23496. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23497. return m_XML_TOK_INVALID
  23498. }
  23499. }
  23500. return -int32(1)
  23501. }
  23502. func _big2_checkPiTarget(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, tokPtr uintptr) (r int32) {
  23503. var upper, v1, v2, v3 int32
  23504. _, _, _, _ = upper, v1, v2, v3
  23505. upper = 0
  23506. _ = enc
  23507. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_PI)
  23508. if int64(end)-int64(ptr) != int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(3)) {
  23509. return int32(1)
  23510. }
  23511. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23512. v1 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  23513. } else {
  23514. v1 = -int32(1)
  23515. }
  23516. switch v1 {
  23517. case int32(m_ASCII_x2):
  23518. case int32(m_ASCII_X):
  23519. upper = int32(1)
  23520. default:
  23521. return int32(1)
  23522. }
  23523. ptr += uintptr(2)
  23524. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23525. v2 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  23526. } else {
  23527. v2 = -int32(1)
  23528. }
  23529. switch v2 {
  23530. case int32(m_ASCII_m2):
  23531. case int32(m_ASCII_M):
  23532. upper = int32(1)
  23533. default:
  23534. return int32(1)
  23535. }
  23536. ptr += uintptr(2)
  23537. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23538. v3 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  23539. } else {
  23540. v3 = -int32(1)
  23541. }
  23542. switch v3 {
  23543. case int32(m_ASCII_l2):
  23544. case int32(m_ASCII_L):
  23545. upper = int32(1)
  23546. default:
  23547. return int32(1)
  23548. }
  23549. if upper != 0 {
  23550. return 0
  23551. }
  23552. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_XML_DECL)
  23553. return int32(1)
  23554. }
  23555. /* ptr points to character following "<?" */
  23556. func _big2_scanPi(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23557. bp := tls.Alloc(16)
  23558. defer tls.Free(16)
  23559. var target uintptr
  23560. var v1, v2, v3 int32
  23561. var _ /* tok at bp+0 */ int32
  23562. _, _, _, _ = target, v1, v2, v3
  23563. target = ptr
  23564. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23565. return -int32(1)
  23566. }
  23567. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23568. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23569. } else {
  23570. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23571. }
  23572. switch v1 {
  23573. case int32(_BT_NONASCII):
  23574. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  23575. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23576. return m_XML_TOK_INVALID
  23577. } /* fall through */
  23578. fallthrough
  23579. case int32(_BT_NMSTRT):
  23580. fallthrough
  23581. case int32(_BT_HEX):
  23582. ptr += uintptr(2)
  23583. case int32(_BT_LEAD2):
  23584. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  23585. return -int32(2)
  23586. }
  23587. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23588. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23589. return m_XML_TOK_INVALID
  23590. }
  23591. ptr += uintptr(2)
  23592. case int32(_BT_LEAD3):
  23593. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  23594. return -int32(2)
  23595. }
  23596. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23597. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23598. return m_XML_TOK_INVALID
  23599. }
  23600. ptr += uintptr(3)
  23601. case int32(_BT_LEAD4):
  23602. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  23603. return -int32(2)
  23604. }
  23605. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23606. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23607. return m_XML_TOK_INVALID
  23608. }
  23609. ptr += uintptr(4)
  23610. default:
  23611. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23612. return m_XML_TOK_INVALID
  23613. }
  23614. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23615. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23616. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23617. } else {
  23618. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23619. }
  23620. switch v2 {
  23621. case int32(_BT_NONASCII):
  23622. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  23623. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23624. return m_XML_TOK_INVALID
  23625. } /* fall through */
  23626. fallthrough
  23627. case int32(_BT_NMSTRT):
  23628. fallthrough
  23629. case int32(_BT_HEX):
  23630. fallthrough
  23631. case int32(_BT_DIGIT):
  23632. fallthrough
  23633. case int32(_BT_NAME):
  23634. fallthrough
  23635. case int32(_BT_MINUS):
  23636. ptr += uintptr(2)
  23637. case int32(_BT_LEAD2):
  23638. if int64(end)-int64(ptr) < int64(2) {
  23639. return -int32(2)
  23640. }
  23641. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23642. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23643. return m_XML_TOK_INVALID
  23644. }
  23645. ptr += uintptr(2)
  23646. case int32(_BT_LEAD3):
  23647. if int64(end)-int64(ptr) < int64(3) {
  23648. return -int32(2)
  23649. }
  23650. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23651. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23652. return m_XML_TOK_INVALID
  23653. }
  23654. ptr += uintptr(3)
  23655. case int32(_BT_LEAD4):
  23656. if int64(end)-int64(ptr) < int64(4) {
  23657. return -int32(2)
  23658. }
  23659. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23660. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23661. return m_XML_TOK_INVALID
  23662. }
  23663. ptr += uintptr(4)
  23664. case int32(_BT_S):
  23665. fallthrough
  23666. case int32(_BT_CR):
  23667. fallthrough
  23668. case int32(_BT_LF):
  23669. if !(_big2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  23670. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23671. return m_XML_TOK_INVALID
  23672. }
  23673. ptr += uintptr(2)
  23674. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23675. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23676. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23677. } else {
  23678. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23679. }
  23680. switch v3 {
  23681. case int32(_BT_LEAD2):
  23682. if int64(end)-int64(ptr) < int64(2) {
  23683. return -int32(2)
  23684. }
  23685. if 0 != 0 {
  23686. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23687. return m_XML_TOK_INVALID
  23688. }
  23689. ptr += uintptr(2)
  23690. case int32(_BT_LEAD3):
  23691. if int64(end)-int64(ptr) < int64(3) {
  23692. return -int32(2)
  23693. }
  23694. if 0 != 0 {
  23695. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23696. return m_XML_TOK_INVALID
  23697. }
  23698. ptr += uintptr(3)
  23699. case int32(_BT_LEAD4):
  23700. if int64(end)-int64(ptr) < int64(4) {
  23701. return -int32(2)
  23702. }
  23703. if 0 != 0 {
  23704. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23705. return m_XML_TOK_INVALID
  23706. }
  23707. ptr += uintptr(4)
  23708. case int32(_BT_NONXML):
  23709. fallthrough
  23710. case int32(_BT_MALFORM):
  23711. fallthrough
  23712. case int32(_BT_TRAIL):
  23713. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23714. return m_XML_TOK_INVALID
  23715. case int32(_BT_QUEST):
  23716. ptr += uintptr(2)
  23717. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23718. return -int32(1)
  23719. }
  23720. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1) {
  23721. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23722. return *(*int32)(unsafe.Pointer(bp))
  23723. }
  23724. default:
  23725. ptr += uintptr(2)
  23726. break
  23727. }
  23728. }
  23729. return -int32(1)
  23730. case int32(_BT_QUEST):
  23731. if !(_big2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  23732. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23733. return m_XML_TOK_INVALID
  23734. }
  23735. ptr += uintptr(2)
  23736. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23737. return -int32(1)
  23738. }
  23739. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1) {
  23740. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23741. return *(*int32)(unsafe.Pointer(bp))
  23742. }
  23743. /* fall through */
  23744. fallthrough
  23745. default:
  23746. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23747. return m_XML_TOK_INVALID
  23748. }
  23749. }
  23750. return -int32(1)
  23751. }
  23752. func _big2_scanCdataSection(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23753. var i int32
  23754. _ = i
  23755. _ = enc
  23756. /* CDATA[ */
  23757. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(6)*libc.Int32FromInt32(2))) {
  23758. return -int32(1)
  23759. }
  23760. i = 0
  23761. for {
  23762. if !(i < int32(6)) {
  23763. break
  23764. }
  23765. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(_CDATA_LSQB2[i])) {
  23766. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23767. return m_XML_TOK_INVALID
  23768. }
  23769. goto _1
  23770. _1:
  23771. ;
  23772. i++
  23773. ptr += uintptr(2)
  23774. }
  23775. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23776. return int32(m_XML_TOK_CDATA_SECT_OPEN)
  23777. }
  23778. var _CDATA_LSQB2 = [6]int8{
  23779. 0: int8(m_ASCII_C),
  23780. 1: int8(m_ASCII_D),
  23781. 2: int8(m_ASCII_A),
  23782. 3: int8(m_ASCII_T),
  23783. 4: int8(m_ASCII_A),
  23784. 5: int8(m_ASCII_LSQB1),
  23785. }
  23786. func _big2_cdataSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23787. var n Tsize_t
  23788. var v1, v2, v3 int32
  23789. _, _, _, _ = n, v1, v2, v3
  23790. if ptr >= end {
  23791. return -int32(4)
  23792. }
  23793. if int32(2) > int32(1) {
  23794. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  23795. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  23796. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  23797. if n == uint64(0) {
  23798. return -int32(1)
  23799. }
  23800. end = ptr + uintptr(n)
  23801. }
  23802. }
  23803. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23804. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23805. } else {
  23806. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23807. }
  23808. switch v1 {
  23809. case int32(_BT_RSQB):
  23810. ptr += uintptr(2)
  23811. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23812. return -int32(1)
  23813. }
  23814. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1)) {
  23815. break
  23816. }
  23817. ptr += uintptr(2)
  23818. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23819. return -int32(1)
  23820. }
  23821. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  23822. ptr -= uintptr(2)
  23823. break
  23824. }
  23825. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23826. return int32(m_XML_TOK_CDATA_SECT_CLOSE)
  23827. case int32(_BT_CR):
  23828. ptr += uintptr(2)
  23829. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23830. return -int32(1)
  23831. }
  23832. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23833. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23834. } else {
  23835. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23836. }
  23837. if v2 == int32(_BT_LF) {
  23838. ptr += uintptr(2)
  23839. }
  23840. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23841. return int32(m_XML_TOK_DATA_NEWLINE)
  23842. case int32(_BT_LF):
  23843. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23844. return int32(m_XML_TOK_DATA_NEWLINE)
  23845. case int32(_BT_LEAD2):
  23846. if int64(end)-int64(ptr) < int64(2) {
  23847. return -int32(2)
  23848. }
  23849. if 0 != 0 {
  23850. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23851. return m_XML_TOK_INVALID
  23852. }
  23853. ptr += uintptr(2)
  23854. case int32(_BT_LEAD3):
  23855. if int64(end)-int64(ptr) < int64(3) {
  23856. return -int32(2)
  23857. }
  23858. if 0 != 0 {
  23859. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23860. return m_XML_TOK_INVALID
  23861. }
  23862. ptr += uintptr(3)
  23863. case int32(_BT_LEAD4):
  23864. if int64(end)-int64(ptr) < int64(4) {
  23865. return -int32(2)
  23866. }
  23867. if 0 != 0 {
  23868. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23869. return m_XML_TOK_INVALID
  23870. }
  23871. ptr += uintptr(4)
  23872. case int32(_BT_NONXML):
  23873. fallthrough
  23874. case int32(_BT_MALFORM):
  23875. fallthrough
  23876. case int32(_BT_TRAIL):
  23877. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23878. return m_XML_TOK_INVALID
  23879. default:
  23880. ptr += uintptr(2)
  23881. break
  23882. }
  23883. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23884. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23885. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23886. } else {
  23887. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23888. }
  23889. switch v3 {
  23890. case int32(_BT_LEAD2):
  23891. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  23892. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23893. return int32(m_XML_TOK_DATA_CHARS)
  23894. }
  23895. ptr += uintptr(2)
  23896. case int32(_BT_LEAD3):
  23897. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  23898. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23899. return int32(m_XML_TOK_DATA_CHARS)
  23900. }
  23901. ptr += uintptr(3)
  23902. case int32(_BT_LEAD4):
  23903. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  23904. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23905. return int32(m_XML_TOK_DATA_CHARS)
  23906. }
  23907. ptr += uintptr(4)
  23908. case int32(_BT_NONXML):
  23909. fallthrough
  23910. case int32(_BT_MALFORM):
  23911. fallthrough
  23912. case int32(_BT_TRAIL):
  23913. fallthrough
  23914. case int32(_BT_CR):
  23915. fallthrough
  23916. case int32(_BT_LF):
  23917. fallthrough
  23918. case int32(_BT_RSQB):
  23919. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23920. return int32(m_XML_TOK_DATA_CHARS)
  23921. default:
  23922. ptr += uintptr(2)
  23923. break
  23924. }
  23925. }
  23926. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23927. return int32(m_XML_TOK_DATA_CHARS)
  23928. }
  23929. /* ptr points to character following "</" */
  23930. func _big2_scanEndTag(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23931. var v1, v2, v22 int32
  23932. _, _, _ = v1, v2, v22
  23933. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23934. return -int32(1)
  23935. }
  23936. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23937. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23938. } else {
  23939. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23940. }
  23941. switch v1 {
  23942. case int32(_BT_NONASCII):
  23943. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  23944. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23945. return m_XML_TOK_INVALID
  23946. } /* fall through */
  23947. fallthrough
  23948. case int32(_BT_NMSTRT):
  23949. fallthrough
  23950. case int32(_BT_HEX):
  23951. ptr += uintptr(2)
  23952. case int32(_BT_LEAD2):
  23953. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  23954. return -int32(2)
  23955. }
  23956. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23957. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23958. return m_XML_TOK_INVALID
  23959. }
  23960. ptr += uintptr(2)
  23961. case int32(_BT_LEAD3):
  23962. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  23963. return -int32(2)
  23964. }
  23965. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23966. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23967. return m_XML_TOK_INVALID
  23968. }
  23969. ptr += uintptr(3)
  23970. case int32(_BT_LEAD4):
  23971. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  23972. return -int32(2)
  23973. }
  23974. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23975. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23976. return m_XML_TOK_INVALID
  23977. }
  23978. ptr += uintptr(4)
  23979. default:
  23980. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23981. return m_XML_TOK_INVALID
  23982. }
  23983. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23984. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23985. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23986. } else {
  23987. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23988. }
  23989. switch v2 {
  23990. case int32(_BT_NONASCII):
  23991. goto _3
  23992. case int32(_BT_MINUS):
  23993. goto _4
  23994. case int32(_BT_NAME):
  23995. goto _5
  23996. case int32(_BT_DIGIT):
  23997. goto _6
  23998. case int32(_BT_HEX):
  23999. goto _7
  24000. case int32(_BT_NMSTRT):
  24001. goto _8
  24002. case int32(_BT_LEAD2):
  24003. goto _9
  24004. case int32(_BT_LEAD3):
  24005. goto _10
  24006. case int32(_BT_LEAD4):
  24007. goto _11
  24008. case int32(_BT_LF):
  24009. goto _12
  24010. case int32(_BT_CR):
  24011. goto _13
  24012. case int32(_BT_S):
  24013. goto _14
  24014. case int32(_BT_COLON):
  24015. goto _15
  24016. case int32(_BT_GT):
  24017. goto _16
  24018. default:
  24019. goto _17
  24020. }
  24021. goto _18
  24022. _3:
  24023. ;
  24024. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  24025. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24026. return m_XML_TOK_INVALID
  24027. } /* fall through */
  24028. _8:
  24029. ;
  24030. _7:
  24031. ;
  24032. _6:
  24033. ;
  24034. _5:
  24035. ;
  24036. _4:
  24037. ;
  24038. ptr += uintptr(2)
  24039. goto _18
  24040. _9:
  24041. ;
  24042. if int64(end)-int64(ptr) < int64(2) {
  24043. return -int32(2)
  24044. }
  24045. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24046. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24047. return m_XML_TOK_INVALID
  24048. }
  24049. ptr += uintptr(2)
  24050. goto _18
  24051. _10:
  24052. ;
  24053. if int64(end)-int64(ptr) < int64(3) {
  24054. return -int32(2)
  24055. }
  24056. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24057. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24058. return m_XML_TOK_INVALID
  24059. }
  24060. ptr += uintptr(3)
  24061. goto _18
  24062. _11:
  24063. ;
  24064. if int64(end)-int64(ptr) < int64(4) {
  24065. return -int32(2)
  24066. }
  24067. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24068. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24069. return m_XML_TOK_INVALID
  24070. }
  24071. ptr += uintptr(4)
  24072. goto _18
  24073. _14:
  24074. ;
  24075. _13:
  24076. ;
  24077. _12:
  24078. ;
  24079. ptr += uintptr(2)
  24080. _21:
  24081. ;
  24082. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24083. goto _19
  24084. }
  24085. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24086. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24087. } else {
  24088. v22 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24089. }
  24090. switch v22 {
  24091. case int32(_BT_S):
  24092. fallthrough
  24093. case int32(_BT_CR):
  24094. fallthrough
  24095. case int32(_BT_LF):
  24096. case int32(_BT_GT):
  24097. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24098. return int32(m_XML_TOK_END_TAG)
  24099. default:
  24100. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24101. return m_XML_TOK_INVALID
  24102. }
  24103. goto _20
  24104. _20:
  24105. ;
  24106. ptr += uintptr(2)
  24107. goto _21
  24108. goto _19
  24109. _19:
  24110. ;
  24111. return -int32(1)
  24112. _15:
  24113. ;
  24114. /* no need to check qname syntax here,
  24115. since end-tag must match exactly */
  24116. ptr += uintptr(2)
  24117. goto _18
  24118. _16:
  24119. ;
  24120. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24121. return int32(m_XML_TOK_END_TAG)
  24122. _17:
  24123. ;
  24124. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24125. return m_XML_TOK_INVALID
  24126. _18:
  24127. }
  24128. return -int32(1)
  24129. }
  24130. /* ptr points to character following "&#X" */
  24131. func _big2_scanHexCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24132. var v1, v3 int32
  24133. _, _ = v1, v3
  24134. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24135. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24136. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24137. } else {
  24138. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24139. }
  24140. switch v1 {
  24141. case int32(_BT_DIGIT):
  24142. fallthrough
  24143. case int32(_BT_HEX):
  24144. default:
  24145. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24146. return m_XML_TOK_INVALID
  24147. }
  24148. ptr += uintptr(2)
  24149. for {
  24150. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24151. break
  24152. }
  24153. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24154. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24155. } else {
  24156. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24157. }
  24158. switch v3 {
  24159. case int32(_BT_DIGIT):
  24160. fallthrough
  24161. case int32(_BT_HEX):
  24162. case int32(_BT_SEMI):
  24163. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24164. return int32(m_XML_TOK_CHAR_REF)
  24165. default:
  24166. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24167. return m_XML_TOK_INVALID
  24168. }
  24169. goto _2
  24170. _2:
  24171. ;
  24172. ptr += uintptr(2)
  24173. }
  24174. }
  24175. return -int32(1)
  24176. }
  24177. /* ptr points to character following "&#" */
  24178. func _big2_scanCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24179. var v1, v3 int32
  24180. _, _ = v1, v3
  24181. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24182. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_x2) {
  24183. return _big2_scanHexCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24184. }
  24185. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24186. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24187. } else {
  24188. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24189. }
  24190. switch v1 {
  24191. case int32(_BT_DIGIT):
  24192. default:
  24193. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24194. return m_XML_TOK_INVALID
  24195. }
  24196. ptr += uintptr(2)
  24197. for {
  24198. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24199. break
  24200. }
  24201. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24202. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24203. } else {
  24204. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24205. }
  24206. switch v3 {
  24207. case int32(_BT_DIGIT):
  24208. case int32(_BT_SEMI):
  24209. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24210. return int32(m_XML_TOK_CHAR_REF)
  24211. default:
  24212. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24213. return m_XML_TOK_INVALID
  24214. }
  24215. goto _2
  24216. _2:
  24217. ;
  24218. ptr += uintptr(2)
  24219. }
  24220. }
  24221. return -int32(1)
  24222. }
  24223. /* ptr points to character following "&" */
  24224. func _big2_scanRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24225. var v1, v2 int32
  24226. _, _ = v1, v2
  24227. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24228. return -int32(1)
  24229. }
  24230. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24231. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24232. } else {
  24233. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24234. }
  24235. switch v1 {
  24236. case int32(_BT_NONASCII):
  24237. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  24238. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24239. return m_XML_TOK_INVALID
  24240. } /* fall through */
  24241. fallthrough
  24242. case int32(_BT_NMSTRT):
  24243. fallthrough
  24244. case int32(_BT_HEX):
  24245. ptr += uintptr(2)
  24246. case int32(_BT_LEAD2):
  24247. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  24248. return -int32(2)
  24249. }
  24250. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24251. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24252. return m_XML_TOK_INVALID
  24253. }
  24254. ptr += uintptr(2)
  24255. case int32(_BT_LEAD3):
  24256. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  24257. return -int32(2)
  24258. }
  24259. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24260. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24261. return m_XML_TOK_INVALID
  24262. }
  24263. ptr += uintptr(3)
  24264. case int32(_BT_LEAD4):
  24265. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  24266. return -int32(2)
  24267. }
  24268. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24269. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24270. return m_XML_TOK_INVALID
  24271. }
  24272. ptr += uintptr(4)
  24273. case int32(_BT_NUM):
  24274. return _big2_scanCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24275. default:
  24276. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24277. return m_XML_TOK_INVALID
  24278. }
  24279. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24280. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24281. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24282. } else {
  24283. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24284. }
  24285. switch v2 {
  24286. case int32(_BT_NONASCII):
  24287. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  24288. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24289. return m_XML_TOK_INVALID
  24290. } /* fall through */
  24291. fallthrough
  24292. case int32(_BT_NMSTRT):
  24293. fallthrough
  24294. case int32(_BT_HEX):
  24295. fallthrough
  24296. case int32(_BT_DIGIT):
  24297. fallthrough
  24298. case int32(_BT_NAME):
  24299. fallthrough
  24300. case int32(_BT_MINUS):
  24301. ptr += uintptr(2)
  24302. case int32(_BT_LEAD2):
  24303. if int64(end)-int64(ptr) < int64(2) {
  24304. return -int32(2)
  24305. }
  24306. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24307. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24308. return m_XML_TOK_INVALID
  24309. }
  24310. ptr += uintptr(2)
  24311. case int32(_BT_LEAD3):
  24312. if int64(end)-int64(ptr) < int64(3) {
  24313. return -int32(2)
  24314. }
  24315. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24316. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24317. return m_XML_TOK_INVALID
  24318. }
  24319. ptr += uintptr(3)
  24320. case int32(_BT_LEAD4):
  24321. if int64(end)-int64(ptr) < int64(4) {
  24322. return -int32(2)
  24323. }
  24324. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24325. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24326. return m_XML_TOK_INVALID
  24327. }
  24328. ptr += uintptr(4)
  24329. case int32(_BT_SEMI):
  24330. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24331. return int32(m_XML_TOK_ENTITY_REF)
  24332. default:
  24333. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24334. return m_XML_TOK_INVALID
  24335. }
  24336. }
  24337. return -int32(1)
  24338. }
  24339. /* ptr points to character following first character of attribute name */
  24340. func _big2_scanAtts(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24341. bp := tls.Alloc(16)
  24342. defer tls.Free(16)
  24343. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  24344. var hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31 int32
  24345. _, _, _, _, _, _, _, _, _, _, _, _ = hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31
  24346. hadColon = 0
  24347. for int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24348. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24349. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  24350. } else {
  24351. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24352. }
  24353. switch v1 {
  24354. case int32(_BT_NONASCII):
  24355. goto _2
  24356. case int32(_BT_MINUS):
  24357. goto _3
  24358. case int32(_BT_NAME):
  24359. goto _4
  24360. case int32(_BT_DIGIT):
  24361. goto _5
  24362. case int32(_BT_HEX):
  24363. goto _6
  24364. case int32(_BT_NMSTRT):
  24365. goto _7
  24366. case int32(_BT_LEAD2):
  24367. goto _8
  24368. case int32(_BT_LEAD3):
  24369. goto _9
  24370. case int32(_BT_LEAD4):
  24371. goto _10
  24372. case int32(_BT_COLON):
  24373. goto _11
  24374. case int32(_BT_LF):
  24375. goto _12
  24376. case int32(_BT_CR):
  24377. goto _13
  24378. case int32(_BT_S):
  24379. goto _14
  24380. case int32(_BT_EQUALS):
  24381. goto _15
  24382. default:
  24383. goto _16
  24384. }
  24385. goto _17
  24386. _2:
  24387. ;
  24388. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  24389. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24390. return m_XML_TOK_INVALID
  24391. } /* fall through */
  24392. _7:
  24393. ;
  24394. _6:
  24395. ;
  24396. _5:
  24397. ;
  24398. _4:
  24399. ;
  24400. _3:
  24401. ;
  24402. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24403. goto _17
  24404. _8:
  24405. ;
  24406. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  24407. return -int32(2)
  24408. }
  24409. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24410. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24411. return m_XML_TOK_INVALID
  24412. }
  24413. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24414. goto _17
  24415. _9:
  24416. ;
  24417. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  24418. return -int32(2)
  24419. }
  24420. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24421. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24422. return m_XML_TOK_INVALID
  24423. }
  24424. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  24425. goto _17
  24426. _10:
  24427. ;
  24428. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  24429. return -int32(2)
  24430. }
  24431. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24432. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24433. return m_XML_TOK_INVALID
  24434. }
  24435. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  24436. goto _17
  24437. _11:
  24438. ;
  24439. if hadColon != 0 {
  24440. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24441. return m_XML_TOK_INVALID
  24442. }
  24443. hadColon = int32(1)
  24444. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24445. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24446. return -int32(1)
  24447. }
  24448. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24449. v18 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  24450. } else {
  24451. v18 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24452. }
  24453. switch v18 {
  24454. case int32(_BT_NONASCII):
  24455. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  24456. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24457. return m_XML_TOK_INVALID
  24458. } /* fall through */
  24459. fallthrough
  24460. case int32(_BT_NMSTRT):
  24461. fallthrough
  24462. case int32(_BT_HEX):
  24463. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24464. case int32(_BT_LEAD2):
  24465. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  24466. return -int32(2)
  24467. }
  24468. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24469. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24470. return m_XML_TOK_INVALID
  24471. }
  24472. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24473. case int32(_BT_LEAD3):
  24474. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  24475. return -int32(2)
  24476. }
  24477. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24478. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24479. return m_XML_TOK_INVALID
  24480. }
  24481. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  24482. case int32(_BT_LEAD4):
  24483. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  24484. return -int32(2)
  24485. }
  24486. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24487. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24488. return m_XML_TOK_INVALID
  24489. }
  24490. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  24491. default:
  24492. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24493. return m_XML_TOK_INVALID
  24494. }
  24495. goto _17
  24496. _14:
  24497. ;
  24498. _13:
  24499. ;
  24500. _12:
  24501. ;
  24502. _21:
  24503. ;
  24504. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24505. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24506. return -int32(1)
  24507. }
  24508. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24509. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  24510. } else {
  24511. v22 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24512. }
  24513. t = v22
  24514. if t == int32(_BT_EQUALS) {
  24515. goto _19
  24516. }
  24517. switch t {
  24518. case int32(_BT_S):
  24519. fallthrough
  24520. case int32(_BT_LF):
  24521. fallthrough
  24522. case int32(_BT_CR):
  24523. default:
  24524. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24525. return m_XML_TOK_INVALID
  24526. }
  24527. goto _20
  24528. _20:
  24529. ;
  24530. goto _21
  24531. goto _19
  24532. _19:
  24533. ;
  24534. /* fall through */
  24535. _15:
  24536. ;
  24537. hadColon = 0
  24538. for {
  24539. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24540. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24541. return -int32(1)
  24542. }
  24543. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24544. v24 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  24545. } else {
  24546. v24 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24547. }
  24548. open = v24
  24549. if open == int32(_BT_QUOT) || open == int32(_BT_APOS) {
  24550. break
  24551. }
  24552. switch open {
  24553. case int32(_BT_S):
  24554. fallthrough
  24555. case int32(_BT_LF):
  24556. fallthrough
  24557. case int32(_BT_CR):
  24558. default:
  24559. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24560. return m_XML_TOK_INVALID
  24561. }
  24562. goto _23
  24563. _23:
  24564. }
  24565. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24566. /* in attribute value */
  24567. for {
  24568. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24569. return -int32(1)
  24570. }
  24571. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24572. v26 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  24573. } else {
  24574. v26 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24575. }
  24576. t1 = v26
  24577. if t1 == open {
  24578. break
  24579. }
  24580. switch t1 {
  24581. case int32(_BT_LEAD2):
  24582. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  24583. return -int32(2)
  24584. }
  24585. if 0 != 0 {
  24586. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24587. return m_XML_TOK_INVALID
  24588. }
  24589. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24590. case int32(_BT_LEAD3):
  24591. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  24592. return -int32(2)
  24593. }
  24594. if 0 != 0 {
  24595. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24596. return m_XML_TOK_INVALID
  24597. }
  24598. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  24599. case int32(_BT_LEAD4):
  24600. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  24601. return -int32(2)
  24602. }
  24603. if 0 != 0 {
  24604. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24605. return m_XML_TOK_INVALID
  24606. }
  24607. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  24608. case int32(_BT_NONXML):
  24609. fallthrough
  24610. case int32(_BT_MALFORM):
  24611. fallthrough
  24612. case int32(_BT_TRAIL):
  24613. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24614. return m_XML_TOK_INVALID
  24615. case int32(_BT_AMP):
  24616. tok = _big2_scanRef(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr(2), end, bp)
  24617. if tok <= 0 {
  24618. if tok == m_XML_TOK_INVALID {
  24619. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24620. }
  24621. return tok
  24622. }
  24623. case int32(_BT_LT):
  24624. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24625. return m_XML_TOK_INVALID
  24626. default:
  24627. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24628. break
  24629. }
  24630. goto _25
  24631. _25:
  24632. }
  24633. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24634. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24635. return -int32(1)
  24636. }
  24637. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24638. v27 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  24639. } else {
  24640. v27 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24641. }
  24642. switch v27 {
  24643. case int32(_BT_S):
  24644. fallthrough
  24645. case int32(_BT_CR):
  24646. fallthrough
  24647. case int32(_BT_LF):
  24648. case int32(_BT_SOL):
  24649. goto sol
  24650. case int32(_BT_GT):
  24651. goto gt
  24652. default:
  24653. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24654. return m_XML_TOK_INVALID
  24655. }
  24656. /* ptr points to closing quote */
  24657. _30:
  24658. ;
  24659. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24660. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24661. return -int32(1)
  24662. }
  24663. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24664. v31 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  24665. } else {
  24666. v31 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24667. }
  24668. switch v31 {
  24669. case int32(_BT_NONASCII):
  24670. goto _32
  24671. case int32(_BT_HEX):
  24672. goto _33
  24673. case int32(_BT_NMSTRT):
  24674. goto _34
  24675. case int32(_BT_LEAD2):
  24676. goto _35
  24677. case int32(_BT_LEAD3):
  24678. goto _36
  24679. case int32(_BT_LEAD4):
  24680. goto _37
  24681. case int32(_BT_LF):
  24682. goto _38
  24683. case int32(_BT_CR):
  24684. goto _39
  24685. case int32(_BT_S):
  24686. goto _40
  24687. case int32(_BT_GT):
  24688. goto _41
  24689. case int32(_BT_SOL):
  24690. goto _42
  24691. default:
  24692. goto _43
  24693. }
  24694. goto _44
  24695. _32:
  24696. ;
  24697. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  24698. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24699. return m_XML_TOK_INVALID
  24700. } /* fall through */
  24701. _34:
  24702. ;
  24703. _33:
  24704. ;
  24705. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24706. goto _44
  24707. _35:
  24708. ;
  24709. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  24710. return -int32(2)
  24711. }
  24712. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24713. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24714. return m_XML_TOK_INVALID
  24715. }
  24716. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24717. goto _44
  24718. _36:
  24719. ;
  24720. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  24721. return -int32(2)
  24722. }
  24723. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24724. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24725. return m_XML_TOK_INVALID
  24726. }
  24727. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  24728. goto _44
  24729. _37:
  24730. ;
  24731. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  24732. return -int32(2)
  24733. }
  24734. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24735. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24736. return m_XML_TOK_INVALID
  24737. }
  24738. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  24739. goto _44
  24740. _40:
  24741. ;
  24742. _39:
  24743. ;
  24744. _38:
  24745. ;
  24746. goto _29
  24747. _41:
  24748. ;
  24749. goto gt
  24750. gt:
  24751. ;
  24752. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  24753. return int32(m_XML_TOK_START_TAG_WITH_ATTS)
  24754. _42:
  24755. ;
  24756. goto sol
  24757. sol:
  24758. ;
  24759. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24760. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24761. return -int32(1)
  24762. }
  24763. if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 && int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == int32(m_ASCII_GT1)) {
  24764. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24765. return m_XML_TOK_INVALID
  24766. }
  24767. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  24768. return int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS)
  24769. _43:
  24770. ;
  24771. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24772. return m_XML_TOK_INVALID
  24773. _44:
  24774. ;
  24775. goto _28
  24776. goto _29
  24777. _29:
  24778. ;
  24779. goto _30
  24780. goto _28
  24781. _28:
  24782. ;
  24783. goto _17
  24784. _16:
  24785. ;
  24786. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24787. return m_XML_TOK_INVALID
  24788. _17:
  24789. }
  24790. return -int32(1)
  24791. }
  24792. /* ptr points to character following "<" */
  24793. func _big2_scanLt(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24794. var hadColon, v1, v2, v21, v22, v3 int32
  24795. _, _, _, _, _, _ = hadColon, v1, v2, v21, v22, v3
  24796. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24797. return -int32(1)
  24798. }
  24799. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24800. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24801. } else {
  24802. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24803. }
  24804. switch v1 {
  24805. case int32(_BT_NONASCII):
  24806. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  24807. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24808. return m_XML_TOK_INVALID
  24809. } /* fall through */
  24810. fallthrough
  24811. case int32(_BT_NMSTRT):
  24812. fallthrough
  24813. case int32(_BT_HEX):
  24814. ptr += uintptr(2)
  24815. case int32(_BT_LEAD2):
  24816. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  24817. return -int32(2)
  24818. }
  24819. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24820. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24821. return m_XML_TOK_INVALID
  24822. }
  24823. ptr += uintptr(2)
  24824. case int32(_BT_LEAD3):
  24825. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  24826. return -int32(2)
  24827. }
  24828. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24829. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24830. return m_XML_TOK_INVALID
  24831. }
  24832. ptr += uintptr(3)
  24833. case int32(_BT_LEAD4):
  24834. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  24835. return -int32(2)
  24836. }
  24837. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24838. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24839. return m_XML_TOK_INVALID
  24840. }
  24841. ptr += uintptr(4)
  24842. case int32(_BT_EXCL):
  24843. ptr += uintptr(2)
  24844. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24845. return -int32(1)
  24846. }
  24847. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24848. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24849. } else {
  24850. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24851. }
  24852. switch v2 {
  24853. case int32(_BT_MINUS):
  24854. return _big2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24855. case int32(_BT_LSQB):
  24856. return _big2_scanCdataSection(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24857. }
  24858. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24859. return m_XML_TOK_INVALID
  24860. case int32(_BT_QUEST):
  24861. return _big2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24862. case int32(_BT_SOL):
  24863. return _big2_scanEndTag(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24864. default:
  24865. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24866. return m_XML_TOK_INVALID
  24867. }
  24868. hadColon = 0
  24869. /* we have a start-tag */
  24870. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24871. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24872. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24873. } else {
  24874. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24875. }
  24876. switch v3 {
  24877. case int32(_BT_NONASCII):
  24878. goto _4
  24879. case int32(_BT_MINUS):
  24880. goto _5
  24881. case int32(_BT_NAME):
  24882. goto _6
  24883. case int32(_BT_DIGIT):
  24884. goto _7
  24885. case int32(_BT_HEX):
  24886. goto _8
  24887. case int32(_BT_NMSTRT):
  24888. goto _9
  24889. case int32(_BT_LEAD2):
  24890. goto _10
  24891. case int32(_BT_LEAD3):
  24892. goto _11
  24893. case int32(_BT_LEAD4):
  24894. goto _12
  24895. case int32(_BT_COLON):
  24896. goto _13
  24897. case int32(_BT_LF):
  24898. goto _14
  24899. case int32(_BT_CR):
  24900. goto _15
  24901. case int32(_BT_S):
  24902. goto _16
  24903. case int32(_BT_GT):
  24904. goto _17
  24905. case int32(_BT_SOL):
  24906. goto _18
  24907. default:
  24908. goto _19
  24909. }
  24910. goto _20
  24911. _4:
  24912. ;
  24913. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  24914. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24915. return m_XML_TOK_INVALID
  24916. } /* fall through */
  24917. _9:
  24918. ;
  24919. _8:
  24920. ;
  24921. _7:
  24922. ;
  24923. _6:
  24924. ;
  24925. _5:
  24926. ;
  24927. ptr += uintptr(2)
  24928. goto _20
  24929. _10:
  24930. ;
  24931. if int64(end)-int64(ptr) < int64(2) {
  24932. return -int32(2)
  24933. }
  24934. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24935. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24936. return m_XML_TOK_INVALID
  24937. }
  24938. ptr += uintptr(2)
  24939. goto _20
  24940. _11:
  24941. ;
  24942. if int64(end)-int64(ptr) < int64(3) {
  24943. return -int32(2)
  24944. }
  24945. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24946. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24947. return m_XML_TOK_INVALID
  24948. }
  24949. ptr += uintptr(3)
  24950. goto _20
  24951. _12:
  24952. ;
  24953. if int64(end)-int64(ptr) < int64(4) {
  24954. return -int32(2)
  24955. }
  24956. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24957. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24958. return m_XML_TOK_INVALID
  24959. }
  24960. ptr += uintptr(4)
  24961. goto _20
  24962. _13:
  24963. ;
  24964. if hadColon != 0 {
  24965. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24966. return m_XML_TOK_INVALID
  24967. }
  24968. hadColon = int32(1)
  24969. ptr += uintptr(2)
  24970. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24971. return -int32(1)
  24972. }
  24973. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24974. v21 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24975. } else {
  24976. v21 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24977. }
  24978. switch v21 {
  24979. case int32(_BT_NONASCII):
  24980. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  24981. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24982. return m_XML_TOK_INVALID
  24983. } /* fall through */
  24984. fallthrough
  24985. case int32(_BT_NMSTRT):
  24986. fallthrough
  24987. case int32(_BT_HEX):
  24988. ptr += uintptr(2)
  24989. case int32(_BT_LEAD2):
  24990. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  24991. return -int32(2)
  24992. }
  24993. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24994. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24995. return m_XML_TOK_INVALID
  24996. }
  24997. ptr += uintptr(2)
  24998. case int32(_BT_LEAD3):
  24999. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  25000. return -int32(2)
  25001. }
  25002. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25003. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25004. return m_XML_TOK_INVALID
  25005. }
  25006. ptr += uintptr(3)
  25007. case int32(_BT_LEAD4):
  25008. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  25009. return -int32(2)
  25010. }
  25011. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25012. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25013. return m_XML_TOK_INVALID
  25014. }
  25015. ptr += uintptr(4)
  25016. default:
  25017. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25018. return m_XML_TOK_INVALID
  25019. }
  25020. goto _20
  25021. _16:
  25022. ;
  25023. _15:
  25024. ;
  25025. _14:
  25026. ;
  25027. ptr += uintptr(2)
  25028. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25029. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25030. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25031. } else {
  25032. v22 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25033. }
  25034. switch v22 {
  25035. case int32(_BT_NONASCII):
  25036. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  25037. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25038. return m_XML_TOK_INVALID
  25039. } /* fall through */
  25040. fallthrough
  25041. case int32(_BT_NMSTRT):
  25042. fallthrough
  25043. case int32(_BT_HEX):
  25044. ptr += uintptr(2)
  25045. case int32(_BT_LEAD2):
  25046. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  25047. return -int32(2)
  25048. }
  25049. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25050. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25051. return m_XML_TOK_INVALID
  25052. }
  25053. ptr += uintptr(2)
  25054. case int32(_BT_LEAD3):
  25055. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  25056. return -int32(2)
  25057. }
  25058. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25059. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25060. return m_XML_TOK_INVALID
  25061. }
  25062. ptr += uintptr(3)
  25063. case int32(_BT_LEAD4):
  25064. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  25065. return -int32(2)
  25066. }
  25067. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25068. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25069. return m_XML_TOK_INVALID
  25070. }
  25071. ptr += uintptr(4)
  25072. case int32(_BT_GT):
  25073. goto gt
  25074. case int32(_BT_SOL):
  25075. goto sol
  25076. case int32(_BT_S):
  25077. fallthrough
  25078. case int32(_BT_CR):
  25079. fallthrough
  25080. case int32(_BT_LF):
  25081. ptr += uintptr(2)
  25082. continue
  25083. default:
  25084. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25085. return m_XML_TOK_INVALID
  25086. }
  25087. return _big2_scanAtts(tls, enc, ptr, end, nextTokPtr)
  25088. }
  25089. return -int32(1)
  25090. _17:
  25091. ;
  25092. goto gt
  25093. gt:
  25094. ;
  25095. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25096. return int32(m_XML_TOK_START_TAG_NO_ATTS)
  25097. _18:
  25098. ;
  25099. goto sol
  25100. sol:
  25101. ;
  25102. ptr += uintptr(2)
  25103. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25104. return -int32(1)
  25105. }
  25106. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  25107. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25108. return m_XML_TOK_INVALID
  25109. }
  25110. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25111. return int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS)
  25112. _19:
  25113. ;
  25114. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25115. return m_XML_TOK_INVALID
  25116. _20:
  25117. }
  25118. return -int32(1)
  25119. }
  25120. func _big2_contentTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25121. var n Tsize_t
  25122. var v1, v2, v3 int32
  25123. _, _, _, _ = n, v1, v2, v3
  25124. if ptr >= end {
  25125. return -int32(4)
  25126. }
  25127. if int32(2) > int32(1) {
  25128. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  25129. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  25130. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  25131. if n == uint64(0) {
  25132. return -int32(1)
  25133. }
  25134. end = ptr + uintptr(n)
  25135. }
  25136. }
  25137. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25138. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25139. } else {
  25140. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25141. }
  25142. switch v1 {
  25143. case int32(_BT_LT):
  25144. return _big2_scanLt(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25145. case int32(_BT_AMP):
  25146. return _big2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25147. case int32(_BT_CR):
  25148. ptr += uintptr(2)
  25149. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25150. return -int32(3)
  25151. }
  25152. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25153. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25154. } else {
  25155. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25156. }
  25157. if v2 == int32(_BT_LF) {
  25158. ptr += uintptr(2)
  25159. }
  25160. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25161. return int32(m_XML_TOK_DATA_NEWLINE)
  25162. case int32(_BT_LF):
  25163. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25164. return int32(m_XML_TOK_DATA_NEWLINE)
  25165. case int32(_BT_RSQB):
  25166. ptr += uintptr(2)
  25167. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25168. return -int32(5)
  25169. }
  25170. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1)) {
  25171. break
  25172. }
  25173. ptr += uintptr(2)
  25174. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25175. return -int32(5)
  25176. }
  25177. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  25178. ptr -= uintptr(2)
  25179. break
  25180. }
  25181. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25182. return m_XML_TOK_INVALID
  25183. case int32(_BT_LEAD2):
  25184. if int64(end)-int64(ptr) < int64(2) {
  25185. return -int32(2)
  25186. }
  25187. if 0 != 0 {
  25188. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25189. return m_XML_TOK_INVALID
  25190. }
  25191. ptr += uintptr(2)
  25192. case int32(_BT_LEAD3):
  25193. if int64(end)-int64(ptr) < int64(3) {
  25194. return -int32(2)
  25195. }
  25196. if 0 != 0 {
  25197. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25198. return m_XML_TOK_INVALID
  25199. }
  25200. ptr += uintptr(3)
  25201. case int32(_BT_LEAD4):
  25202. if int64(end)-int64(ptr) < int64(4) {
  25203. return -int32(2)
  25204. }
  25205. if 0 != 0 {
  25206. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25207. return m_XML_TOK_INVALID
  25208. }
  25209. ptr += uintptr(4)
  25210. case int32(_BT_NONXML):
  25211. fallthrough
  25212. case int32(_BT_MALFORM):
  25213. fallthrough
  25214. case int32(_BT_TRAIL):
  25215. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25216. return m_XML_TOK_INVALID
  25217. default:
  25218. ptr += uintptr(2)
  25219. break
  25220. }
  25221. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25222. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25223. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25224. } else {
  25225. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25226. }
  25227. switch v3 {
  25228. case int32(_BT_LEAD2):
  25229. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  25230. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25231. return int32(m_XML_TOK_DATA_CHARS)
  25232. }
  25233. ptr += uintptr(2)
  25234. case int32(_BT_LEAD3):
  25235. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  25236. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25237. return int32(m_XML_TOK_DATA_CHARS)
  25238. }
  25239. ptr += uintptr(3)
  25240. case int32(_BT_LEAD4):
  25241. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  25242. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25243. return int32(m_XML_TOK_DATA_CHARS)
  25244. }
  25245. ptr += uintptr(4)
  25246. case int32(_BT_RSQB):
  25247. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) {
  25248. if !(int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == int32(m_ASCII_RSQB1)) {
  25249. ptr += uintptr(2)
  25250. break
  25251. }
  25252. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(3)*libc.Int32FromInt32(2)) {
  25253. if !(int32(*(*int8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) + 1))) == int32(m_ASCII_GT1)) {
  25254. ptr += uintptr(2)
  25255. break
  25256. }
  25257. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  25258. return m_XML_TOK_INVALID
  25259. }
  25260. }
  25261. /* fall through */
  25262. fallthrough
  25263. case int32(_BT_AMP):
  25264. fallthrough
  25265. case int32(_BT_LT):
  25266. fallthrough
  25267. case int32(_BT_NONXML):
  25268. fallthrough
  25269. case int32(_BT_MALFORM):
  25270. fallthrough
  25271. case int32(_BT_TRAIL):
  25272. fallthrough
  25273. case int32(_BT_CR):
  25274. fallthrough
  25275. case int32(_BT_LF):
  25276. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25277. return int32(m_XML_TOK_DATA_CHARS)
  25278. default:
  25279. ptr += uintptr(2)
  25280. break
  25281. }
  25282. }
  25283. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25284. return int32(m_XML_TOK_DATA_CHARS)
  25285. }
  25286. /* ptr points to character following "%" */
  25287. func _big2_scanPercent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25288. var v1, v2 int32
  25289. _, _ = v1, v2
  25290. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25291. return -int32(1)
  25292. }
  25293. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25294. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25295. } else {
  25296. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25297. }
  25298. switch v1 {
  25299. case int32(_BT_NONASCII):
  25300. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  25301. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25302. return m_XML_TOK_INVALID
  25303. } /* fall through */
  25304. fallthrough
  25305. case int32(_BT_NMSTRT):
  25306. fallthrough
  25307. case int32(_BT_HEX):
  25308. ptr += uintptr(2)
  25309. case int32(_BT_LEAD2):
  25310. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  25311. return -int32(2)
  25312. }
  25313. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25314. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25315. return m_XML_TOK_INVALID
  25316. }
  25317. ptr += uintptr(2)
  25318. case int32(_BT_LEAD3):
  25319. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  25320. return -int32(2)
  25321. }
  25322. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25323. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25324. return m_XML_TOK_INVALID
  25325. }
  25326. ptr += uintptr(3)
  25327. case int32(_BT_LEAD4):
  25328. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  25329. return -int32(2)
  25330. }
  25331. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25332. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25333. return m_XML_TOK_INVALID
  25334. }
  25335. ptr += uintptr(4)
  25336. case int32(_BT_S):
  25337. fallthrough
  25338. case int32(_BT_LF):
  25339. fallthrough
  25340. case int32(_BT_CR):
  25341. fallthrough
  25342. case int32(_BT_PERCNT):
  25343. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25344. return int32(m_XML_TOK_PERCENT)
  25345. default:
  25346. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25347. return m_XML_TOK_INVALID
  25348. }
  25349. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25350. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25351. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25352. } else {
  25353. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25354. }
  25355. switch v2 {
  25356. case int32(_BT_NONASCII):
  25357. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  25358. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25359. return m_XML_TOK_INVALID
  25360. } /* fall through */
  25361. fallthrough
  25362. case int32(_BT_NMSTRT):
  25363. fallthrough
  25364. case int32(_BT_HEX):
  25365. fallthrough
  25366. case int32(_BT_DIGIT):
  25367. fallthrough
  25368. case int32(_BT_NAME):
  25369. fallthrough
  25370. case int32(_BT_MINUS):
  25371. ptr += uintptr(2)
  25372. case int32(_BT_LEAD2):
  25373. if int64(end)-int64(ptr) < int64(2) {
  25374. return -int32(2)
  25375. }
  25376. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25377. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25378. return m_XML_TOK_INVALID
  25379. }
  25380. ptr += uintptr(2)
  25381. case int32(_BT_LEAD3):
  25382. if int64(end)-int64(ptr) < int64(3) {
  25383. return -int32(2)
  25384. }
  25385. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25386. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25387. return m_XML_TOK_INVALID
  25388. }
  25389. ptr += uintptr(3)
  25390. case int32(_BT_LEAD4):
  25391. if int64(end)-int64(ptr) < int64(4) {
  25392. return -int32(2)
  25393. }
  25394. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25395. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25396. return m_XML_TOK_INVALID
  25397. }
  25398. ptr += uintptr(4)
  25399. case int32(_BT_SEMI):
  25400. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25401. return int32(m_XML_TOK_PARAM_ENTITY_REF)
  25402. default:
  25403. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25404. return m_XML_TOK_INVALID
  25405. }
  25406. }
  25407. return -int32(1)
  25408. }
  25409. func _big2_scanPoundName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25410. var v1, v2 int32
  25411. _, _ = v1, v2
  25412. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25413. return -int32(1)
  25414. }
  25415. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25416. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25417. } else {
  25418. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25419. }
  25420. switch v1 {
  25421. case int32(_BT_NONASCII):
  25422. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  25423. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25424. return m_XML_TOK_INVALID
  25425. } /* fall through */
  25426. fallthrough
  25427. case int32(_BT_NMSTRT):
  25428. fallthrough
  25429. case int32(_BT_HEX):
  25430. ptr += uintptr(2)
  25431. case int32(_BT_LEAD2):
  25432. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  25433. return -int32(2)
  25434. }
  25435. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25436. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25437. return m_XML_TOK_INVALID
  25438. }
  25439. ptr += uintptr(2)
  25440. case int32(_BT_LEAD3):
  25441. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  25442. return -int32(2)
  25443. }
  25444. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25445. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25446. return m_XML_TOK_INVALID
  25447. }
  25448. ptr += uintptr(3)
  25449. case int32(_BT_LEAD4):
  25450. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  25451. return -int32(2)
  25452. }
  25453. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25454. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25455. return m_XML_TOK_INVALID
  25456. }
  25457. ptr += uintptr(4)
  25458. default:
  25459. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25460. return m_XML_TOK_INVALID
  25461. }
  25462. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25463. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25464. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25465. } else {
  25466. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25467. }
  25468. switch v2 {
  25469. case int32(_BT_NONASCII):
  25470. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  25471. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25472. return m_XML_TOK_INVALID
  25473. } /* fall through */
  25474. fallthrough
  25475. case int32(_BT_NMSTRT):
  25476. fallthrough
  25477. case int32(_BT_HEX):
  25478. fallthrough
  25479. case int32(_BT_DIGIT):
  25480. fallthrough
  25481. case int32(_BT_NAME):
  25482. fallthrough
  25483. case int32(_BT_MINUS):
  25484. ptr += uintptr(2)
  25485. case int32(_BT_LEAD2):
  25486. if int64(end)-int64(ptr) < int64(2) {
  25487. return -int32(2)
  25488. }
  25489. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25490. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25491. return m_XML_TOK_INVALID
  25492. }
  25493. ptr += uintptr(2)
  25494. case int32(_BT_LEAD3):
  25495. if int64(end)-int64(ptr) < int64(3) {
  25496. return -int32(2)
  25497. }
  25498. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25499. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25500. return m_XML_TOK_INVALID
  25501. }
  25502. ptr += uintptr(3)
  25503. case int32(_BT_LEAD4):
  25504. if int64(end)-int64(ptr) < int64(4) {
  25505. return -int32(2)
  25506. }
  25507. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25508. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25509. return m_XML_TOK_INVALID
  25510. }
  25511. ptr += uintptr(4)
  25512. case int32(_BT_CR):
  25513. fallthrough
  25514. case int32(_BT_LF):
  25515. fallthrough
  25516. case int32(_BT_S):
  25517. fallthrough
  25518. case int32(_BT_RPAR):
  25519. fallthrough
  25520. case int32(_BT_GT):
  25521. fallthrough
  25522. case int32(_BT_PERCNT):
  25523. fallthrough
  25524. case int32(_BT_VERBAR):
  25525. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25526. return int32(m_XML_TOK_POUND_NAME)
  25527. default:
  25528. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25529. return m_XML_TOK_INVALID
  25530. }
  25531. }
  25532. return -int32(m_XML_TOK_POUND_NAME)
  25533. }
  25534. func _big2_scanLit(tls *libc.TLS, open int32, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25535. var t, v1, v2 int32
  25536. _, _, _ = t, v1, v2
  25537. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25538. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25539. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25540. } else {
  25541. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25542. }
  25543. t = v1
  25544. switch t {
  25545. case int32(_BT_LEAD2):
  25546. if int64(end)-int64(ptr) < int64(2) {
  25547. return -int32(2)
  25548. }
  25549. if 0 != 0 {
  25550. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25551. return m_XML_TOK_INVALID
  25552. }
  25553. ptr += uintptr(2)
  25554. case int32(_BT_LEAD3):
  25555. if int64(end)-int64(ptr) < int64(3) {
  25556. return -int32(2)
  25557. }
  25558. if 0 != 0 {
  25559. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25560. return m_XML_TOK_INVALID
  25561. }
  25562. ptr += uintptr(3)
  25563. case int32(_BT_LEAD4):
  25564. if int64(end)-int64(ptr) < int64(4) {
  25565. return -int32(2)
  25566. }
  25567. if 0 != 0 {
  25568. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25569. return m_XML_TOK_INVALID
  25570. }
  25571. ptr += uintptr(4)
  25572. case int32(_BT_NONXML):
  25573. fallthrough
  25574. case int32(_BT_MALFORM):
  25575. fallthrough
  25576. case int32(_BT_TRAIL):
  25577. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25578. return m_XML_TOK_INVALID
  25579. case int32(_BT_QUOT):
  25580. fallthrough
  25581. case int32(_BT_APOS):
  25582. ptr += uintptr(2)
  25583. if t != open {
  25584. break
  25585. }
  25586. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25587. return -int32(m_XML_TOK_LITERAL)
  25588. }
  25589. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25590. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25591. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25592. } else {
  25593. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25594. }
  25595. switch v2 {
  25596. case int32(_BT_S):
  25597. fallthrough
  25598. case int32(_BT_CR):
  25599. fallthrough
  25600. case int32(_BT_LF):
  25601. fallthrough
  25602. case int32(_BT_GT):
  25603. fallthrough
  25604. case int32(_BT_PERCNT):
  25605. fallthrough
  25606. case int32(_BT_LSQB):
  25607. return int32(m_XML_TOK_LITERAL)
  25608. default:
  25609. return m_XML_TOK_INVALID
  25610. }
  25611. fallthrough
  25612. default:
  25613. ptr += uintptr(2)
  25614. break
  25615. }
  25616. }
  25617. return -int32(1)
  25618. }
  25619. func _big2_prologTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25620. var n Tsize_t
  25621. var tok, v1, v29, v33, v34, v35, v36 int32
  25622. _, _, _, _, _, _, _, _ = n, tok, v1, v29, v33, v34, v35, v36
  25623. if ptr >= end {
  25624. return -int32(4)
  25625. }
  25626. if int32(2) > int32(1) {
  25627. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  25628. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  25629. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  25630. if n == uint64(0) {
  25631. return -int32(1)
  25632. }
  25633. end = ptr + uintptr(n)
  25634. }
  25635. }
  25636. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25637. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25638. } else {
  25639. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25640. }
  25641. switch v1 {
  25642. case int32(_BT_QUOT):
  25643. goto _2
  25644. case int32(_BT_APOS):
  25645. goto _3
  25646. case int32(_BT_LT):
  25647. goto _4
  25648. case int32(_BT_CR):
  25649. goto _5
  25650. case int32(_BT_LF):
  25651. goto _6
  25652. case int32(_BT_S):
  25653. goto _7
  25654. case int32(_BT_PERCNT):
  25655. goto _8
  25656. case int32(_BT_COMMA):
  25657. goto _9
  25658. case int32(_BT_LSQB):
  25659. goto _10
  25660. case int32(_BT_RSQB):
  25661. goto _11
  25662. case int32(_BT_LPAR):
  25663. goto _12
  25664. case int32(_BT_RPAR):
  25665. goto _13
  25666. case int32(_BT_VERBAR):
  25667. goto _14
  25668. case int32(_BT_GT):
  25669. goto _15
  25670. case int32(_BT_NUM):
  25671. goto _16
  25672. case int32(_BT_LEAD2):
  25673. goto _17
  25674. case int32(_BT_LEAD3):
  25675. goto _18
  25676. case int32(_BT_LEAD4):
  25677. goto _19
  25678. case int32(_BT_HEX):
  25679. goto _20
  25680. case int32(_BT_NMSTRT):
  25681. goto _21
  25682. case int32(_BT_COLON):
  25683. goto _22
  25684. case int32(_BT_MINUS):
  25685. goto _23
  25686. case int32(_BT_NAME):
  25687. goto _24
  25688. case int32(_BT_DIGIT):
  25689. goto _25
  25690. case int32(_BT_NONASCII):
  25691. goto _26
  25692. default:
  25693. goto _27
  25694. }
  25695. goto _28
  25696. _2:
  25697. ;
  25698. return _big2_scanLit(tls, int32(_BT_QUOT), enc, ptr+uintptr(2), end, nextTokPtr)
  25699. _3:
  25700. ;
  25701. return _big2_scanLit(tls, int32(_BT_APOS), enc, ptr+uintptr(2), end, nextTokPtr)
  25702. _4:
  25703. ;
  25704. ptr += uintptr(2)
  25705. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25706. return -int32(1)
  25707. }
  25708. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25709. v29 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25710. } else {
  25711. v29 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25712. }
  25713. switch v29 {
  25714. case int32(_BT_EXCL):
  25715. return _big2_scanDecl(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25716. case int32(_BT_QUEST):
  25717. return _big2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25718. case int32(_BT_NMSTRT):
  25719. fallthrough
  25720. case int32(_BT_HEX):
  25721. fallthrough
  25722. case int32(_BT_NONASCII):
  25723. fallthrough
  25724. case int32(_BT_LEAD2):
  25725. fallthrough
  25726. case int32(_BT_LEAD3):
  25727. fallthrough
  25728. case int32(_BT_LEAD4):
  25729. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr - uintptr(2)
  25730. return int32(m_XML_TOK_INSTANCE_START)
  25731. }
  25732. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25733. return m_XML_TOK_INVALID
  25734. _5:
  25735. ;
  25736. if ptr+uintptr(2) == end {
  25737. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = end
  25738. /* indicate that this might be part of a CR/LF pair */
  25739. return -int32(m_XML_TOK_PROLOG_S)
  25740. }
  25741. /* fall through */
  25742. _7:
  25743. ;
  25744. _6:
  25745. ;
  25746. _32:
  25747. ;
  25748. ptr += uintptr(2)
  25749. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25750. goto _30
  25751. }
  25752. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25753. v33 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25754. } else {
  25755. v33 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25756. }
  25757. switch v33 {
  25758. case int32(_BT_S):
  25759. fallthrough
  25760. case int32(_BT_LF):
  25761. case int32(_BT_CR):
  25762. /* don't split CR/LF pair */
  25763. if ptr+uintptr(2) != end {
  25764. break
  25765. }
  25766. /* fall through */
  25767. fallthrough
  25768. default:
  25769. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25770. return int32(m_XML_TOK_PROLOG_S)
  25771. }
  25772. goto _31
  25773. _31:
  25774. ;
  25775. goto _32
  25776. goto _30
  25777. _30:
  25778. ;
  25779. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25780. return int32(m_XML_TOK_PROLOG_S)
  25781. _8:
  25782. ;
  25783. return _big2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25784. _9:
  25785. ;
  25786. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25787. return int32(m_XML_TOK_COMMA)
  25788. _10:
  25789. ;
  25790. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25791. return int32(m_XML_TOK_OPEN_BRACKET)
  25792. _11:
  25793. ;
  25794. ptr += uintptr(2)
  25795. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25796. return -int32(m_XML_TOK_CLOSE_BRACKET)
  25797. }
  25798. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1) {
  25799. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  25800. return -int32(1)
  25801. }
  25802. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == int32(m_ASCII_GT1) {
  25803. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  25804. return int32(m_XML_TOK_COND_SECT_CLOSE)
  25805. }
  25806. }
  25807. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25808. return int32(m_XML_TOK_CLOSE_BRACKET)
  25809. _12:
  25810. ;
  25811. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25812. return int32(m_XML_TOK_OPEN_PAREN)
  25813. _13:
  25814. ;
  25815. ptr += uintptr(2)
  25816. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25817. return -int32(m_XML_TOK_CLOSE_PAREN)
  25818. }
  25819. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25820. v34 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25821. } else {
  25822. v34 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25823. }
  25824. switch v34 {
  25825. case int32(_BT_AST):
  25826. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25827. return int32(m_XML_TOK_CLOSE_PAREN_ASTERISK)
  25828. case int32(_BT_QUEST):
  25829. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25830. return int32(m_XML_TOK_CLOSE_PAREN_QUESTION)
  25831. case int32(_BT_PLUS):
  25832. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25833. return int32(m_XML_TOK_CLOSE_PAREN_PLUS)
  25834. case int32(_BT_CR):
  25835. fallthrough
  25836. case int32(_BT_LF):
  25837. fallthrough
  25838. case int32(_BT_S):
  25839. fallthrough
  25840. case int32(_BT_GT):
  25841. fallthrough
  25842. case int32(_BT_COMMA):
  25843. fallthrough
  25844. case int32(_BT_VERBAR):
  25845. fallthrough
  25846. case int32(_BT_RPAR):
  25847. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25848. return int32(m_XML_TOK_CLOSE_PAREN)
  25849. }
  25850. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25851. return m_XML_TOK_INVALID
  25852. _14:
  25853. ;
  25854. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25855. return int32(m_XML_TOK_OR)
  25856. _15:
  25857. ;
  25858. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25859. return int32(m_XML_TOK_DECL_CLOSE)
  25860. _16:
  25861. ;
  25862. return _big2_scanPoundName(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25863. _17:
  25864. ;
  25865. if int64(end)-int64(ptr) < int64(2) {
  25866. return -int32(2)
  25867. }
  25868. if 0 != 0 {
  25869. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25870. return m_XML_TOK_INVALID
  25871. }
  25872. if 0 != 0 {
  25873. ptr += uintptr(2)
  25874. tok = int32(m_XML_TOK_NAME)
  25875. goto _28
  25876. }
  25877. if 0 != 0 {
  25878. ptr += uintptr(2)
  25879. tok = int32(m_XML_TOK_NMTOKEN)
  25880. goto _28
  25881. }
  25882. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25883. return m_XML_TOK_INVALID
  25884. _18:
  25885. ;
  25886. if int64(end)-int64(ptr) < int64(3) {
  25887. return -int32(2)
  25888. }
  25889. if 0 != 0 {
  25890. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25891. return m_XML_TOK_INVALID
  25892. }
  25893. if 0 != 0 {
  25894. ptr += uintptr(3)
  25895. tok = int32(m_XML_TOK_NAME)
  25896. goto _28
  25897. }
  25898. if 0 != 0 {
  25899. ptr += uintptr(3)
  25900. tok = int32(m_XML_TOK_NMTOKEN)
  25901. goto _28
  25902. }
  25903. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25904. return m_XML_TOK_INVALID
  25905. _19:
  25906. ;
  25907. if int64(end)-int64(ptr) < int64(4) {
  25908. return -int32(2)
  25909. }
  25910. if 0 != 0 {
  25911. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25912. return m_XML_TOK_INVALID
  25913. }
  25914. if 0 != 0 {
  25915. ptr += uintptr(4)
  25916. tok = int32(m_XML_TOK_NAME)
  25917. goto _28
  25918. }
  25919. if 0 != 0 {
  25920. ptr += uintptr(4)
  25921. tok = int32(m_XML_TOK_NMTOKEN)
  25922. goto _28
  25923. }
  25924. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25925. return m_XML_TOK_INVALID
  25926. _21:
  25927. ;
  25928. _20:
  25929. ;
  25930. tok = int32(m_XML_TOK_NAME)
  25931. ptr += uintptr(2)
  25932. goto _28
  25933. _25:
  25934. ;
  25935. _24:
  25936. ;
  25937. _23:
  25938. ;
  25939. _22:
  25940. ;
  25941. tok = int32(m_XML_TOK_NMTOKEN)
  25942. ptr += uintptr(2)
  25943. goto _28
  25944. _26:
  25945. ;
  25946. if _namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&int32(0x1F))) != 0 {
  25947. ptr += uintptr(2)
  25948. tok = int32(m_XML_TOK_NAME)
  25949. goto _28
  25950. }
  25951. if _namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&int32(0x1F))) != 0 {
  25952. ptr += uintptr(2)
  25953. tok = int32(m_XML_TOK_NMTOKEN)
  25954. goto _28
  25955. }
  25956. /* fall through */
  25957. _27:
  25958. ;
  25959. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25960. return m_XML_TOK_INVALID
  25961. _28:
  25962. ;
  25963. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25964. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25965. v35 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25966. } else {
  25967. v35 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25968. }
  25969. switch v35 {
  25970. case int32(_BT_NONASCII):
  25971. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  25972. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25973. return m_XML_TOK_INVALID
  25974. } /* fall through */
  25975. fallthrough
  25976. case int32(_BT_NMSTRT):
  25977. fallthrough
  25978. case int32(_BT_HEX):
  25979. fallthrough
  25980. case int32(_BT_DIGIT):
  25981. fallthrough
  25982. case int32(_BT_NAME):
  25983. fallthrough
  25984. case int32(_BT_MINUS):
  25985. ptr += uintptr(2)
  25986. case int32(_BT_LEAD2):
  25987. if int64(end)-int64(ptr) < int64(2) {
  25988. return -int32(2)
  25989. }
  25990. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25991. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25992. return m_XML_TOK_INVALID
  25993. }
  25994. ptr += uintptr(2)
  25995. case int32(_BT_LEAD3):
  25996. if int64(end)-int64(ptr) < int64(3) {
  25997. return -int32(2)
  25998. }
  25999. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26000. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26001. return m_XML_TOK_INVALID
  26002. }
  26003. ptr += uintptr(3)
  26004. case int32(_BT_LEAD4):
  26005. if int64(end)-int64(ptr) < int64(4) {
  26006. return -int32(2)
  26007. }
  26008. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26009. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26010. return m_XML_TOK_INVALID
  26011. }
  26012. ptr += uintptr(4)
  26013. case int32(_BT_GT):
  26014. fallthrough
  26015. case int32(_BT_RPAR):
  26016. fallthrough
  26017. case int32(_BT_COMMA):
  26018. fallthrough
  26019. case int32(_BT_VERBAR):
  26020. fallthrough
  26021. case int32(_BT_LSQB):
  26022. fallthrough
  26023. case int32(_BT_PERCNT):
  26024. fallthrough
  26025. case int32(_BT_S):
  26026. fallthrough
  26027. case int32(_BT_CR):
  26028. fallthrough
  26029. case int32(_BT_LF):
  26030. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26031. return tok
  26032. case int32(_BT_COLON):
  26033. ptr += uintptr(2)
  26034. switch tok {
  26035. case int32(m_XML_TOK_NAME):
  26036. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26037. return -int32(1)
  26038. }
  26039. tok = int32(m_XML_TOK_PREFIXED_NAME)
  26040. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26041. v36 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26042. } else {
  26043. v36 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26044. }
  26045. switch v36 {
  26046. case int32(_BT_NONASCII):
  26047. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  26048. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26049. return m_XML_TOK_INVALID
  26050. } /* fall through */
  26051. fallthrough
  26052. case int32(_BT_NMSTRT):
  26053. fallthrough
  26054. case int32(_BT_HEX):
  26055. fallthrough
  26056. case int32(_BT_DIGIT):
  26057. fallthrough
  26058. case int32(_BT_NAME):
  26059. fallthrough
  26060. case int32(_BT_MINUS):
  26061. ptr += uintptr(2)
  26062. case int32(_BT_LEAD2):
  26063. if int64(end)-int64(ptr) < int64(2) {
  26064. return -int32(2)
  26065. }
  26066. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26067. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26068. return m_XML_TOK_INVALID
  26069. }
  26070. ptr += uintptr(2)
  26071. case int32(_BT_LEAD3):
  26072. if int64(end)-int64(ptr) < int64(3) {
  26073. return -int32(2)
  26074. }
  26075. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26076. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26077. return m_XML_TOK_INVALID
  26078. }
  26079. ptr += uintptr(3)
  26080. case int32(_BT_LEAD4):
  26081. if int64(end)-int64(ptr) < int64(4) {
  26082. return -int32(2)
  26083. }
  26084. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26085. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26086. return m_XML_TOK_INVALID
  26087. }
  26088. ptr += uintptr(4)
  26089. default:
  26090. tok = int32(m_XML_TOK_NMTOKEN)
  26091. break
  26092. }
  26093. case int32(m_XML_TOK_PREFIXED_NAME):
  26094. tok = int32(m_XML_TOK_NMTOKEN)
  26095. break
  26096. }
  26097. case int32(_BT_PLUS):
  26098. if tok == int32(m_XML_TOK_NMTOKEN) {
  26099. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26100. return m_XML_TOK_INVALID
  26101. }
  26102. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26103. return int32(m_XML_TOK_NAME_PLUS)
  26104. case int32(_BT_AST):
  26105. if tok == int32(m_XML_TOK_NMTOKEN) {
  26106. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26107. return m_XML_TOK_INVALID
  26108. }
  26109. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26110. return int32(m_XML_TOK_NAME_ASTERISK)
  26111. case int32(_BT_QUEST):
  26112. if tok == int32(m_XML_TOK_NMTOKEN) {
  26113. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26114. return m_XML_TOK_INVALID
  26115. }
  26116. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26117. return int32(m_XML_TOK_NAME_QUESTION)
  26118. default:
  26119. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26120. return m_XML_TOK_INVALID
  26121. }
  26122. }
  26123. return -tok
  26124. }
  26125. func _big2_attributeValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  26126. var start uintptr
  26127. var v1, v2 int32
  26128. _, _, _ = start, v1, v2
  26129. if ptr >= end {
  26130. return -int32(4)
  26131. } else {
  26132. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26133. /* This line cannot be executed. The incoming data has already
  26134. * been tokenized once, so incomplete characters like this have
  26135. * already been eliminated from the input. Retaining the paranoia
  26136. * check is still valuable, however.
  26137. */
  26138. return -int32(1) /* LCOV_EXCL_LINE */
  26139. }
  26140. }
  26141. start = ptr
  26142. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26143. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26144. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26145. } else {
  26146. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26147. }
  26148. switch v1 {
  26149. case int32(_BT_LEAD2):
  26150. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  26151. case int32(_BT_LEAD3):
  26152. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  26153. case int32(_BT_LEAD4):
  26154. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  26155. case int32(_BT_AMP):
  26156. if ptr == start {
  26157. return _big2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  26158. }
  26159. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26160. return int32(m_XML_TOK_DATA_CHARS)
  26161. case int32(_BT_LT):
  26162. /* this is for inside entity references */
  26163. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26164. return m_XML_TOK_INVALID
  26165. case int32(_BT_LF):
  26166. if ptr == start {
  26167. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26168. return int32(m_XML_TOK_DATA_NEWLINE)
  26169. }
  26170. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26171. return int32(m_XML_TOK_DATA_CHARS)
  26172. case int32(_BT_CR):
  26173. if ptr == start {
  26174. ptr += uintptr(2)
  26175. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26176. return -int32(3)
  26177. }
  26178. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26179. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26180. } else {
  26181. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26182. }
  26183. if v2 == int32(_BT_LF) {
  26184. ptr += uintptr(2)
  26185. }
  26186. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26187. return int32(m_XML_TOK_DATA_NEWLINE)
  26188. }
  26189. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26190. return int32(m_XML_TOK_DATA_CHARS)
  26191. case int32(_BT_S):
  26192. if ptr == start {
  26193. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26194. return int32(m_XML_TOK_ATTRIBUTE_VALUE_S)
  26195. }
  26196. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26197. return int32(m_XML_TOK_DATA_CHARS)
  26198. default:
  26199. ptr += uintptr(2)
  26200. break
  26201. }
  26202. }
  26203. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26204. return int32(m_XML_TOK_DATA_CHARS)
  26205. }
  26206. func _big2_entityValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  26207. var start uintptr
  26208. var tok, v1, v2, v3 int32
  26209. _, _, _, _, _ = start, tok, v1, v2, v3
  26210. if ptr >= end {
  26211. return -int32(4)
  26212. } else {
  26213. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26214. /* This line cannot be executed. The incoming data has already
  26215. * been tokenized once, so incomplete characters like this have
  26216. * already been eliminated from the input. Retaining the paranoia
  26217. * check is still valuable, however.
  26218. */
  26219. return -int32(1) /* LCOV_EXCL_LINE */
  26220. }
  26221. }
  26222. start = ptr
  26223. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26224. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26225. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26226. } else {
  26227. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26228. }
  26229. switch v1 {
  26230. case int32(_BT_LEAD2):
  26231. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  26232. case int32(_BT_LEAD3):
  26233. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  26234. case int32(_BT_LEAD4):
  26235. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  26236. case int32(_BT_AMP):
  26237. if ptr == start {
  26238. return _big2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  26239. }
  26240. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26241. return int32(m_XML_TOK_DATA_CHARS)
  26242. case int32(_BT_PERCNT):
  26243. if ptr == start {
  26244. tok = _big2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  26245. if tok == int32(m_XML_TOK_PERCENT) {
  26246. v2 = m_XML_TOK_INVALID
  26247. } else {
  26248. v2 = tok
  26249. }
  26250. return v2
  26251. }
  26252. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26253. return int32(m_XML_TOK_DATA_CHARS)
  26254. case int32(_BT_LF):
  26255. if ptr == start {
  26256. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26257. return int32(m_XML_TOK_DATA_NEWLINE)
  26258. }
  26259. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26260. return int32(m_XML_TOK_DATA_CHARS)
  26261. case int32(_BT_CR):
  26262. if ptr == start {
  26263. ptr += uintptr(2)
  26264. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26265. return -int32(3)
  26266. }
  26267. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26268. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26269. } else {
  26270. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26271. }
  26272. if v3 == int32(_BT_LF) {
  26273. ptr += uintptr(2)
  26274. }
  26275. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26276. return int32(m_XML_TOK_DATA_NEWLINE)
  26277. }
  26278. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26279. return int32(m_XML_TOK_DATA_CHARS)
  26280. default:
  26281. ptr += uintptr(2)
  26282. break
  26283. }
  26284. }
  26285. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26286. return int32(m_XML_TOK_DATA_CHARS)
  26287. }
  26288. func _big2_ignoreSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  26289. var level, v1 int32
  26290. var n Tsize_t
  26291. _, _, _ = level, n, v1
  26292. level = 0
  26293. if int32(2) > int32(1) {
  26294. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  26295. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  26296. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  26297. end = ptr + uintptr(n)
  26298. }
  26299. }
  26300. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26301. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26302. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26303. } else {
  26304. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26305. }
  26306. switch v1 {
  26307. case int32(_BT_LEAD2):
  26308. if int64(end)-int64(ptr) < int64(2) {
  26309. return -int32(2)
  26310. }
  26311. if 0 != 0 {
  26312. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26313. return m_XML_TOK_INVALID
  26314. }
  26315. ptr += uintptr(2)
  26316. case int32(_BT_LEAD3):
  26317. if int64(end)-int64(ptr) < int64(3) {
  26318. return -int32(2)
  26319. }
  26320. if 0 != 0 {
  26321. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26322. return m_XML_TOK_INVALID
  26323. }
  26324. ptr += uintptr(3)
  26325. case int32(_BT_LEAD4):
  26326. if int64(end)-int64(ptr) < int64(4) {
  26327. return -int32(2)
  26328. }
  26329. if 0 != 0 {
  26330. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26331. return m_XML_TOK_INVALID
  26332. }
  26333. ptr += uintptr(4)
  26334. case int32(_BT_NONXML):
  26335. fallthrough
  26336. case int32(_BT_MALFORM):
  26337. fallthrough
  26338. case int32(_BT_TRAIL):
  26339. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26340. return m_XML_TOK_INVALID
  26341. case int32(_BT_LT):
  26342. ptr += uintptr(2)
  26343. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26344. return -int32(1)
  26345. }
  26346. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_EXCL2) {
  26347. ptr += uintptr(2)
  26348. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26349. return -int32(1)
  26350. }
  26351. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_LSQB1) {
  26352. level++
  26353. ptr += uintptr(2)
  26354. }
  26355. }
  26356. case int32(_BT_RSQB):
  26357. ptr += uintptr(2)
  26358. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26359. return -int32(1)
  26360. }
  26361. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1) {
  26362. ptr += uintptr(2)
  26363. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26364. return -int32(1)
  26365. }
  26366. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1) {
  26367. ptr += uintptr(2)
  26368. if level == 0 {
  26369. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26370. return int32(m_XML_TOK_IGNORE_SECT)
  26371. }
  26372. level--
  26373. }
  26374. }
  26375. default:
  26376. ptr += uintptr(2)
  26377. break
  26378. }
  26379. }
  26380. return -int32(1)
  26381. }
  26382. func _big2_isPublicId(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr) (r int32) {
  26383. var v2, v3, v4 int32
  26384. _, _, _ = v2, v3, v4
  26385. ptr += uintptr(2)
  26386. end -= uintptr(2)
  26387. for {
  26388. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26389. break
  26390. }
  26391. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26392. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26393. } else {
  26394. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26395. }
  26396. switch v2 {
  26397. case int32(_BT_DIGIT):
  26398. fallthrough
  26399. case int32(_BT_HEX):
  26400. fallthrough
  26401. case int32(_BT_MINUS):
  26402. fallthrough
  26403. case int32(_BT_APOS):
  26404. fallthrough
  26405. case int32(_BT_LPAR):
  26406. fallthrough
  26407. case int32(_BT_RPAR):
  26408. fallthrough
  26409. case int32(_BT_PLUS):
  26410. fallthrough
  26411. case int32(_BT_COMMA):
  26412. fallthrough
  26413. case int32(_BT_SOL):
  26414. fallthrough
  26415. case int32(_BT_EQUALS):
  26416. fallthrough
  26417. case int32(_BT_QUEST):
  26418. fallthrough
  26419. case int32(_BT_CR):
  26420. fallthrough
  26421. case int32(_BT_LF):
  26422. fallthrough
  26423. case int32(_BT_SEMI):
  26424. fallthrough
  26425. case int32(_BT_EXCL):
  26426. fallthrough
  26427. case int32(_BT_AST):
  26428. fallthrough
  26429. case int32(_BT_PERCNT):
  26430. fallthrough
  26431. case int32(_BT_NUM):
  26432. fallthrough
  26433. case int32(_BT_COLON):
  26434. case int32(_BT_S):
  26435. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_TAB1) {
  26436. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  26437. return 0
  26438. }
  26439. case int32(_BT_NAME):
  26440. fallthrough
  26441. case int32(_BT_NMSTRT):
  26442. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26443. v3 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  26444. } else {
  26445. v3 = -int32(1)
  26446. }
  26447. if !(v3 & ^libc.Int32FromInt32(0x7f) != 0) {
  26448. break
  26449. }
  26450. /* fall through */
  26451. fallthrough
  26452. default:
  26453. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26454. v4 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  26455. } else {
  26456. v4 = -int32(1)
  26457. }
  26458. switch v4 {
  26459. case int32(0x24): /* $ */
  26460. fallthrough
  26461. case int32(0x40): /* @ */
  26462. default:
  26463. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  26464. return 0
  26465. }
  26466. break
  26467. }
  26468. goto _1
  26469. _1:
  26470. ;
  26471. ptr += uintptr(2)
  26472. }
  26473. return int32(1)
  26474. }
  26475. /* This must only be called for a well-formed start-tag or empty
  26476. element tag. Returns the number of attributes. Pointers to the
  26477. first attsMax attributes are stored in atts.
  26478. */
  26479. func _big2_getAtts(tls *libc.TLS, enc uintptr, ptr uintptr, attsMax int32, atts uintptr) (r int32) {
  26480. var nAtts, open, state, v2, v3, v5, v7 int32
  26481. var v4, v6, v8, v9 bool
  26482. _, _, _, _, _, _, _, _, _, _, _ = nAtts, open, state, v2, v3, v4, v5, v6, v7, v8, v9
  26483. state = 1
  26484. nAtts = 0
  26485. open = 0 /* defined when state == inValue;
  26486. initialization just to shut up compilers */
  26487. ptr += uintptr(2)
  26488. for {
  26489. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26490. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26491. } else {
  26492. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26493. }
  26494. switch v2 {
  26495. case int32(_BT_LEAD2):
  26496. if state == 0 {
  26497. if nAtts < attsMax {
  26498. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  26499. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  26500. }
  26501. state = 1
  26502. }
  26503. ptr += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(2))
  26504. case int32(_BT_LEAD3):
  26505. if state == 0 {
  26506. if nAtts < attsMax {
  26507. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  26508. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  26509. }
  26510. state = 1
  26511. }
  26512. ptr += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(2))
  26513. case int32(_BT_LEAD4):
  26514. if state == 0 {
  26515. if nAtts < attsMax {
  26516. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  26517. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  26518. }
  26519. state = 1
  26520. }
  26521. ptr += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(2))
  26522. case int32(_BT_NONASCII):
  26523. fallthrough
  26524. case int32(_BT_NMSTRT):
  26525. fallthrough
  26526. case int32(_BT_HEX):
  26527. if state == 0 {
  26528. if nAtts < attsMax {
  26529. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  26530. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  26531. }
  26532. state = 1
  26533. }
  26534. case int32(_BT_QUOT):
  26535. if state != 2 {
  26536. if nAtts < attsMax {
  26537. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  26538. }
  26539. state = 2
  26540. open = int32(_BT_QUOT)
  26541. } else {
  26542. if open == int32(_BT_QUOT) {
  26543. state = 0
  26544. if nAtts < attsMax {
  26545. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  26546. }
  26547. nAtts++
  26548. }
  26549. }
  26550. case int32(_BT_APOS):
  26551. if state != 2 {
  26552. if nAtts < attsMax {
  26553. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  26554. }
  26555. state = 2
  26556. open = int32(_BT_APOS)
  26557. } else {
  26558. if open == int32(_BT_APOS) {
  26559. state = 0
  26560. if nAtts < attsMax {
  26561. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  26562. }
  26563. nAtts++
  26564. }
  26565. }
  26566. case int32(_BT_AMP):
  26567. if nAtts < attsMax {
  26568. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  26569. }
  26570. case int32(_BT_S):
  26571. if state == 1 {
  26572. state = 0
  26573. } else {
  26574. if v9 = state == 2 && nAtts < attsMax && (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized != 0; v9 {
  26575. if v4 = ptr == (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr; !v4 {
  26576. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26577. v3 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  26578. } else {
  26579. v3 = -int32(1)
  26580. }
  26581. }
  26582. if v6 = v4 || v3 != int32(m_ASCII_SPACE1); !v6 {
  26583. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 {
  26584. v5 = int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))
  26585. } else {
  26586. v5 = -int32(1)
  26587. }
  26588. }
  26589. if v8 = v6 || v5 == int32(m_ASCII_SPACE1); !v8 {
  26590. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 {
  26591. v7 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))))))
  26592. } else {
  26593. v7 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))), *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))
  26594. }
  26595. }
  26596. }
  26597. if v9 && (v8 || v7 == open) {
  26598. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  26599. }
  26600. }
  26601. case int32(_BT_CR):
  26602. fallthrough
  26603. case int32(_BT_LF):
  26604. /* This case ensures that the first attribute name is counted
  26605. Apart from that we could just change state on the quote. */
  26606. if state == 1 {
  26607. state = 0
  26608. } else {
  26609. if state == 2 && nAtts < attsMax {
  26610. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  26611. }
  26612. }
  26613. case int32(_BT_GT):
  26614. fallthrough
  26615. case int32(_BT_SOL):
  26616. if state != 2 {
  26617. return nAtts
  26618. }
  26619. default:
  26620. break
  26621. }
  26622. goto _1
  26623. _1:
  26624. ;
  26625. ptr += uintptr(2)
  26626. }
  26627. /* not reached */
  26628. return r
  26629. }
  26630. func _big2_charRefNumber(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  26631. var c, c1, result, v2, v4 int32
  26632. _, _, _, _, _ = c, c1, result, v2, v4
  26633. result = 0
  26634. /* skip &# */
  26635. _ = enc
  26636. ptr += uintptr(libc.Int32FromInt32(2) * libc.Int32FromInt32(2))
  26637. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_x2) {
  26638. ptr += uintptr(2)
  26639. for {
  26640. if !!(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_SEMI1)) {
  26641. break
  26642. }
  26643. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26644. v2 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  26645. } else {
  26646. v2 = -int32(1)
  26647. }
  26648. c = v2
  26649. switch c {
  26650. case int32(m_ASCII_02):
  26651. fallthrough
  26652. case int32(m_ASCII_12):
  26653. fallthrough
  26654. case int32(m_ASCII_22):
  26655. fallthrough
  26656. case int32(m_ASCII_32):
  26657. fallthrough
  26658. case int32(m_ASCII_41):
  26659. fallthrough
  26660. case int32(m_ASCII_51):
  26661. fallthrough
  26662. case int32(m_ASCII_61):
  26663. fallthrough
  26664. case int32(m_ASCII_71):
  26665. fallthrough
  26666. case int32(m_ASCII_82):
  26667. fallthrough
  26668. case int32(m_ASCII_92):
  26669. result <<= int32(4)
  26670. result |= c - int32(m_ASCII_02)
  26671. case int32(m_ASCII_A):
  26672. fallthrough
  26673. case int32(m_ASCII_B1):
  26674. fallthrough
  26675. case int32(m_ASCII_C):
  26676. fallthrough
  26677. case int32(m_ASCII_D):
  26678. fallthrough
  26679. case int32(m_ASCII_E):
  26680. fallthrough
  26681. case int32(m_ASCII_F):
  26682. result <<= int32(4)
  26683. result += int32(10) + (c - int32(m_ASCII_A))
  26684. case int32(m_ASCII_a2):
  26685. fallthrough
  26686. case int32(m_ASCII_b1):
  26687. fallthrough
  26688. case int32(m_ASCII_c2):
  26689. fallthrough
  26690. case int32(m_ASCII_d1):
  26691. fallthrough
  26692. case int32(m_ASCII_e2):
  26693. fallthrough
  26694. case int32(m_ASCII_f1):
  26695. result <<= int32(4)
  26696. result += int32(10) + (c - int32(m_ASCII_a2))
  26697. break
  26698. }
  26699. if result >= int32(0x110000) {
  26700. return -int32(1)
  26701. }
  26702. goto _1
  26703. _1:
  26704. ;
  26705. ptr += uintptr(2)
  26706. }
  26707. } else {
  26708. for {
  26709. if !!(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_SEMI1)) {
  26710. break
  26711. }
  26712. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26713. v4 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  26714. } else {
  26715. v4 = -int32(1)
  26716. }
  26717. c1 = v4
  26718. result *= int32(10)
  26719. result += c1 - int32(m_ASCII_02)
  26720. if result >= int32(0x110000) {
  26721. return -int32(1)
  26722. }
  26723. goto _3
  26724. _3:
  26725. ;
  26726. ptr += uintptr(2)
  26727. }
  26728. }
  26729. return _checkCharRefNumber(tls, result)
  26730. }
  26731. func _big2_predefinedEntityName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr) (r int32) {
  26732. var v1, v2 int32
  26733. _, _ = v1, v2
  26734. _ = enc
  26735. switch (int64(end) - int64(ptr)) / libc.Int64FromInt32(2) {
  26736. case int64(2):
  26737. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == int32(m_ASCII_t2) {
  26738. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26739. v1 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  26740. } else {
  26741. v1 = -int32(1)
  26742. }
  26743. switch v1 {
  26744. case int32(m_ASCII_l2):
  26745. return int32(m_ASCII_LT1)
  26746. case int32(m_ASCII_g2):
  26747. return int32(m_ASCII_GT1)
  26748. }
  26749. }
  26750. case int64(3):
  26751. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_a2) {
  26752. ptr += uintptr(2)
  26753. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_m2) {
  26754. ptr += uintptr(2)
  26755. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_p2) {
  26756. return int32(m_ASCII_AMP1)
  26757. }
  26758. }
  26759. }
  26760. case int64(4):
  26761. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26762. v2 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  26763. } else {
  26764. v2 = -int32(1)
  26765. }
  26766. switch v2 {
  26767. case int32(m_ASCII_q1):
  26768. ptr += uintptr(2)
  26769. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_u1) {
  26770. ptr += uintptr(2)
  26771. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_o2) {
  26772. ptr += uintptr(2)
  26773. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_t2) {
  26774. return int32(m_ASCII_QUOT1)
  26775. }
  26776. }
  26777. }
  26778. case int32(m_ASCII_a2):
  26779. ptr += uintptr(2)
  26780. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_p2) {
  26781. ptr += uintptr(2)
  26782. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_o2) {
  26783. ptr += uintptr(2)
  26784. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_s2) {
  26785. return int32(m_ASCII_APOS1)
  26786. }
  26787. }
  26788. }
  26789. break
  26790. }
  26791. }
  26792. return 0
  26793. }
  26794. func _big2_nameMatchesAscii(tls *libc.TLS, enc uintptr, ptr1 uintptr, end1 uintptr, ptr2 uintptr) (r int32) {
  26795. _ = enc
  26796. for {
  26797. if !(*(*int8)(unsafe.Pointer(ptr2)) != 0) {
  26798. break
  26799. }
  26800. if int64(end1)-int64(ptr1) < int64(2) {
  26801. /* This line cannot be executed. The incoming data has already
  26802. * been tokenized once, so incomplete characters like this have
  26803. * already been eliminated from the input. Retaining the
  26804. * paranoia check is still valuable, however.
  26805. */
  26806. return 0 /* LCOV_EXCL_LINE */
  26807. }
  26808. if !(int32(*(*int8)(unsafe.Pointer(ptr1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr1 + 1))) == int32(*(*int8)(unsafe.Pointer(ptr2)))) {
  26809. return 0
  26810. }
  26811. goto _1
  26812. _1:
  26813. ;
  26814. ptr1 += uintptr(2)
  26815. ptr2++
  26816. }
  26817. return libc.BoolInt32(ptr1 == end1)
  26818. }
  26819. func _big2_nameLength(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  26820. var start uintptr
  26821. var v2 int32
  26822. _, _ = start, v2
  26823. start = ptr
  26824. for {
  26825. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26826. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26827. } else {
  26828. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26829. }
  26830. switch v2 {
  26831. case int32(_BT_LEAD2):
  26832. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  26833. case int32(_BT_LEAD3):
  26834. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  26835. case int32(_BT_LEAD4):
  26836. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  26837. case int32(_BT_NONASCII):
  26838. fallthrough
  26839. case int32(_BT_NMSTRT):
  26840. fallthrough
  26841. case int32(_BT_COLON):
  26842. fallthrough
  26843. case int32(_BT_HEX):
  26844. fallthrough
  26845. case int32(_BT_DIGIT):
  26846. fallthrough
  26847. case int32(_BT_NAME):
  26848. fallthrough
  26849. case int32(_BT_MINUS):
  26850. ptr += uintptr(2)
  26851. default:
  26852. return int32(int64(ptr) - int64(start))
  26853. }
  26854. goto _1
  26855. _1:
  26856. }
  26857. return r
  26858. }
  26859. func _big2_skipS(tls *libc.TLS, enc uintptr, ptr uintptr) (r uintptr) {
  26860. var v2 int32
  26861. _ = v2
  26862. for {
  26863. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26864. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26865. } else {
  26866. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26867. }
  26868. switch v2 {
  26869. case int32(_BT_LF):
  26870. fallthrough
  26871. case int32(_BT_CR):
  26872. fallthrough
  26873. case int32(_BT_S):
  26874. ptr += uintptr(2)
  26875. default:
  26876. return ptr
  26877. }
  26878. goto _1
  26879. _1:
  26880. }
  26881. return r
  26882. }
  26883. func _big2_updatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  26884. var v1, v2 int32
  26885. var v3 bool
  26886. _, _, _ = v1, v2, v3
  26887. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26888. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26889. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26890. } else {
  26891. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26892. }
  26893. switch v1 {
  26894. case int32(_BT_LEAD2):
  26895. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  26896. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  26897. case int32(_BT_LEAD3):
  26898. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  26899. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  26900. case int32(_BT_LEAD4):
  26901. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  26902. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  26903. case int32(_BT_LF):
  26904. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  26905. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  26906. ptr += uintptr(2)
  26907. case int32(_BT_CR):
  26908. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  26909. ptr += uintptr(2)
  26910. if v3 = int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)); v3 {
  26911. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26912. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26913. } else {
  26914. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26915. }
  26916. }
  26917. if v3 && v2 == int32(_BT_LF) {
  26918. ptr += uintptr(2)
  26919. }
  26920. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  26921. default:
  26922. ptr += uintptr(2)
  26923. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  26924. break
  26925. }
  26926. }
  26927. }
  26928. var _big2_encoding_ns = Tnormal_encoding{
  26929. Fenc: TENCODING{
  26930. Fscanners: [4]TSCANNER{},
  26931. FliteralScanners: [2]TSCANNER{},
  26932. FminBytesPerChar: int32(2),
  26933. },
  26934. Ftype1: [256]uint8{
  26935. 9: uint8(_BT_S),
  26936. 10: uint8(_BT_LF),
  26937. 13: uint8(_BT_CR),
  26938. 32: uint8(_BT_S),
  26939. 33: uint8(_BT_EXCL),
  26940. 34: uint8(_BT_QUOT),
  26941. 35: uint8(_BT_NUM),
  26942. 36: uint8(_BT_OTHER),
  26943. 37: uint8(_BT_PERCNT),
  26944. 38: uint8(_BT_AMP),
  26945. 39: uint8(_BT_APOS),
  26946. 40: uint8(_BT_LPAR),
  26947. 41: uint8(_BT_RPAR),
  26948. 42: uint8(_BT_AST),
  26949. 43: uint8(_BT_PLUS),
  26950. 44: uint8(_BT_COMMA),
  26951. 45: uint8(_BT_MINUS),
  26952. 46: uint8(_BT_NAME),
  26953. 47: uint8(_BT_SOL),
  26954. 48: uint8(_BT_DIGIT),
  26955. 49: uint8(_BT_DIGIT),
  26956. 50: uint8(_BT_DIGIT),
  26957. 51: uint8(_BT_DIGIT),
  26958. 52: uint8(_BT_DIGIT),
  26959. 53: uint8(_BT_DIGIT),
  26960. 54: uint8(_BT_DIGIT),
  26961. 55: uint8(_BT_DIGIT),
  26962. 56: uint8(_BT_DIGIT),
  26963. 57: uint8(_BT_DIGIT),
  26964. 58: uint8(_BT_COLON),
  26965. 59: uint8(_BT_SEMI),
  26966. 60: uint8(_BT_LT),
  26967. 61: uint8(_BT_EQUALS),
  26968. 62: uint8(_BT_GT),
  26969. 63: uint8(_BT_QUEST),
  26970. 64: uint8(_BT_OTHER),
  26971. 65: uint8(_BT_HEX),
  26972. 66: uint8(_BT_HEX),
  26973. 67: uint8(_BT_HEX),
  26974. 68: uint8(_BT_HEX),
  26975. 69: uint8(_BT_HEX),
  26976. 70: uint8(_BT_HEX),
  26977. 71: uint8(_BT_NMSTRT),
  26978. 72: uint8(_BT_NMSTRT),
  26979. 73: uint8(_BT_NMSTRT),
  26980. 74: uint8(_BT_NMSTRT),
  26981. 75: uint8(_BT_NMSTRT),
  26982. 76: uint8(_BT_NMSTRT),
  26983. 77: uint8(_BT_NMSTRT),
  26984. 78: uint8(_BT_NMSTRT),
  26985. 79: uint8(_BT_NMSTRT),
  26986. 80: uint8(_BT_NMSTRT),
  26987. 81: uint8(_BT_NMSTRT),
  26988. 82: uint8(_BT_NMSTRT),
  26989. 83: uint8(_BT_NMSTRT),
  26990. 84: uint8(_BT_NMSTRT),
  26991. 85: uint8(_BT_NMSTRT),
  26992. 86: uint8(_BT_NMSTRT),
  26993. 87: uint8(_BT_NMSTRT),
  26994. 88: uint8(_BT_NMSTRT),
  26995. 89: uint8(_BT_NMSTRT),
  26996. 90: uint8(_BT_NMSTRT),
  26997. 91: uint8(_BT_LSQB),
  26998. 92: uint8(_BT_OTHER),
  26999. 93: uint8(_BT_RSQB),
  27000. 94: uint8(_BT_OTHER),
  27001. 95: uint8(_BT_NMSTRT),
  27002. 96: uint8(_BT_OTHER),
  27003. 97: uint8(_BT_HEX),
  27004. 98: uint8(_BT_HEX),
  27005. 99: uint8(_BT_HEX),
  27006. 100: uint8(_BT_HEX),
  27007. 101: uint8(_BT_HEX),
  27008. 102: uint8(_BT_HEX),
  27009. 103: uint8(_BT_NMSTRT),
  27010. 104: uint8(_BT_NMSTRT),
  27011. 105: uint8(_BT_NMSTRT),
  27012. 106: uint8(_BT_NMSTRT),
  27013. 107: uint8(_BT_NMSTRT),
  27014. 108: uint8(_BT_NMSTRT),
  27015. 109: uint8(_BT_NMSTRT),
  27016. 110: uint8(_BT_NMSTRT),
  27017. 111: uint8(_BT_NMSTRT),
  27018. 112: uint8(_BT_NMSTRT),
  27019. 113: uint8(_BT_NMSTRT),
  27020. 114: uint8(_BT_NMSTRT),
  27021. 115: uint8(_BT_NMSTRT),
  27022. 116: uint8(_BT_NMSTRT),
  27023. 117: uint8(_BT_NMSTRT),
  27024. 118: uint8(_BT_NMSTRT),
  27025. 119: uint8(_BT_NMSTRT),
  27026. 120: uint8(_BT_NMSTRT),
  27027. 121: uint8(_BT_NMSTRT),
  27028. 122: uint8(_BT_NMSTRT),
  27029. 123: uint8(_BT_OTHER),
  27030. 124: uint8(_BT_VERBAR),
  27031. 125: uint8(_BT_OTHER),
  27032. 126: uint8(_BT_OTHER),
  27033. 127: uint8(_BT_OTHER),
  27034. 128: uint8(_BT_OTHER),
  27035. 129: uint8(_BT_OTHER),
  27036. 130: uint8(_BT_OTHER),
  27037. 131: uint8(_BT_OTHER),
  27038. 132: uint8(_BT_OTHER),
  27039. 133: uint8(_BT_OTHER),
  27040. 134: uint8(_BT_OTHER),
  27041. 135: uint8(_BT_OTHER),
  27042. 136: uint8(_BT_OTHER),
  27043. 137: uint8(_BT_OTHER),
  27044. 138: uint8(_BT_OTHER),
  27045. 139: uint8(_BT_OTHER),
  27046. 140: uint8(_BT_OTHER),
  27047. 141: uint8(_BT_OTHER),
  27048. 142: uint8(_BT_OTHER),
  27049. 143: uint8(_BT_OTHER),
  27050. 144: uint8(_BT_OTHER),
  27051. 145: uint8(_BT_OTHER),
  27052. 146: uint8(_BT_OTHER),
  27053. 147: uint8(_BT_OTHER),
  27054. 148: uint8(_BT_OTHER),
  27055. 149: uint8(_BT_OTHER),
  27056. 150: uint8(_BT_OTHER),
  27057. 151: uint8(_BT_OTHER),
  27058. 152: uint8(_BT_OTHER),
  27059. 153: uint8(_BT_OTHER),
  27060. 154: uint8(_BT_OTHER),
  27061. 155: uint8(_BT_OTHER),
  27062. 156: uint8(_BT_OTHER),
  27063. 157: uint8(_BT_OTHER),
  27064. 158: uint8(_BT_OTHER),
  27065. 159: uint8(_BT_OTHER),
  27066. 160: uint8(_BT_OTHER),
  27067. 161: uint8(_BT_OTHER),
  27068. 162: uint8(_BT_OTHER),
  27069. 163: uint8(_BT_OTHER),
  27070. 164: uint8(_BT_OTHER),
  27071. 165: uint8(_BT_OTHER),
  27072. 166: uint8(_BT_OTHER),
  27073. 167: uint8(_BT_OTHER),
  27074. 168: uint8(_BT_OTHER),
  27075. 169: uint8(_BT_OTHER),
  27076. 170: uint8(_BT_NMSTRT),
  27077. 171: uint8(_BT_OTHER),
  27078. 172: uint8(_BT_OTHER),
  27079. 173: uint8(_BT_OTHER),
  27080. 174: uint8(_BT_OTHER),
  27081. 175: uint8(_BT_OTHER),
  27082. 176: uint8(_BT_OTHER),
  27083. 177: uint8(_BT_OTHER),
  27084. 178: uint8(_BT_OTHER),
  27085. 179: uint8(_BT_OTHER),
  27086. 180: uint8(_BT_OTHER),
  27087. 181: uint8(_BT_NMSTRT),
  27088. 182: uint8(_BT_OTHER),
  27089. 183: uint8(_BT_NAME),
  27090. 184: uint8(_BT_OTHER),
  27091. 185: uint8(_BT_OTHER),
  27092. 186: uint8(_BT_NMSTRT),
  27093. 187: uint8(_BT_OTHER),
  27094. 188: uint8(_BT_OTHER),
  27095. 189: uint8(_BT_OTHER),
  27096. 190: uint8(_BT_OTHER),
  27097. 191: uint8(_BT_OTHER),
  27098. 192: uint8(_BT_NMSTRT),
  27099. 193: uint8(_BT_NMSTRT),
  27100. 194: uint8(_BT_NMSTRT),
  27101. 195: uint8(_BT_NMSTRT),
  27102. 196: uint8(_BT_NMSTRT),
  27103. 197: uint8(_BT_NMSTRT),
  27104. 198: uint8(_BT_NMSTRT),
  27105. 199: uint8(_BT_NMSTRT),
  27106. 200: uint8(_BT_NMSTRT),
  27107. 201: uint8(_BT_NMSTRT),
  27108. 202: uint8(_BT_NMSTRT),
  27109. 203: uint8(_BT_NMSTRT),
  27110. 204: uint8(_BT_NMSTRT),
  27111. 205: uint8(_BT_NMSTRT),
  27112. 206: uint8(_BT_NMSTRT),
  27113. 207: uint8(_BT_NMSTRT),
  27114. 208: uint8(_BT_NMSTRT),
  27115. 209: uint8(_BT_NMSTRT),
  27116. 210: uint8(_BT_NMSTRT),
  27117. 211: uint8(_BT_NMSTRT),
  27118. 212: uint8(_BT_NMSTRT),
  27119. 213: uint8(_BT_NMSTRT),
  27120. 214: uint8(_BT_NMSTRT),
  27121. 215: uint8(_BT_OTHER),
  27122. 216: uint8(_BT_NMSTRT),
  27123. 217: uint8(_BT_NMSTRT),
  27124. 218: uint8(_BT_NMSTRT),
  27125. 219: uint8(_BT_NMSTRT),
  27126. 220: uint8(_BT_NMSTRT),
  27127. 221: uint8(_BT_NMSTRT),
  27128. 222: uint8(_BT_NMSTRT),
  27129. 223: uint8(_BT_NMSTRT),
  27130. 224: uint8(_BT_NMSTRT),
  27131. 225: uint8(_BT_NMSTRT),
  27132. 226: uint8(_BT_NMSTRT),
  27133. 227: uint8(_BT_NMSTRT),
  27134. 228: uint8(_BT_NMSTRT),
  27135. 229: uint8(_BT_NMSTRT),
  27136. 230: uint8(_BT_NMSTRT),
  27137. 231: uint8(_BT_NMSTRT),
  27138. 232: uint8(_BT_NMSTRT),
  27139. 233: uint8(_BT_NMSTRT),
  27140. 234: uint8(_BT_NMSTRT),
  27141. 235: uint8(_BT_NMSTRT),
  27142. 236: uint8(_BT_NMSTRT),
  27143. 237: uint8(_BT_NMSTRT),
  27144. 238: uint8(_BT_NMSTRT),
  27145. 239: uint8(_BT_NMSTRT),
  27146. 240: uint8(_BT_NMSTRT),
  27147. 241: uint8(_BT_NMSTRT),
  27148. 242: uint8(_BT_NMSTRT),
  27149. 243: uint8(_BT_NMSTRT),
  27150. 244: uint8(_BT_NMSTRT),
  27151. 245: uint8(_BT_NMSTRT),
  27152. 246: uint8(_BT_NMSTRT),
  27153. 247: uint8(_BT_OTHER),
  27154. 248: uint8(_BT_NMSTRT),
  27155. 249: uint8(_BT_NMSTRT),
  27156. 250: uint8(_BT_NMSTRT),
  27157. 251: uint8(_BT_NMSTRT),
  27158. 252: uint8(_BT_NMSTRT),
  27159. 253: uint8(_BT_NMSTRT),
  27160. 254: uint8(_BT_NMSTRT),
  27161. 255: uint8(_BT_NMSTRT),
  27162. },
  27163. }
  27164. func init() {
  27165. p := unsafe.Pointer(&_big2_encoding_ns)
  27166. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_big2_prologTok)
  27167. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_big2_contentTok)
  27168. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_big2_cdataSectionTok)
  27169. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_big2_ignoreSectionTok)
  27170. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_big2_attributeValueTok)
  27171. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_big2_entityValueTok)
  27172. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_big2_nameMatchesAscii)
  27173. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_big2_nameLength)
  27174. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_big2_skipS)
  27175. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_big2_getAtts)
  27176. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_big2_charRefNumber)
  27177. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_big2_predefinedEntityName)
  27178. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_big2_updatePosition)
  27179. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_big2_isPublicId)
  27180. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_big2_toUtf8)
  27181. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_big2_toUtf16)
  27182. }
  27183. var _big2_encoding = Tnormal_encoding{
  27184. Fenc: TENCODING{
  27185. Fscanners: [4]TSCANNER{},
  27186. FliteralScanners: [2]TSCANNER{},
  27187. FminBytesPerChar: int32(2),
  27188. },
  27189. Ftype1: [256]uint8{
  27190. 9: uint8(_BT_S),
  27191. 10: uint8(_BT_LF),
  27192. 13: uint8(_BT_CR),
  27193. 32: uint8(_BT_S),
  27194. 33: uint8(_BT_EXCL),
  27195. 34: uint8(_BT_QUOT),
  27196. 35: uint8(_BT_NUM),
  27197. 36: uint8(_BT_OTHER),
  27198. 37: uint8(_BT_PERCNT),
  27199. 38: uint8(_BT_AMP),
  27200. 39: uint8(_BT_APOS),
  27201. 40: uint8(_BT_LPAR),
  27202. 41: uint8(_BT_RPAR),
  27203. 42: uint8(_BT_AST),
  27204. 43: uint8(_BT_PLUS),
  27205. 44: uint8(_BT_COMMA),
  27206. 45: uint8(_BT_MINUS),
  27207. 46: uint8(_BT_NAME),
  27208. 47: uint8(_BT_SOL),
  27209. 48: uint8(_BT_DIGIT),
  27210. 49: uint8(_BT_DIGIT),
  27211. 50: uint8(_BT_DIGIT),
  27212. 51: uint8(_BT_DIGIT),
  27213. 52: uint8(_BT_DIGIT),
  27214. 53: uint8(_BT_DIGIT),
  27215. 54: uint8(_BT_DIGIT),
  27216. 55: uint8(_BT_DIGIT),
  27217. 56: uint8(_BT_DIGIT),
  27218. 57: uint8(_BT_DIGIT),
  27219. 58: uint8(_BT_NMSTRT),
  27220. 59: uint8(_BT_SEMI),
  27221. 60: uint8(_BT_LT),
  27222. 61: uint8(_BT_EQUALS),
  27223. 62: uint8(_BT_GT),
  27224. 63: uint8(_BT_QUEST),
  27225. 64: uint8(_BT_OTHER),
  27226. 65: uint8(_BT_HEX),
  27227. 66: uint8(_BT_HEX),
  27228. 67: uint8(_BT_HEX),
  27229. 68: uint8(_BT_HEX),
  27230. 69: uint8(_BT_HEX),
  27231. 70: uint8(_BT_HEX),
  27232. 71: uint8(_BT_NMSTRT),
  27233. 72: uint8(_BT_NMSTRT),
  27234. 73: uint8(_BT_NMSTRT),
  27235. 74: uint8(_BT_NMSTRT),
  27236. 75: uint8(_BT_NMSTRT),
  27237. 76: uint8(_BT_NMSTRT),
  27238. 77: uint8(_BT_NMSTRT),
  27239. 78: uint8(_BT_NMSTRT),
  27240. 79: uint8(_BT_NMSTRT),
  27241. 80: uint8(_BT_NMSTRT),
  27242. 81: uint8(_BT_NMSTRT),
  27243. 82: uint8(_BT_NMSTRT),
  27244. 83: uint8(_BT_NMSTRT),
  27245. 84: uint8(_BT_NMSTRT),
  27246. 85: uint8(_BT_NMSTRT),
  27247. 86: uint8(_BT_NMSTRT),
  27248. 87: uint8(_BT_NMSTRT),
  27249. 88: uint8(_BT_NMSTRT),
  27250. 89: uint8(_BT_NMSTRT),
  27251. 90: uint8(_BT_NMSTRT),
  27252. 91: uint8(_BT_LSQB),
  27253. 92: uint8(_BT_OTHER),
  27254. 93: uint8(_BT_RSQB),
  27255. 94: uint8(_BT_OTHER),
  27256. 95: uint8(_BT_NMSTRT),
  27257. 96: uint8(_BT_OTHER),
  27258. 97: uint8(_BT_HEX),
  27259. 98: uint8(_BT_HEX),
  27260. 99: uint8(_BT_HEX),
  27261. 100: uint8(_BT_HEX),
  27262. 101: uint8(_BT_HEX),
  27263. 102: uint8(_BT_HEX),
  27264. 103: uint8(_BT_NMSTRT),
  27265. 104: uint8(_BT_NMSTRT),
  27266. 105: uint8(_BT_NMSTRT),
  27267. 106: uint8(_BT_NMSTRT),
  27268. 107: uint8(_BT_NMSTRT),
  27269. 108: uint8(_BT_NMSTRT),
  27270. 109: uint8(_BT_NMSTRT),
  27271. 110: uint8(_BT_NMSTRT),
  27272. 111: uint8(_BT_NMSTRT),
  27273. 112: uint8(_BT_NMSTRT),
  27274. 113: uint8(_BT_NMSTRT),
  27275. 114: uint8(_BT_NMSTRT),
  27276. 115: uint8(_BT_NMSTRT),
  27277. 116: uint8(_BT_NMSTRT),
  27278. 117: uint8(_BT_NMSTRT),
  27279. 118: uint8(_BT_NMSTRT),
  27280. 119: uint8(_BT_NMSTRT),
  27281. 120: uint8(_BT_NMSTRT),
  27282. 121: uint8(_BT_NMSTRT),
  27283. 122: uint8(_BT_NMSTRT),
  27284. 123: uint8(_BT_OTHER),
  27285. 124: uint8(_BT_VERBAR),
  27286. 125: uint8(_BT_OTHER),
  27287. 126: uint8(_BT_OTHER),
  27288. 127: uint8(_BT_OTHER),
  27289. 128: uint8(_BT_OTHER),
  27290. 129: uint8(_BT_OTHER),
  27291. 130: uint8(_BT_OTHER),
  27292. 131: uint8(_BT_OTHER),
  27293. 132: uint8(_BT_OTHER),
  27294. 133: uint8(_BT_OTHER),
  27295. 134: uint8(_BT_OTHER),
  27296. 135: uint8(_BT_OTHER),
  27297. 136: uint8(_BT_OTHER),
  27298. 137: uint8(_BT_OTHER),
  27299. 138: uint8(_BT_OTHER),
  27300. 139: uint8(_BT_OTHER),
  27301. 140: uint8(_BT_OTHER),
  27302. 141: uint8(_BT_OTHER),
  27303. 142: uint8(_BT_OTHER),
  27304. 143: uint8(_BT_OTHER),
  27305. 144: uint8(_BT_OTHER),
  27306. 145: uint8(_BT_OTHER),
  27307. 146: uint8(_BT_OTHER),
  27308. 147: uint8(_BT_OTHER),
  27309. 148: uint8(_BT_OTHER),
  27310. 149: uint8(_BT_OTHER),
  27311. 150: uint8(_BT_OTHER),
  27312. 151: uint8(_BT_OTHER),
  27313. 152: uint8(_BT_OTHER),
  27314. 153: uint8(_BT_OTHER),
  27315. 154: uint8(_BT_OTHER),
  27316. 155: uint8(_BT_OTHER),
  27317. 156: uint8(_BT_OTHER),
  27318. 157: uint8(_BT_OTHER),
  27319. 158: uint8(_BT_OTHER),
  27320. 159: uint8(_BT_OTHER),
  27321. 160: uint8(_BT_OTHER),
  27322. 161: uint8(_BT_OTHER),
  27323. 162: uint8(_BT_OTHER),
  27324. 163: uint8(_BT_OTHER),
  27325. 164: uint8(_BT_OTHER),
  27326. 165: uint8(_BT_OTHER),
  27327. 166: uint8(_BT_OTHER),
  27328. 167: uint8(_BT_OTHER),
  27329. 168: uint8(_BT_OTHER),
  27330. 169: uint8(_BT_OTHER),
  27331. 170: uint8(_BT_NMSTRT),
  27332. 171: uint8(_BT_OTHER),
  27333. 172: uint8(_BT_OTHER),
  27334. 173: uint8(_BT_OTHER),
  27335. 174: uint8(_BT_OTHER),
  27336. 175: uint8(_BT_OTHER),
  27337. 176: uint8(_BT_OTHER),
  27338. 177: uint8(_BT_OTHER),
  27339. 178: uint8(_BT_OTHER),
  27340. 179: uint8(_BT_OTHER),
  27341. 180: uint8(_BT_OTHER),
  27342. 181: uint8(_BT_NMSTRT),
  27343. 182: uint8(_BT_OTHER),
  27344. 183: uint8(_BT_NAME),
  27345. 184: uint8(_BT_OTHER),
  27346. 185: uint8(_BT_OTHER),
  27347. 186: uint8(_BT_NMSTRT),
  27348. 187: uint8(_BT_OTHER),
  27349. 188: uint8(_BT_OTHER),
  27350. 189: uint8(_BT_OTHER),
  27351. 190: uint8(_BT_OTHER),
  27352. 191: uint8(_BT_OTHER),
  27353. 192: uint8(_BT_NMSTRT),
  27354. 193: uint8(_BT_NMSTRT),
  27355. 194: uint8(_BT_NMSTRT),
  27356. 195: uint8(_BT_NMSTRT),
  27357. 196: uint8(_BT_NMSTRT),
  27358. 197: uint8(_BT_NMSTRT),
  27359. 198: uint8(_BT_NMSTRT),
  27360. 199: uint8(_BT_NMSTRT),
  27361. 200: uint8(_BT_NMSTRT),
  27362. 201: uint8(_BT_NMSTRT),
  27363. 202: uint8(_BT_NMSTRT),
  27364. 203: uint8(_BT_NMSTRT),
  27365. 204: uint8(_BT_NMSTRT),
  27366. 205: uint8(_BT_NMSTRT),
  27367. 206: uint8(_BT_NMSTRT),
  27368. 207: uint8(_BT_NMSTRT),
  27369. 208: uint8(_BT_NMSTRT),
  27370. 209: uint8(_BT_NMSTRT),
  27371. 210: uint8(_BT_NMSTRT),
  27372. 211: uint8(_BT_NMSTRT),
  27373. 212: uint8(_BT_NMSTRT),
  27374. 213: uint8(_BT_NMSTRT),
  27375. 214: uint8(_BT_NMSTRT),
  27376. 215: uint8(_BT_OTHER),
  27377. 216: uint8(_BT_NMSTRT),
  27378. 217: uint8(_BT_NMSTRT),
  27379. 218: uint8(_BT_NMSTRT),
  27380. 219: uint8(_BT_NMSTRT),
  27381. 220: uint8(_BT_NMSTRT),
  27382. 221: uint8(_BT_NMSTRT),
  27383. 222: uint8(_BT_NMSTRT),
  27384. 223: uint8(_BT_NMSTRT),
  27385. 224: uint8(_BT_NMSTRT),
  27386. 225: uint8(_BT_NMSTRT),
  27387. 226: uint8(_BT_NMSTRT),
  27388. 227: uint8(_BT_NMSTRT),
  27389. 228: uint8(_BT_NMSTRT),
  27390. 229: uint8(_BT_NMSTRT),
  27391. 230: uint8(_BT_NMSTRT),
  27392. 231: uint8(_BT_NMSTRT),
  27393. 232: uint8(_BT_NMSTRT),
  27394. 233: uint8(_BT_NMSTRT),
  27395. 234: uint8(_BT_NMSTRT),
  27396. 235: uint8(_BT_NMSTRT),
  27397. 236: uint8(_BT_NMSTRT),
  27398. 237: uint8(_BT_NMSTRT),
  27399. 238: uint8(_BT_NMSTRT),
  27400. 239: uint8(_BT_NMSTRT),
  27401. 240: uint8(_BT_NMSTRT),
  27402. 241: uint8(_BT_NMSTRT),
  27403. 242: uint8(_BT_NMSTRT),
  27404. 243: uint8(_BT_NMSTRT),
  27405. 244: uint8(_BT_NMSTRT),
  27406. 245: uint8(_BT_NMSTRT),
  27407. 246: uint8(_BT_NMSTRT),
  27408. 247: uint8(_BT_OTHER),
  27409. 248: uint8(_BT_NMSTRT),
  27410. 249: uint8(_BT_NMSTRT),
  27411. 250: uint8(_BT_NMSTRT),
  27412. 251: uint8(_BT_NMSTRT),
  27413. 252: uint8(_BT_NMSTRT),
  27414. 253: uint8(_BT_NMSTRT),
  27415. 254: uint8(_BT_NMSTRT),
  27416. 255: uint8(_BT_NMSTRT),
  27417. },
  27418. }
  27419. func init() {
  27420. p := unsafe.Pointer(&_big2_encoding)
  27421. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_big2_prologTok)
  27422. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_big2_contentTok)
  27423. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_big2_cdataSectionTok)
  27424. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_big2_ignoreSectionTok)
  27425. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_big2_attributeValueTok)
  27426. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_big2_entityValueTok)
  27427. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_big2_nameMatchesAscii)
  27428. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_big2_nameLength)
  27429. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_big2_skipS)
  27430. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_big2_getAtts)
  27431. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_big2_charRefNumber)
  27432. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_big2_predefinedEntityName)
  27433. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_big2_updatePosition)
  27434. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_big2_isPublicId)
  27435. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_big2_toUtf8)
  27436. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_big2_toUtf16)
  27437. }
  27438. func _streqci(tls *libc.TLS, s1 uintptr, s2 uintptr) (r int32) {
  27439. var c1, c2 int8
  27440. var v2, v3 uintptr
  27441. _, _, _, _ = c1, c2, v2, v3
  27442. for {
  27443. v2 = s1
  27444. s1++
  27445. c1 = *(*int8)(unsafe.Pointer(v2))
  27446. v3 = s2
  27447. s2++
  27448. c2 = *(*int8)(unsafe.Pointer(v3))
  27449. if int32(m_ASCII_a2) <= int32(c1) && int32(c1) <= int32(m_ASCII_z1) {
  27450. c1 = int8(int32(c1) + (libc.Int32FromInt32(m_ASCII_A) - libc.Int32FromInt32(m_ASCII_a2)))
  27451. }
  27452. if int32(m_ASCII_a2) <= int32(c2) && int32(c2) <= int32(m_ASCII_z1) {
  27453. /* The following line will never get executed. streqci() is
  27454. * only called from two places, both of which guarantee to put
  27455. * upper-case strings into s2.
  27456. */
  27457. c2 = int8(int32(c2) + (libc.Int32FromInt32(m_ASCII_A) - libc.Int32FromInt32(m_ASCII_a2)))
  27458. } /* LCOV_EXCL_LINE */
  27459. if int32(c1) != int32(c2) {
  27460. return 0
  27461. }
  27462. if !(c1 != 0) {
  27463. break
  27464. }
  27465. goto _1
  27466. _1:
  27467. }
  27468. return int32(1)
  27469. }
  27470. func _initUpdatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  27471. _ = enc
  27472. _normal_updatePosition(tls, uintptr(unsafe.Pointer(&_utf8_encoding)), ptr, end, pos)
  27473. }
  27474. func _toAscii(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr) (r int32) {
  27475. bp := tls.Alloc(32)
  27476. defer tls.Free(32)
  27477. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  27478. var _ /* buf at bp+8 */ [1]int8
  27479. var _ /* p at bp+16 */ uintptr
  27480. *(*uintptr)(unsafe.Pointer(bp + 16)) = bp + 8
  27481. (*(*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))
  27482. if *(*uintptr)(unsafe.Pointer(bp + 16)) == bp+8 {
  27483. return -int32(1)
  27484. } else {
  27485. return int32((*(*[1]int8)(unsafe.Pointer(bp + 8)))[0])
  27486. }
  27487. return r
  27488. }
  27489. func _isSpace(tls *libc.TLS, c int32) (r int32) {
  27490. switch c {
  27491. case int32(0x20):
  27492. fallthrough
  27493. case int32(0xD):
  27494. fallthrough
  27495. case int32(0xA):
  27496. fallthrough
  27497. case int32(0x9):
  27498. return int32(1)
  27499. }
  27500. return 0
  27501. }
  27502. // C documentation
  27503. //
  27504. // /* Return 1 if there's just optional white space or there's an S
  27505. // followed by name=val.
  27506. // */
  27507. func _parsePseudoAttribute(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, namePtr uintptr, nameEndPtr uintptr, valPtr uintptr, nextTokPtr uintptr) (r int32) {
  27508. var c, v2 int32
  27509. var open int8
  27510. _, _, _ = c, open, v2
  27511. if ptr == end {
  27512. *(*uintptr)(unsafe.Pointer(namePtr)) = libc.UintptrFromInt32(0)
  27513. return int32(1)
  27514. }
  27515. if !(_isSpace(tls, _toAscii(tls, enc, ptr, end)) != 0) {
  27516. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27517. return 0
  27518. }
  27519. for cond := true; cond; cond = _isSpace(tls, _toAscii(tls, enc, ptr, end)) != 0 {
  27520. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27521. }
  27522. if ptr == end {
  27523. *(*uintptr)(unsafe.Pointer(namePtr)) = libc.UintptrFromInt32(0)
  27524. return int32(1)
  27525. }
  27526. *(*uintptr)(unsafe.Pointer(namePtr)) = ptr
  27527. for {
  27528. c = _toAscii(tls, enc, ptr, end)
  27529. if c == -int32(1) {
  27530. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27531. return 0
  27532. }
  27533. if c == int32(m_ASCII_EQUALS2) {
  27534. *(*uintptr)(unsafe.Pointer(nameEndPtr)) = ptr
  27535. break
  27536. }
  27537. if _isSpace(tls, c) != 0 {
  27538. *(*uintptr)(unsafe.Pointer(nameEndPtr)) = ptr
  27539. for {
  27540. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27541. goto _3
  27542. _3:
  27543. ;
  27544. v2 = _toAscii(tls, enc, ptr, end)
  27545. c = v2
  27546. if !(_isSpace(tls, v2) != 0) {
  27547. break
  27548. }
  27549. }
  27550. if c != int32(m_ASCII_EQUALS2) {
  27551. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27552. return 0
  27553. }
  27554. break
  27555. }
  27556. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27557. goto _1
  27558. _1:
  27559. }
  27560. if ptr == *(*uintptr)(unsafe.Pointer(namePtr)) {
  27561. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27562. return 0
  27563. }
  27564. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27565. c = _toAscii(tls, enc, ptr, end)
  27566. for _isSpace(tls, c) != 0 {
  27567. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27568. c = _toAscii(tls, enc, ptr, end)
  27569. }
  27570. if c != int32(m_ASCII_QUOT1) && c != int32(m_ASCII_APOS1) {
  27571. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27572. return 0
  27573. }
  27574. open = int8(c)
  27575. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27576. *(*uintptr)(unsafe.Pointer(valPtr)) = ptr
  27577. for {
  27578. c = _toAscii(tls, enc, ptr, end)
  27579. if c == int32(open) {
  27580. break
  27581. }
  27582. 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) {
  27583. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27584. return 0
  27585. }
  27586. goto _4
  27587. _4:
  27588. ;
  27589. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27590. }
  27591. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27592. return int32(1)
  27593. }
  27594. var _KW_version = [8]int8{
  27595. 0: int8(m_ASCII_v1),
  27596. 1: int8(m_ASCII_e2),
  27597. 2: int8(m_ASCII_r2),
  27598. 3: int8(m_ASCII_s2),
  27599. 4: int8(m_ASCII_i1),
  27600. 5: int8(m_ASCII_o2),
  27601. 6: int8(m_ASCII_n2),
  27602. }
  27603. var _KW_encoding = [9]int8{
  27604. 0: int8(m_ASCII_e2),
  27605. 1: int8(m_ASCII_n2),
  27606. 2: int8(m_ASCII_c2),
  27607. 3: int8(m_ASCII_o2),
  27608. 4: int8(m_ASCII_d1),
  27609. 5: int8(m_ASCII_i1),
  27610. 6: int8(m_ASCII_n2),
  27611. 7: int8(m_ASCII_g2),
  27612. }
  27613. var _KW_standalone = [11]int8{
  27614. 0: int8(m_ASCII_s2),
  27615. 1: int8(m_ASCII_t2),
  27616. 2: int8(m_ASCII_a2),
  27617. 3: int8(m_ASCII_n2),
  27618. 4: int8(m_ASCII_d1),
  27619. 5: int8(m_ASCII_a2),
  27620. 6: int8(m_ASCII_l2),
  27621. 7: int8(m_ASCII_o2),
  27622. 8: int8(m_ASCII_n2),
  27623. 9: int8(m_ASCII_e2),
  27624. }
  27625. var _KW_yes = [4]int8{
  27626. 0: int8(m_ASCII_y1),
  27627. 1: int8(m_ASCII_e2),
  27628. 2: int8(m_ASCII_s2),
  27629. }
  27630. var _KW_no = [3]int8{
  27631. 0: int8(m_ASCII_n2),
  27632. 1: int8(m_ASCII_o2),
  27633. }
  27634. 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) {
  27635. bp := tls.Alloc(32)
  27636. defer tls.Free(32)
  27637. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  27638. var c int32
  27639. var _ /* name at bp+16 */ uintptr
  27640. var _ /* nameEnd at bp+24 */ uintptr
  27641. var _ /* val at bp+8 */ uintptr
  27642. _ = c
  27643. *(*uintptr)(unsafe.Pointer(bp + 8)) = libc.UintptrFromInt32(0)
  27644. *(*uintptr)(unsafe.Pointer(bp + 16)) = libc.UintptrFromInt32(0)
  27645. *(*uintptr)(unsafe.Pointer(bp + 24)) = libc.UintptrFromInt32(0)
  27646. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(int32(5) * (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27647. end -= uintptr(int32(2) * (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27648. if !(_parsePseudoAttribute(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+16, bp+24, bp+8, bp) != 0) || !(*(*uintptr)(unsafe.Pointer(bp + 16)) != 0) {
  27649. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27650. return 0
  27651. }
  27652. 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) {
  27653. if !(isGeneralTextEntity != 0) {
  27654. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 16))
  27655. return 0
  27656. }
  27657. } else {
  27658. if versionPtr != 0 {
  27659. *(*uintptr)(unsafe.Pointer(versionPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  27660. }
  27661. if versionEndPtr != 0 {
  27662. *(*uintptr)(unsafe.Pointer(versionEndPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27663. }
  27664. if !(_parsePseudoAttribute(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+16, bp+24, bp+8, bp) != 0) {
  27665. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27666. return 0
  27667. }
  27668. if !(*(*uintptr)(unsafe.Pointer(bp + 16)) != 0) {
  27669. if isGeneralTextEntity != 0 {
  27670. /* a TextDecl must have an EncodingDecl */
  27671. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27672. return 0
  27673. }
  27674. return int32(1)
  27675. }
  27676. }
  27677. 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 {
  27678. c = _toAscii(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 8)), end)
  27679. if !(int32(m_ASCII_a2) <= c && c <= int32(m_ASCII_z1)) && !(int32(m_ASCII_A) <= c && c <= int32(m_ASCII_Z1)) {
  27680. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  27681. return 0
  27682. }
  27683. if encodingName != 0 {
  27684. *(*uintptr)(unsafe.Pointer(encodingName)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  27685. }
  27686. if encoding != 0 {
  27687. *(*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))
  27688. }
  27689. if !(_parsePseudoAttribute(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+16, bp+24, bp+8, bp) != 0) {
  27690. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27691. return 0
  27692. }
  27693. if !(*(*uintptr)(unsafe.Pointer(bp + 16)) != 0) {
  27694. return int32(1)
  27695. }
  27696. }
  27697. 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 {
  27698. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 16))
  27699. return 0
  27700. }
  27701. 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 {
  27702. if standalone != 0 {
  27703. *(*int32)(unsafe.Pointer(standalone)) = int32(1)
  27704. }
  27705. } else {
  27706. 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 {
  27707. if standalone != 0 {
  27708. *(*int32)(unsafe.Pointer(standalone)) = 0
  27709. }
  27710. } else {
  27711. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  27712. return 0
  27713. }
  27714. }
  27715. for _isSpace(tls, _toAscii(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end)) != 0 {
  27716. *(*uintptr)(unsafe.Pointer(bp)) += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27717. }
  27718. if *(*uintptr)(unsafe.Pointer(bp)) != end {
  27719. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27720. return 0
  27721. }
  27722. return int32(1)
  27723. }
  27724. func _checkCharRefNumber(tls *libc.TLS, result int32) (r int32) {
  27725. switch result >> libc.Int32FromInt32(8) {
  27726. case int32(0xD8):
  27727. fallthrough
  27728. case int32(0xD9):
  27729. fallthrough
  27730. case int32(0xDA):
  27731. fallthrough
  27732. case int32(0xDB):
  27733. fallthrough
  27734. case int32(0xDC):
  27735. fallthrough
  27736. case int32(0xDD):
  27737. fallthrough
  27738. case int32(0xDE):
  27739. fallthrough
  27740. case int32(0xDF):
  27741. return -int32(1)
  27742. case 0:
  27743. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(result)))) == int32(_BT_NONXML) {
  27744. return -int32(1)
  27745. }
  27746. case int32(0xFF):
  27747. if result == int32(0xFFFE) || result == int32(0xFFFF) {
  27748. return -int32(1)
  27749. }
  27750. break
  27751. }
  27752. return result
  27753. }
  27754. func XXmlUtf8Encode(tls *libc.TLS, c int32, buf uintptr) (r int32) {
  27755. if c < 0 {
  27756. return 0
  27757. } /* LCOV_EXCL_LINE: this case is always eliminated beforehand */
  27758. if c < 128 {
  27759. *(*int8)(unsafe.Pointer(buf)) = int8(c | int32(_UTF8_cval1))
  27760. return int32(1)
  27761. }
  27762. if c < 2048 {
  27763. *(*int8)(unsafe.Pointer(buf)) = int8(c>>libc.Int32FromInt32(6) | int32(_UTF8_cval2))
  27764. *(*int8)(unsafe.Pointer(buf + 1)) = int8(c&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27765. return int32(2)
  27766. }
  27767. if c < 65536 {
  27768. *(*int8)(unsafe.Pointer(buf)) = int8(c>>libc.Int32FromInt32(12) | int32(_UTF8_cval3))
  27769. *(*int8)(unsafe.Pointer(buf + 1)) = int8(c>>libc.Int32FromInt32(6)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27770. *(*int8)(unsafe.Pointer(buf + 2)) = int8(c&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27771. return int32(3)
  27772. }
  27773. if c < int32(0x110000) {
  27774. *(*int8)(unsafe.Pointer(buf)) = int8(c>>libc.Int32FromInt32(18) | int32(_UTF8_cval4))
  27775. *(*int8)(unsafe.Pointer(buf + 1)) = int8(c>>libc.Int32FromInt32(12)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27776. *(*int8)(unsafe.Pointer(buf + 2)) = int8(c>>libc.Int32FromInt32(6)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27777. *(*int8)(unsafe.Pointer(buf + 3)) = int8(c&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27778. return int32(4)
  27779. }
  27780. return 0 /* LCOV_EXCL_LINE: this case too is eliminated before calling */
  27781. }
  27782. func XXmlUtf16Encode(tls *libc.TLS, charNum int32, buf uintptr) (r int32) {
  27783. if charNum < 0 {
  27784. return 0
  27785. }
  27786. if charNum < int32(0x10000) {
  27787. *(*uint16)(unsafe.Pointer(buf)) = libc.Uint16FromInt32(charNum)
  27788. return int32(1)
  27789. }
  27790. if charNum < int32(0x110000) {
  27791. charNum -= int32(0x10000)
  27792. *(*uint16)(unsafe.Pointer(buf)) = libc.Uint16FromInt32(charNum>>libc.Int32FromInt32(10) + libc.Int32FromInt32(0xD800))
  27793. *(*uint16)(unsafe.Pointer(buf + 1*2)) = libc.Uint16FromInt32(charNum&libc.Int32FromInt32(0x3FF) + libc.Int32FromInt32(0xDC00))
  27794. return int32(2)
  27795. }
  27796. return 0
  27797. }
  27798. type Tunknown_encoding = struct {
  27799. Fnormal Tnormal_encoding
  27800. Fconvert TCONVERTER
  27801. FuserData uintptr
  27802. Futf16 [256]uint16
  27803. Futf8 [256][4]int8
  27804. }
  27805. func XXmlSizeOfUnknownEncoding(tls *libc.TLS) (r int32) {
  27806. return int32(2016)
  27807. }
  27808. func _unknown_isName(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  27809. var c int32
  27810. var uenc uintptr
  27811. _, _ = c, uenc
  27812. uenc = enc
  27813. 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)
  27814. if c & ^libc.Int32FromInt32(0xFFFF) != 0 {
  27815. return 0
  27816. }
  27817. 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))))
  27818. }
  27819. func _unknown_isNmstrt(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  27820. var c int32
  27821. var uenc uintptr
  27822. _, _ = c, uenc
  27823. uenc = enc
  27824. 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)
  27825. if c & ^libc.Int32FromInt32(0xFFFF) != 0 {
  27826. return 0
  27827. }
  27828. 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))))
  27829. }
  27830. func _unknown_isInvalid(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  27831. var c int32
  27832. var uenc uintptr
  27833. _, _ = c, uenc
  27834. uenc = enc
  27835. 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)
  27836. return libc.BoolInt32(c & ^libc.Int32FromInt32(0xFFFF) != 0 || _checkCharRefNumber(tls, c) < 0)
  27837. }
  27838. func _unknown_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  27839. bp := tls.Alloc(16)
  27840. defer tls.Free(16)
  27841. var c, n int32
  27842. var uenc, utf8, v2 uintptr
  27843. var _ /* buf at bp+0 */ [4]int8
  27844. _, _, _, _, _ = c, n, uenc, utf8, v2
  27845. uenc = enc
  27846. for {
  27847. if *(*uintptr)(unsafe.Pointer(fromP)) == fromLim {
  27848. return int32(_XML_CONVERT_COMPLETED)
  27849. }
  27850. utf8 = uenc + 992 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP))))))*4
  27851. v2 = utf8
  27852. utf8++
  27853. n = int32(*(*int8)(unsafe.Pointer(v2)))
  27854. if n == 0 {
  27855. 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)))
  27856. n = XXmlUtf8Encode(tls, c, bp)
  27857. if int64(n) > int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) {
  27858. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  27859. }
  27860. utf8 = bp
  27861. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP))))))))) - (int32(_BT_LEAD2) - libc.Int32FromInt32(2)))
  27862. } else {
  27863. if int64(n) > int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) {
  27864. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  27865. }
  27866. *(*uintptr)(unsafe.Pointer(fromP))++
  27867. }
  27868. libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(toP)), utf8, libc.Uint64FromInt32(n))
  27869. *(*uintptr)(unsafe.Pointer(toP)) += uintptr(n)
  27870. goto _1
  27871. _1:
  27872. }
  27873. return r
  27874. }
  27875. func _unknown_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  27876. var c uint16
  27877. var uenc, v1, v2 uintptr
  27878. _, _, _, _ = c, uenc, v1, v2
  27879. uenc = enc
  27880. for *(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim {
  27881. c = *(*uint16)(unsafe.Pointer(uenc + 480 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP))))))*2))
  27882. if libc.Int32FromUint16(c) == 0 {
  27883. 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))))
  27884. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP))))))))) - (int32(_BT_LEAD2) - libc.Int32FromInt32(2)))
  27885. } else {
  27886. *(*uintptr)(unsafe.Pointer(fromP))++
  27887. }
  27888. v2 = toP
  27889. v1 = *(*uintptr)(unsafe.Pointer(v2))
  27890. *(*uintptr)(unsafe.Pointer(v2)) += 2
  27891. *(*uint16)(unsafe.Pointer(v1)) = c
  27892. }
  27893. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  27894. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  27895. } else {
  27896. return int32(_XML_CONVERT_COMPLETED)
  27897. }
  27898. return r
  27899. }
  27900. func XXmlInitUnknownEncoding(tls *libc.TLS, mem uintptr, table uintptr, convert TCONVERTER, userData uintptr) (r uintptr) {
  27901. var c, i, v3 int32
  27902. var e uintptr
  27903. _, _, _, _ = c, e, i, v3
  27904. e = mem
  27905. libc.Xmemcpy(tls, mem, uintptr(unsafe.Pointer(&_latin1_encoding)), uint64(464))
  27906. i = 0
  27907. for {
  27908. if !(i < int32(128)) {
  27909. break
  27910. }
  27911. 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 {
  27912. return uintptr(0)
  27913. }
  27914. goto _1
  27915. _1:
  27916. ;
  27917. i++
  27918. }
  27919. i = 0
  27920. for {
  27921. if !(i < int32(256)) {
  27922. break
  27923. }
  27924. c = *(*int32)(unsafe.Pointer(table + uintptr(i)*4))
  27925. if c == -int32(1) {
  27926. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_MALFORM)
  27927. /* This shouldn't really get used. */
  27928. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = uint16(0xFFFF)
  27929. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = int8(1)
  27930. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4 + 1)) = 0
  27931. } else {
  27932. if c < 0 {
  27933. if c < -int32(4) {
  27934. return uintptr(0)
  27935. }
  27936. /* Multi-byte sequences need a converter function */
  27937. if !(convert != 0) {
  27938. return uintptr(0)
  27939. }
  27940. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = libc.Uint8FromInt32(int32(_BT_LEAD2) - (c + libc.Int32FromInt32(2)))
  27941. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = 0
  27942. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = uint16(0)
  27943. } else {
  27944. if c < int32(0x80) {
  27945. 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 {
  27946. return uintptr(0)
  27947. }
  27948. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = *(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(c)))
  27949. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = int8(1)
  27950. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4 + 1)) = int8(c)
  27951. if c == 0 {
  27952. v3 = int32(0xFFFF)
  27953. } else {
  27954. v3 = c
  27955. }
  27956. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = libc.Uint16FromInt32(v3)
  27957. } else {
  27958. if _checkCharRefNumber(tls, c) < 0 {
  27959. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_NONXML)
  27960. /* This shouldn't really get used. */
  27961. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = uint16(0xFFFF)
  27962. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = int8(1)
  27963. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4 + 1)) = 0
  27964. } else {
  27965. if c > int32(0xFFFF) {
  27966. return uintptr(0)
  27967. }
  27968. if _namingBitmap[libc.Int32FromUint8(_nmstrtPages[c>>int32(8)])<<int32(3)+c&int32(0xff)>>int32(5)]&(uint32(1)<<(c&int32(0xff)&int32(0x1F))) != 0 {
  27969. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_NMSTRT)
  27970. } else {
  27971. if _namingBitmap[libc.Int32FromUint8(_namePages[c>>int32(8)])<<int32(3)+c&int32(0xff)>>int32(5)]&(uint32(1)<<(c&int32(0xff)&int32(0x1F))) != 0 {
  27972. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_NAME)
  27973. } else {
  27974. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_OTHER)
  27975. }
  27976. }
  27977. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = int8(XXmlUtf8Encode(tls, c, e+992+uintptr(i)*4+uintptr(1)))
  27978. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = libc.Uint16FromInt32(c)
  27979. }
  27980. }
  27981. }
  27982. }
  27983. goto _2
  27984. _2:
  27985. ;
  27986. i++
  27987. }
  27988. (*Tunknown_encoding)(unsafe.Pointer(e)).FuserData = userData
  27989. (*Tunknown_encoding)(unsafe.Pointer(e)).Fconvert = convert
  27990. if convert != 0 {
  27991. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisName2 = __ccgo_fp(_unknown_isName)
  27992. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisName3 = __ccgo_fp(_unknown_isName)
  27993. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisName4 = __ccgo_fp(_unknown_isName)
  27994. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisNmstrt2 = __ccgo_fp(_unknown_isNmstrt)
  27995. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisNmstrt3 = __ccgo_fp(_unknown_isNmstrt)
  27996. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisNmstrt4 = __ccgo_fp(_unknown_isNmstrt)
  27997. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisInvalid2 = __ccgo_fp(_unknown_isInvalid)
  27998. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisInvalid3 = __ccgo_fp(_unknown_isInvalid)
  27999. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisInvalid4 = __ccgo_fp(_unknown_isInvalid)
  28000. }
  28001. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.Fenc.Futf8Convert = __ccgo_fp(_unknown_toUtf8)
  28002. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.Fenc.Futf16Convert = __ccgo_fp(_unknown_toUtf16)
  28003. return e
  28004. }
  28005. const _UNKNOWN_ENC = -1
  28006. const _ISO_8859_1_ENC = 0
  28007. const _US_ASCII_ENC = 1
  28008. const _UTF_8_ENC = 2
  28009. const _UTF_16_ENC = 3
  28010. const _UTF_16BE_ENC = 4
  28011. const _UTF_16LE_ENC = 5
  28012. const
  28013. /* must match encodingNames up to here */
  28014. _NO_ENC = 6
  28015. var _KW_ISO_8859_1 = [11]int8{
  28016. 0: int8(m_ASCII_I),
  28017. 1: int8(m_ASCII_S),
  28018. 2: int8(m_ASCII_O),
  28019. 3: int8(m_ASCII_MINUS1),
  28020. 4: int8(m_ASCII_82),
  28021. 5: int8(m_ASCII_82),
  28022. 6: int8(m_ASCII_51),
  28023. 7: int8(m_ASCII_92),
  28024. 8: int8(m_ASCII_MINUS1),
  28025. 9: int8(m_ASCII_12),
  28026. }
  28027. var _KW_US_ASCII = [9]int8{
  28028. 0: int8(m_ASCII_U1),
  28029. 1: int8(m_ASCII_S),
  28030. 2: int8(m_ASCII_MINUS1),
  28031. 3: int8(m_ASCII_A),
  28032. 4: int8(m_ASCII_S),
  28033. 5: int8(m_ASCII_C),
  28034. 6: int8(m_ASCII_I),
  28035. 7: int8(m_ASCII_I),
  28036. }
  28037. var _KW_UTF_8 = [6]int8{
  28038. 0: int8(m_ASCII_U1),
  28039. 1: int8(m_ASCII_T),
  28040. 2: int8(m_ASCII_F),
  28041. 3: int8(m_ASCII_MINUS1),
  28042. 4: int8(m_ASCII_82),
  28043. }
  28044. var _KW_UTF_16 = [7]int8{
  28045. 0: int8(m_ASCII_U1),
  28046. 1: int8(m_ASCII_T),
  28047. 2: int8(m_ASCII_F),
  28048. 3: int8(m_ASCII_MINUS1),
  28049. 4: int8(m_ASCII_12),
  28050. 5: int8(m_ASCII_61),
  28051. }
  28052. var _KW_UTF_16BE = [9]int8{
  28053. 0: int8(m_ASCII_U1),
  28054. 1: int8(m_ASCII_T),
  28055. 2: int8(m_ASCII_F),
  28056. 3: int8(m_ASCII_MINUS1),
  28057. 4: int8(m_ASCII_12),
  28058. 5: int8(m_ASCII_61),
  28059. 6: int8(m_ASCII_B1),
  28060. 7: int8(m_ASCII_E),
  28061. }
  28062. var _KW_UTF_16LE = [9]int8{
  28063. 0: int8(m_ASCII_U1),
  28064. 1: int8(m_ASCII_T),
  28065. 2: int8(m_ASCII_F),
  28066. 3: int8(m_ASCII_MINUS1),
  28067. 4: int8(m_ASCII_12),
  28068. 5: int8(m_ASCII_61),
  28069. 6: int8(m_ASCII_L),
  28070. 7: int8(m_ASCII_E),
  28071. }
  28072. func _getEncodingIndex(tls *libc.TLS, name uintptr) (r int32) {
  28073. var i int32
  28074. _ = i
  28075. if name == libc.UintptrFromInt32(0) {
  28076. return int32(_NO_ENC)
  28077. }
  28078. i = 0
  28079. for {
  28080. if !(i < libc.Int32FromUint64(libc.Uint64FromInt64(48)/libc.Uint64FromInt64(8))) {
  28081. break
  28082. }
  28083. if _streqci(tls, name, _encodingNames[i]) != 0 {
  28084. return i
  28085. }
  28086. goto _1
  28087. _1:
  28088. ;
  28089. i++
  28090. }
  28091. return int32(_UNKNOWN_ENC)
  28092. }
  28093. var _encodingNames = [6]uintptr{
  28094. 0: uintptr(unsafe.Pointer(&_KW_ISO_8859_1)),
  28095. 1: uintptr(unsafe.Pointer(&_KW_US_ASCII)),
  28096. 2: uintptr(unsafe.Pointer(&_KW_UTF_8)),
  28097. 3: uintptr(unsafe.Pointer(&_KW_UTF_16)),
  28098. 4: uintptr(unsafe.Pointer(&_KW_UTF_16BE)),
  28099. 5: uintptr(unsafe.Pointer(&_KW_UTF_16LE)),
  28100. }
  28101. /* For binary compatibility, we store the index of the encoding
  28102. specified at initialization in the isUtf16 member.
  28103. */
  28104. /* This is what detects the encoding. encodingTable maps from
  28105. encoding indices to encodings; INIT_ENC_INDEX(enc) is the index of
  28106. the external (protocol) specified encoding; state is
  28107. XML_CONTENT_STATE if we're parsing an external text entity, and
  28108. XML_PROLOG_STATE otherwise.
  28109. */
  28110. func _initScan(tls *libc.TLS, encodingTable uintptr, enc uintptr, state int32, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28111. var e int32
  28112. var encPtr uintptr
  28113. _, _ = e, encPtr
  28114. if ptr >= end {
  28115. return -int32(4)
  28116. }
  28117. encPtr = (*TINIT_ENCODING)(unsafe.Pointer(enc)).FencPtr
  28118. if ptr+uintptr(1) == end {
  28119. /* only a single byte available for auto-detection */
  28120. /* so we're parsing an external text entity... */
  28121. /* if UTF-16 was externally specified, then we need at least 2 bytes */
  28122. switch int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) {
  28123. case int32(_UTF_16_ENC):
  28124. fallthrough
  28125. case int32(_UTF_16LE_ENC):
  28126. fallthrough
  28127. case int32(_UTF_16BE_ENC):
  28128. return -int32(1)
  28129. }
  28130. switch libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))) {
  28131. case int32(0xFE):
  28132. fallthrough
  28133. case int32(0xFF):
  28134. fallthrough
  28135. case int32(0xEF): /* possibly first byte of UTF-8 BOM */
  28136. if int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_ISO_8859_1_ENC) && state == int32(m_XML_CONTENT_STATE) {
  28137. break
  28138. }
  28139. /* fall through */
  28140. fallthrough
  28141. case 0x00:
  28142. fallthrough
  28143. case int32(0x3C):
  28144. return -int32(1)
  28145. }
  28146. } else {
  28147. switch libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))<<libc.Int32FromInt32(8) | libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))) {
  28148. case int32(0xFEFF):
  28149. if int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_ISO_8859_1_ENC) && state == int32(m_XML_CONTENT_STATE) {
  28150. break
  28151. }
  28152. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  28153. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16BE_ENC)*8))
  28154. return int32(m_XML_TOK_BOM)
  28155. /* 00 3C is handled in the default case */
  28156. fallthrough
  28157. case int32(0x3C00):
  28158. if (int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_UTF_16BE_ENC) || int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_UTF_16_ENC)) && state == int32(m_XML_CONTENT_STATE) {
  28159. break
  28160. }
  28161. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16LE_ENC)*8))
  28162. 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)
  28163. case int32(0xFFFE):
  28164. if int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_ISO_8859_1_ENC) && state == int32(m_XML_CONTENT_STATE) {
  28165. break
  28166. }
  28167. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  28168. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16LE_ENC)*8))
  28169. return int32(m_XML_TOK_BOM)
  28170. case int32(0xEFBB):
  28171. /* Maybe a UTF-8 BOM (EF BB BF) */
  28172. /* If there's an explicitly specified (external) encoding
  28173. of ISO-8859-1 or some flavour of UTF-16
  28174. and this is an external text entity,
  28175. don't look for the BOM,
  28176. because it might be a legal data.
  28177. */
  28178. if state == int32(m_XML_CONTENT_STATE) {
  28179. e = int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16)
  28180. if e == int32(_ISO_8859_1_ENC) || e == int32(_UTF_16BE_ENC) || e == int32(_UTF_16LE_ENC) || e == int32(_UTF_16_ENC) {
  28181. break
  28182. }
  28183. }
  28184. if ptr+uintptr(2) == end {
  28185. return -int32(1)
  28186. }
  28187. if libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 2)))) == int32(0xBF) {
  28188. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(3)
  28189. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_8_ENC)*8))
  28190. return int32(m_XML_TOK_BOM)
  28191. }
  28192. default:
  28193. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32('\000') {
  28194. /* 0 isn't a legal data character. Furthermore a document
  28195. entity can only start with ASCII characters. So the only
  28196. way this can fail to be big-endian UTF-16 if it it's an
  28197. external parsed general entity that's labelled as
  28198. UTF-16LE.
  28199. */
  28200. if state == int32(m_XML_CONTENT_STATE) && int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_UTF_16LE_ENC) {
  28201. break
  28202. }
  28203. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16BE_ENC)*8))
  28204. 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)
  28205. } else {
  28206. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32('\000') {
  28207. /* We could recover here in the case:
  28208. - parsing an external entity
  28209. - second byte is 0
  28210. - no externally specified encoding
  28211. - no encoding declaration
  28212. by assuming UTF-16LE. But we don't, because this would mean when
  28213. presented just with a single byte, we couldn't reliably determine
  28214. whether we needed further bytes.
  28215. */
  28216. if state == int32(m_XML_CONTENT_STATE) {
  28217. break
  28218. }
  28219. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16LE_ENC)*8))
  28220. 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)
  28221. }
  28222. }
  28223. break
  28224. }
  28225. }
  28226. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16))*8))
  28227. 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)
  28228. }
  28229. /* This file is included!
  28230. __ __ _
  28231. ___\ \/ /_ __ __ _| |_
  28232. / _ \\ /| '_ \ / _` | __|
  28233. | __// \| |_) | (_| | |_
  28234. \___/_/\_\ .__/ \__,_|\__|
  28235. |_| XML parser
  28236. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  28237. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  28238. Copyright (c) 2002 Greg Stein <gstein@users.sourceforge.net>
  28239. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  28240. Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
  28241. Copyright (c) 2017-2021 Sebastian Pipping <sebastian@pipping.org>
  28242. Licensed under the MIT license:
  28243. Permission is hereby granted, free of charge, to any person obtaining
  28244. a copy of this software and associated documentation files (the
  28245. "Software"), to deal in the Software without restriction, including
  28246. without limitation the rights to use, copy, modify, merge, publish,
  28247. distribute, sublicense, and/or sell copies of the Software, and to permit
  28248. persons to whom the Software is furnished to do so, subject to the
  28249. following conditions:
  28250. The above copyright notice and this permission notice shall be included
  28251. in all copies or substantial portions of the Software.
  28252. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  28253. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  28254. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  28255. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  28256. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  28257. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  28258. USE OR OTHER DEALINGS IN THE SOFTWARE.
  28259. */
  28260. func XXmlGetUtf8InternalEncoding(tls *libc.TLS) (r uintptr) {
  28261. return uintptr(unsafe.Pointer(&_internal_utf8_encoding))
  28262. }
  28263. func XXmlGetUtf16InternalEncoding(tls *libc.TLS) (r uintptr) {
  28264. return uintptr(unsafe.Pointer(&_internal_little2_encoding))
  28265. }
  28266. var _encodings = [7]uintptr{
  28267. 0: uintptr(unsafe.Pointer(&_latin1_encoding)),
  28268. 1: uintptr(unsafe.Pointer(&_ascii_encoding)),
  28269. 2: uintptr(unsafe.Pointer(&_utf8_encoding)),
  28270. 3: uintptr(unsafe.Pointer(&_big2_encoding)),
  28271. 4: uintptr(unsafe.Pointer(&_big2_encoding)),
  28272. 5: uintptr(unsafe.Pointer(&_little2_encoding)),
  28273. 6: uintptr(unsafe.Pointer(&_utf8_encoding)),
  28274. }
  28275. func _initScanProlog(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28276. return _initScan(tls, uintptr(unsafe.Pointer(&_encodings)), enc, m_XML_PROLOG_STATE, ptr, end, nextTokPtr)
  28277. }
  28278. func _initScanContent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28279. return _initScan(tls, uintptr(unsafe.Pointer(&_encodings)), enc, int32(m_XML_CONTENT_STATE), ptr, end, nextTokPtr)
  28280. }
  28281. func XXmlInitEncoding(tls *libc.TLS, p uintptr, encPtr uintptr, name uintptr) (r int32) {
  28282. var i int32
  28283. _ = i
  28284. i = _getEncodingIndex(tls, name)
  28285. if i == int32(_UNKNOWN_ENC) {
  28286. return 0
  28287. }
  28288. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FisUtf16 = int8(i)
  28289. *(*TSCANNER)(unsafe.Pointer(p)) = __ccgo_fp(_initScanProlog)
  28290. *(*TSCANNER)(unsafe.Pointer(p + 1*8)) = __ccgo_fp(_initScanContent)
  28291. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FupdatePosition = __ccgo_fp(_initUpdatePosition)
  28292. (*TINIT_ENCODING)(unsafe.Pointer(p)).FencPtr = encPtr
  28293. *(*uintptr)(unsafe.Pointer(encPtr)) = p
  28294. return int32(1)
  28295. }
  28296. func _findEncoding(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr) (r uintptr) {
  28297. bp := tls.Alloc(144)
  28298. defer tls.Free(144)
  28299. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  28300. var i int32
  28301. var _ /* buf at bp+8 */ [128]int8
  28302. var _ /* p at bp+136 */ uintptr
  28303. _ = i
  28304. *(*[128]int8)(unsafe.Pointer(bp + 8)) = [128]int8{}
  28305. *(*uintptr)(unsafe.Pointer(bp + 136)) = bp + 8
  28306. (*(*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))
  28307. if *(*uintptr)(unsafe.Pointer(bp)) != end {
  28308. return uintptr(0)
  28309. }
  28310. *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 136)))) = 0
  28311. if _streqci(tls, bp+8, uintptr(unsafe.Pointer(&_KW_UTF_16))) != 0 && (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar == int32(2) {
  28312. return enc
  28313. }
  28314. i = _getEncodingIndex(tls, bp+8)
  28315. if i == int32(_UNKNOWN_ENC) {
  28316. return uintptr(0)
  28317. }
  28318. return _encodings[i]
  28319. }
  28320. 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) {
  28321. return _doParseXmlDecl(tls, __ccgo_fp(_findEncoding), isGeneralTextEntity, enc, ptr, end, badPtr, versionPtr, versionEndPtr, encodingName, encoding, standalone)
  28322. }
  28323. /* This file is included!
  28324. __ __ _
  28325. ___\ \/ /_ __ __ _| |_
  28326. / _ \\ /| '_ \ / _` | __|
  28327. | __// \| |_) | (_| | |_
  28328. \___/_/\_\ .__/ \__,_|\__|
  28329. |_| XML parser
  28330. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  28331. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  28332. Copyright (c) 2002 Greg Stein <gstein@users.sourceforge.net>
  28333. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  28334. Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
  28335. Copyright (c) 2017-2021 Sebastian Pipping <sebastian@pipping.org>
  28336. Licensed under the MIT license:
  28337. Permission is hereby granted, free of charge, to any person obtaining
  28338. a copy of this software and associated documentation files (the
  28339. "Software"), to deal in the Software without restriction, including
  28340. without limitation the rights to use, copy, modify, merge, publish,
  28341. distribute, sublicense, and/or sell copies of the Software, and to permit
  28342. persons to whom the Software is furnished to do so, subject to the
  28343. following conditions:
  28344. The above copyright notice and this permission notice shall be included
  28345. in all copies or substantial portions of the Software.
  28346. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  28347. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  28348. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  28349. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  28350. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  28351. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  28352. USE OR OTHER DEALINGS IN THE SOFTWARE.
  28353. */
  28354. func XXmlGetUtf8InternalEncodingNS(tls *libc.TLS) (r uintptr) {
  28355. return uintptr(unsafe.Pointer(&_internal_utf8_encoding_ns))
  28356. }
  28357. func XXmlGetUtf16InternalEncodingNS(tls *libc.TLS) (r uintptr) {
  28358. return uintptr(unsafe.Pointer(&_internal_little2_encoding_ns))
  28359. }
  28360. var _encodingsNS = [7]uintptr{
  28361. 0: uintptr(unsafe.Pointer(&_latin1_encoding_ns)),
  28362. 1: uintptr(unsafe.Pointer(&_ascii_encoding_ns)),
  28363. 2: uintptr(unsafe.Pointer(&_utf8_encoding_ns)),
  28364. 3: uintptr(unsafe.Pointer(&_big2_encoding_ns)),
  28365. 4: uintptr(unsafe.Pointer(&_big2_encoding_ns)),
  28366. 5: uintptr(unsafe.Pointer(&_little2_encoding_ns)),
  28367. 6: uintptr(unsafe.Pointer(&_utf8_encoding_ns)),
  28368. }
  28369. func _initScanPrologNS(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28370. return _initScan(tls, uintptr(unsafe.Pointer(&_encodingsNS)), enc, m_XML_PROLOG_STATE, ptr, end, nextTokPtr)
  28371. }
  28372. func _initScanContentNS(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28373. return _initScan(tls, uintptr(unsafe.Pointer(&_encodingsNS)), enc, int32(m_XML_CONTENT_STATE), ptr, end, nextTokPtr)
  28374. }
  28375. func XXmlInitEncodingNS(tls *libc.TLS, p uintptr, encPtr uintptr, name uintptr) (r int32) {
  28376. var i int32
  28377. _ = i
  28378. i = _getEncodingIndex(tls, name)
  28379. if i == int32(_UNKNOWN_ENC) {
  28380. return 0
  28381. }
  28382. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FisUtf16 = int8(i)
  28383. *(*TSCANNER)(unsafe.Pointer(p)) = __ccgo_fp(_initScanPrologNS)
  28384. *(*TSCANNER)(unsafe.Pointer(p + 1*8)) = __ccgo_fp(_initScanContentNS)
  28385. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FupdatePosition = __ccgo_fp(_initUpdatePosition)
  28386. (*TINIT_ENCODING)(unsafe.Pointer(p)).FencPtr = encPtr
  28387. *(*uintptr)(unsafe.Pointer(encPtr)) = p
  28388. return int32(1)
  28389. }
  28390. func _findEncodingNS(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr) (r uintptr) {
  28391. bp := tls.Alloc(144)
  28392. defer tls.Free(144)
  28393. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  28394. var i int32
  28395. var _ /* buf at bp+8 */ [128]int8
  28396. var _ /* p at bp+136 */ uintptr
  28397. _ = i
  28398. *(*[128]int8)(unsafe.Pointer(bp + 8)) = [128]int8{}
  28399. *(*uintptr)(unsafe.Pointer(bp + 136)) = bp + 8
  28400. (*(*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))
  28401. if *(*uintptr)(unsafe.Pointer(bp)) != end {
  28402. return uintptr(0)
  28403. }
  28404. *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 136)))) = 0
  28405. if _streqci(tls, bp+8, uintptr(unsafe.Pointer(&_KW_UTF_16))) != 0 && (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar == int32(2) {
  28406. return enc
  28407. }
  28408. i = _getEncodingIndex(tls, bp+8)
  28409. if i == int32(_UNKNOWN_ENC) {
  28410. return uintptr(0)
  28411. }
  28412. return _encodingsNS[i]
  28413. }
  28414. 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) {
  28415. return _doParseXmlDecl(tls, __ccgo_fp(_findEncodingNS), isGeneralTextEntity, enc, ptr, end, badPtr, versionPtr, versionEndPtr, encodingName, encoding, standalone)
  28416. }
  28417. func XXmlInitUnknownEncodingNS(tls *libc.TLS, mem uintptr, table uintptr, convert TCONVERTER, userData uintptr) (r uintptr) {
  28418. var enc uintptr
  28419. _ = enc
  28420. enc = XXmlInitUnknownEncoding(tls, mem, table, convert, userData)
  28421. if enc != 0 {
  28422. *(*uint8)(unsafe.Pointer(enc + 136 + 58)) = uint8(_BT_COLON)
  28423. }
  28424. return enc
  28425. }
  28426. func __ccgo_fp(f interface{}) uintptr {
  28427. type iface [2]uintptr
  28428. return (*iface)(unsafe.Pointer(&f))[1]
  28429. }
  28430. var __ccgo_ts = (*reflect.StringHeader)(unsafe.Pointer(&__ccgo_ts1)).Data
  28431. 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"