ccgo_linux_arm.go 1.0 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247
  1. // Code generated for linux/arm 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/arm -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 && arm
  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 = 12
  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 = 13
  327. const m_F_SETLKW = 14
  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 = "INT32_MAX"
  378. const m_INTPTR_MIN = "INT32_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 = 32
  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 = 0200000
  446. const m_O_DIRECTORY = 040000
  447. const m_O_DSYNC = 010000
  448. const m_O_EXCL = 0200
  449. const m_O_EXEC = "O_PATH"
  450. const m_O_LARGEFILE = 0400000
  451. const m_O_NDELAY = "O_NONBLOCK"
  452. const m_O_NOATIME = 01000000
  453. const m_O_NOCTTY = 0400
  454. const m_O_NOFOLLOW = 0100000
  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 = 020040000
  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_PATH_MAX = 4096
  474. const m_PDP_ENDIAN = "__PDP_ENDIAN"
  475. const m_PIPE_BUF = 4096
  476. const m_POSIX_CLOSE_RESTART = 0
  477. const m_POSIX_FADV_DONTNEED = 4
  478. const m_POSIX_FADV_NOREUSE = 5
  479. const m_POSIX_FADV_NORMAL = 0
  480. const m_POSIX_FADV_RANDOM = 1
  481. const m_POSIX_FADV_SEQUENTIAL = 2
  482. const m_POSIX_FADV_WILLNEED = 3
  483. const m_PTHREAD_DESTRUCTOR_ITERATIONS = 4
  484. const m_PTHREAD_KEYS_MAX = 128
  485. const m_PTHREAD_STACK_MIN = 2048
  486. const m_PTRDIFF_MAX = "INT32_MAX"
  487. const m_PTRDIFF_MIN = "INT32_MIN"
  488. const m_P_tmpdir = "/tmp"
  489. const m_RAND_MAX = 0x7fffffff
  490. const m_RE_DUP_MAX = 255
  491. const m_RWF_WRITE_LIFE_NOT_SET = 0
  492. const m_RWH_WRITE_LIFE_EXTREME = 5
  493. const m_RWH_WRITE_LIFE_LONG = 4
  494. const m_RWH_WRITE_LIFE_MEDIUM = 3
  495. const m_RWH_WRITE_LIFE_NONE = 1
  496. const m_RWH_WRITE_LIFE_SHORT = 2
  497. const m_R_OK = 4
  498. const m_SCHAR_MAX = 127
  499. const m_SEEK_DATA = 3
  500. const m_SEEK_HOLE = 4
  501. const m_SEM_NSEMS_MAX = 256
  502. const m_SEM_VALUE_MAX = 0x7fffffff
  503. const m_SHRT_MAX = 0x7fff
  504. const m_SIG_ATOMIC_MAX = "INT32_MAX"
  505. const m_SIG_ATOMIC_MIN = "INT32_MIN"
  506. const m_SIP_KEYLEN = 16
  507. const m_SIZE_MAX = "UINT32_MAX"
  508. const m_SPLICE_F_GIFT = 8
  509. const m_SPLICE_F_MORE = 4
  510. const m_SPLICE_F_MOVE = 1
  511. const m_SPLICE_F_NONBLOCK = 2
  512. const m_SSIZE_MAX = "LONG_MAX"
  513. const m_STDC_HEADERS = 1
  514. const m_STDERR_FILENO = 2
  515. const m_STDIN_FILENO = 0
  516. const m_STDOUT_FILENO = 1
  517. const m_SYMLOOP_MAX = 40
  518. const m_SYNC_FILE_RANGE_WAIT_AFTER = 4
  519. const m_SYNC_FILE_RANGE_WAIT_BEFORE = 1
  520. const m_SYNC_FILE_RANGE_WRITE = 2
  521. const m_S_IRGRP = 0040
  522. const m_S_IROTH = 0004
  523. const m_S_IRUSR = 0400
  524. const m_S_IRWXG = 0070
  525. const m_S_IRWXO = 0007
  526. const m_S_IRWXU = 0700
  527. const m_S_ISGID = 02000
  528. const m_S_ISUID = 04000
  529. const m_S_ISVTX = 01000
  530. const m_S_IWGRP = 0020
  531. const m_S_IWOTH = 0002
  532. const m_S_IWUSR = 0200
  533. const m_S_IXGRP = 0010
  534. const m_S_IXOTH = 0001
  535. const m_S_IXUSR = 0100
  536. const m_TMP_MAX = 10000
  537. const m_TTY_NAME_MAX = 32
  538. const m_TZNAME_MAX = 6
  539. const m_UCHAR_MAX = 255
  540. const m_UINT16_MAX = 0xffff
  541. const m_UINT32_MAX = "0xffffffffu"
  542. const m_UINT64_MAX = "0xffffffffffffffffu"
  543. const m_UINT8_MAX = 0xff
  544. const m_UINTMAX_MAX = "UINT64_MAX"
  545. const m_UINTPTR_MAX = "UINT32_MAX"
  546. const m_UINT_FAST16_MAX = "UINT32_MAX"
  547. const m_UINT_FAST32_MAX = "UINT32_MAX"
  548. const m_UINT_FAST64_MAX = "UINT64_MAX"
  549. const m_UINT_FAST8_MAX = "UINT8_MAX"
  550. const m_UINT_LEAST16_MAX = "UINT16_MAX"
  551. const m_UINT_LEAST32_MAX = "UINT32_MAX"
  552. const m_UINT_LEAST64_MAX = "UINT64_MAX"
  553. const m_UINT_LEAST8_MAX = "UINT8_MAX"
  554. const m_UINT_MAX = 4294967295
  555. const m_USHRT_MAX = 0xffff
  556. const m_VERSION = "2.5.0"
  557. const m_WINT_MAX = "UINT32_MAX"
  558. const m_WINT_MIN = 0
  559. const m_WNOHANG = 1
  560. const m_WORD_BIT = 32
  561. const m_WUNTRACED = 2
  562. const m_W_OK = 2
  563. const m_XML_ATTRIBUTE_VALUE_LITERAL = 0
  564. const m_XML_BUILDING_EXPAT = 1
  565. const m_XML_CDATA_SECTION_STATE = 2
  566. const m_XML_CONTENT_STATE = 1
  567. const m_XML_CONTEXT_BYTES = 1024
  568. const m_XML_DEV_URANDOM = 1
  569. const m_XML_DTD = 1
  570. const m_XML_ENABLE_VISIBILITY = 0
  571. const m_XML_ENCODE_MAX = "XML_UTF8_ENCODE_MAX"
  572. const m_XML_ENTITY_VALUE_LITERAL = 1
  573. const m_XML_GetErrorByteIndex = "XML_GetCurrentByteIndex"
  574. const m_XML_GetErrorColumnNumber = "XML_GetCurrentColumnNumber"
  575. const m_XML_GetErrorLineNumber = "XML_GetCurrentLineNumber"
  576. const m_XML_IGNORE_SECTION_STATE = 3
  577. const m_XML_MAJOR_VERSION = 2
  578. const m_XML_MICRO_VERSION = 0
  579. const m_XML_MINOR_VERSION = 5
  580. const m_XML_NS = 1
  581. const m_XML_N_LITERAL_TYPES = 2
  582. const m_XML_N_STATES = 4
  583. const m_XML_PROLOG_STATE = 0
  584. const m_XML_TOK_ATTRIBUTE_VALUE_S = 39
  585. const m_XML_TOK_BOM = 14
  586. const m_XML_TOK_CDATA_SECT_CLOSE = 40
  587. const m_XML_TOK_CDATA_SECT_OPEN = 8
  588. const m_XML_TOK_CHAR_REF = 10
  589. const m_XML_TOK_CLOSE_BRACKET = 26
  590. const m_XML_TOK_CLOSE_PAREN = 24
  591. const m_XML_TOK_CLOSE_PAREN_ASTERISK = 36
  592. const m_XML_TOK_CLOSE_PAREN_PLUS = 37
  593. const m_XML_TOK_CLOSE_PAREN_QUESTION = 35
  594. const m_XML_TOK_COMMA = 38
  595. const m_XML_TOK_COMMENT = 13
  596. const m_XML_TOK_COND_SECT_CLOSE = 34
  597. const m_XML_TOK_COND_SECT_OPEN = 33
  598. const m_XML_TOK_DATA_CHARS = 6
  599. const m_XML_TOK_DATA_NEWLINE = 7
  600. const m_XML_TOK_DECL_CLOSE = 17
  601. const m_XML_TOK_DECL_OPEN = 16
  602. const m_XML_TOK_EMPTY_ELEMENT_NO_ATTS = 4
  603. const m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS = 3
  604. const m_XML_TOK_END_TAG = 5
  605. const m_XML_TOK_ENTITY_REF = 9
  606. const m_XML_TOK_IGNORE_SECT = 42
  607. const m_XML_TOK_INSTANCE_START = 29
  608. const m_XML_TOK_INVALID = 0
  609. const m_XML_TOK_LITERAL = 27
  610. const m_XML_TOK_NAME = 18
  611. const m_XML_TOK_NAME_ASTERISK = 31
  612. const m_XML_TOK_NAME_PLUS = 32
  613. const m_XML_TOK_NAME_QUESTION = 30
  614. const m_XML_TOK_NMTOKEN = 19
  615. const m_XML_TOK_OPEN_BRACKET = 25
  616. const m_XML_TOK_OPEN_PAREN = 23
  617. const m_XML_TOK_OR = 21
  618. const m_XML_TOK_PARAM_ENTITY_REF = 28
  619. const m_XML_TOK_PERCENT = 22
  620. const m_XML_TOK_PI = 11
  621. const m_XML_TOK_POUND_NAME = 20
  622. const m_XML_TOK_PREFIXED_NAME = 41
  623. const m_XML_TOK_PROLOG_S = 15
  624. const m_XML_TOK_START_TAG_NO_ATTS = 2
  625. const m_XML_TOK_START_TAG_WITH_ATTS = 1
  626. const m_XML_TOK_XML_DECL = 12
  627. const m_XML_UTF16_ENCODE_MAX = 2
  628. const m_XML_UTF8_ENCODE_MAX = 4
  629. const m_X_OK = 1
  630. const m_XmlConvert = "XmlUtf8Convert"
  631. const m_XmlEncode = "XmlUtf8Encode"
  632. const m_XmlGetInternalEncoding = "XmlGetUtf8InternalEncoding"
  633. const m_XmlGetInternalEncodingNS = "XmlGetUtf8InternalEncodingNS"
  634. const m_XmlRole_INCLUDED = 1
  635. const m_XmlTok_INCLUDED = 1
  636. const m__CS_GNU_LIBC_VERSION = 2
  637. const m__CS_GNU_LIBPTHREAD_VERSION = 3
  638. const m__CS_PATH = 0
  639. const m__CS_POSIX_V5_WIDTH_RESTRICTED_ENVS = 4
  640. const m__CS_POSIX_V6_ILP32_OFF32_CFLAGS = 1116
  641. const m__CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 1117
  642. const m__CS_POSIX_V6_ILP32_OFF32_LIBS = 1118
  643. const m__CS_POSIX_V6_ILP32_OFF32_LINTFLAGS = 1119
  644. const m__CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 1120
  645. const m__CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 1121
  646. const m__CS_POSIX_V6_ILP32_OFFBIG_LIBS = 1122
  647. const m__CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS = 1123
  648. const m__CS_POSIX_V6_LP64_OFF64_CFLAGS = 1124
  649. const m__CS_POSIX_V6_LP64_OFF64_LDFLAGS = 1125
  650. const m__CS_POSIX_V6_LP64_OFF64_LIBS = 1126
  651. const m__CS_POSIX_V6_LP64_OFF64_LINTFLAGS = 1127
  652. const m__CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 1128
  653. const m__CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 1129
  654. const m__CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 1130
  655. const m__CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS = 1131
  656. const m__CS_POSIX_V6_WIDTH_RESTRICTED_ENVS = 1
  657. const m__CS_POSIX_V7_ILP32_OFF32_CFLAGS = 1132
  658. const m__CS_POSIX_V7_ILP32_OFF32_LDFLAGS = 1133
  659. const m__CS_POSIX_V7_ILP32_OFF32_LIBS = 1134
  660. const m__CS_POSIX_V7_ILP32_OFF32_LINTFLAGS = 1135
  661. const m__CS_POSIX_V7_ILP32_OFFBIG_CFLAGS = 1136
  662. const m__CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS = 1137
  663. const m__CS_POSIX_V7_ILP32_OFFBIG_LIBS = 1138
  664. const m__CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS = 1139
  665. const m__CS_POSIX_V7_LP64_OFF64_CFLAGS = 1140
  666. const m__CS_POSIX_V7_LP64_OFF64_LDFLAGS = 1141
  667. const m__CS_POSIX_V7_LP64_OFF64_LIBS = 1142
  668. const m__CS_POSIX_V7_LP64_OFF64_LINTFLAGS = 1143
  669. const m__CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS = 1144
  670. const m__CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS = 1145
  671. const m__CS_POSIX_V7_LPBIG_OFFBIG_LIBS = 1146
  672. const m__CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS = 1147
  673. const m__CS_POSIX_V7_THREADS_CFLAGS = 1150
  674. const m__CS_POSIX_V7_THREADS_LDFLAGS = 1151
  675. const m__CS_POSIX_V7_WIDTH_RESTRICTED_ENVS = 5
  676. const m__CS_V6_ENV = 1148
  677. const m__CS_V7_ENV = 1149
  678. const m__FILE_OFFSET_BITS = 64
  679. const m__GNU_SOURCE = 1
  680. const m__IOFBF = 0
  681. const m__IOLBF = 1
  682. const m__IONBF = 2
  683. const m__PC_2_SYMLINKS = 20
  684. const m__PC_ALLOC_SIZE_MIN = 18
  685. const m__PC_ASYNC_IO = 10
  686. const m__PC_CHOWN_RESTRICTED = 6
  687. const m__PC_FILESIZEBITS = 13
  688. const m__PC_LINK_MAX = 0
  689. const m__PC_MAX_CANON = 1
  690. const m__PC_MAX_INPUT = 2
  691. const m__PC_NAME_MAX = 3
  692. const m__PC_NO_TRUNC = 7
  693. const m__PC_PATH_MAX = 4
  694. const m__PC_PIPE_BUF = 5
  695. const m__PC_PRIO_IO = 11
  696. const m__PC_REC_INCR_XFER_SIZE = 14
  697. const m__PC_REC_MAX_XFER_SIZE = 15
  698. const m__PC_REC_MIN_XFER_SIZE = 16
  699. const m__PC_REC_XFER_ALIGN = 17
  700. const m__PC_SOCK_MAXBUF = 12
  701. const m__PC_SYMLINK_MAX = 19
  702. const m__PC_SYNC_IO = 9
  703. const m__PC_VDISABLE = 8
  704. const m__POSIX2_BC_BASE_MAX = 99
  705. const m__POSIX2_BC_DIM_MAX = 2048
  706. const m__POSIX2_BC_SCALE_MAX = 99
  707. const m__POSIX2_BC_STRING_MAX = 1000
  708. const m__POSIX2_CHARCLASS_NAME_MAX = 14
  709. const m__POSIX2_COLL_WEIGHTS_MAX = 2
  710. const m__POSIX2_C_BIND = "_POSIX_VERSION"
  711. const m__POSIX2_EXPR_NEST_MAX = 32
  712. const m__POSIX2_LINE_MAX = 2048
  713. const m__POSIX2_RE_DUP_MAX = 255
  714. const m__POSIX2_VERSION = "_POSIX_VERSION"
  715. const m__POSIX_ADVISORY_INFO = "_POSIX_VERSION"
  716. const m__POSIX_AIO_LISTIO_MAX = 2
  717. const m__POSIX_AIO_MAX = 1
  718. const m__POSIX_ARG_MAX = 4096
  719. const m__POSIX_ASYNCHRONOUS_IO = "_POSIX_VERSION"
  720. const m__POSIX_BARRIERS = "_POSIX_VERSION"
  721. const m__POSIX_CHILD_MAX = 25
  722. const m__POSIX_CHOWN_RESTRICTED = 1
  723. const m__POSIX_CLOCKRES_MIN = 20000000
  724. const m__POSIX_CLOCK_SELECTION = "_POSIX_VERSION"
  725. const m__POSIX_CPUTIME = "_POSIX_VERSION"
  726. const m__POSIX_DELAYTIMER_MAX = 32
  727. const m__POSIX_FSYNC = "_POSIX_VERSION"
  728. const m__POSIX_HOST_NAME_MAX = 255
  729. const m__POSIX_IPV6 = "_POSIX_VERSION"
  730. const m__POSIX_JOB_CONTROL = 1
  731. const m__POSIX_LINK_MAX = 8
  732. const m__POSIX_LOGIN_NAME_MAX = 9
  733. const m__POSIX_MAPPED_FILES = "_POSIX_VERSION"
  734. const m__POSIX_MAX_CANON = 255
  735. const m__POSIX_MAX_INPUT = 255
  736. const m__POSIX_MEMLOCK = "_POSIX_VERSION"
  737. const m__POSIX_MEMLOCK_RANGE = "_POSIX_VERSION"
  738. const m__POSIX_MEMORY_PROTECTION = "_POSIX_VERSION"
  739. const m__POSIX_MESSAGE_PASSING = "_POSIX_VERSION"
  740. const m__POSIX_MONOTONIC_CLOCK = "_POSIX_VERSION"
  741. const m__POSIX_MQ_OPEN_MAX = 8
  742. const m__POSIX_MQ_PRIO_MAX = 32
  743. const m__POSIX_NAME_MAX = 14
  744. const m__POSIX_NGROUPS_MAX = 8
  745. const m__POSIX_NO_TRUNC = 1
  746. const m__POSIX_OPEN_MAX = 20
  747. const m__POSIX_PATH_MAX = 256
  748. const m__POSIX_PIPE_BUF = 512
  749. const m__POSIX_RAW_SOCKETS = "_POSIX_VERSION"
  750. const m__POSIX_READER_WRITER_LOCKS = "_POSIX_VERSION"
  751. const m__POSIX_REALTIME_SIGNALS = "_POSIX_VERSION"
  752. const m__POSIX_REGEXP = 1
  753. const m__POSIX_RE_DUP_MAX = 255
  754. const m__POSIX_RTSIG_MAX = 8
  755. const m__POSIX_SAVED_IDS = 1
  756. const m__POSIX_SEMAPHORES = "_POSIX_VERSION"
  757. const m__POSIX_SEM_NSEMS_MAX = 256
  758. const m__POSIX_SEM_VALUE_MAX = 32767
  759. const m__POSIX_SHARED_MEMORY_OBJECTS = "_POSIX_VERSION"
  760. const m__POSIX_SHELL = 1
  761. const m__POSIX_SIGQUEUE_MAX = 32
  762. const m__POSIX_SPAWN = "_POSIX_VERSION"
  763. const m__POSIX_SPIN_LOCKS = "_POSIX_VERSION"
  764. const m__POSIX_SSIZE_MAX = 32767
  765. const m__POSIX_SS_REPL_MAX = 4
  766. const m__POSIX_STREAM_MAX = 8
  767. const m__POSIX_SYMLINK_MAX = 255
  768. const m__POSIX_SYMLOOP_MAX = 8
  769. const m__POSIX_THREADS = "_POSIX_VERSION"
  770. const m__POSIX_THREAD_ATTR_STACKADDR = "_POSIX_VERSION"
  771. const m__POSIX_THREAD_ATTR_STACKSIZE = "_POSIX_VERSION"
  772. const m__POSIX_THREAD_CPUTIME = "_POSIX_VERSION"
  773. const m__POSIX_THREAD_DESTRUCTOR_ITERATIONS = 4
  774. const m__POSIX_THREAD_KEYS_MAX = 128
  775. const m__POSIX_THREAD_PRIORITY_SCHEDULING = "_POSIX_VERSION"
  776. const m__POSIX_THREAD_PROCESS_SHARED = "_POSIX_VERSION"
  777. const m__POSIX_THREAD_SAFE_FUNCTIONS = "_POSIX_VERSION"
  778. const m__POSIX_THREAD_THREADS_MAX = 64
  779. const m__POSIX_TIMEOUTS = "_POSIX_VERSION"
  780. const m__POSIX_TIMERS = "_POSIX_VERSION"
  781. const m__POSIX_TIMER_MAX = 32
  782. const m__POSIX_TRACE_EVENT_NAME_MAX = 30
  783. const m__POSIX_TRACE_NAME_MAX = 8
  784. const m__POSIX_TRACE_SYS_MAX = 8
  785. const m__POSIX_TRACE_USER_EVENT_MAX = 32
  786. const m__POSIX_TTY_NAME_MAX = 9
  787. const m__POSIX_TZNAME_MAX = 6
  788. const m__POSIX_V6_ILP32_OFFBIG = 1
  789. const m__POSIX_V7_ILP32_OFFBIG = 1
  790. const m__POSIX_VDISABLE = 0
  791. const m__POSIX_VERSION = 200809
  792. const m__REDIR_TIME64 = 1
  793. const m__SC_2_CHAR_TERM = 95
  794. const m__SC_2_C_BIND = 47
  795. const m__SC_2_C_DEV = 48
  796. const m__SC_2_FORT_DEV = 49
  797. const m__SC_2_FORT_RUN = 50
  798. const m__SC_2_LOCALEDEF = 52
  799. const m__SC_2_PBS = 168
  800. const m__SC_2_PBS_ACCOUNTING = 169
  801. const m__SC_2_PBS_CHECKPOINT = 175
  802. const m__SC_2_PBS_LOCATE = 170
  803. const m__SC_2_PBS_MESSAGE = 171
  804. const m__SC_2_PBS_TRACK = 172
  805. const m__SC_2_SW_DEV = 51
  806. const m__SC_2_UPE = 97
  807. const m__SC_2_VERSION = 46
  808. const m__SC_ADVISORY_INFO = 132
  809. const m__SC_AIO_LISTIO_MAX = 23
  810. const m__SC_AIO_MAX = 24
  811. const m__SC_AIO_PRIO_DELTA_MAX = 25
  812. const m__SC_ARG_MAX = 0
  813. const m__SC_ASYNCHRONOUS_IO = 12
  814. const m__SC_ATEXIT_MAX = 87
  815. const m__SC_AVPHYS_PAGES = 86
  816. const m__SC_BARRIERS = 133
  817. const m__SC_BC_BASE_MAX = 36
  818. const m__SC_BC_DIM_MAX = 37
  819. const m__SC_BC_SCALE_MAX = 38
  820. const m__SC_BC_STRING_MAX = 39
  821. const m__SC_CHILD_MAX = 1
  822. const m__SC_CLK_TCK = 2
  823. const m__SC_CLOCK_SELECTION = 137
  824. const m__SC_COLL_WEIGHTS_MAX = 40
  825. const m__SC_CPUTIME = 138
  826. const m__SC_DELAYTIMER_MAX = 26
  827. const m__SC_EXPR_NEST_MAX = 42
  828. const m__SC_FSYNC = 15
  829. const m__SC_GETGR_R_SIZE_MAX = 69
  830. const m__SC_GETPW_R_SIZE_MAX = 70
  831. const m__SC_HOST_NAME_MAX = 180
  832. const m__SC_IOV_MAX = 60
  833. const m__SC_IPV6 = 235
  834. const m__SC_JOB_CONTROL = 7
  835. const m__SC_LINE_MAX = 43
  836. const m__SC_LOGIN_NAME_MAX = 71
  837. const m__SC_MAPPED_FILES = 16
  838. const m__SC_MEMLOCK = 17
  839. const m__SC_MEMLOCK_RANGE = 18
  840. const m__SC_MEMORY_PROTECTION = 19
  841. const m__SC_MESSAGE_PASSING = 20
  842. const m__SC_MINSIGSTKSZ = 249
  843. const m__SC_MONOTONIC_CLOCK = 149
  844. const m__SC_MQ_OPEN_MAX = 27
  845. const m__SC_MQ_PRIO_MAX = 28
  846. const m__SC_NGROUPS_MAX = 3
  847. const m__SC_NPROCESSORS_CONF = 83
  848. const m__SC_NPROCESSORS_ONLN = 84
  849. const m__SC_NZERO = 109
  850. const m__SC_OPEN_MAX = 4
  851. const m__SC_PAGESIZE = 30
  852. const m__SC_PAGE_SIZE = 30
  853. const m__SC_PASS_MAX = 88
  854. const m__SC_PHYS_PAGES = 85
  855. const m__SC_PRIORITIZED_IO = 13
  856. const m__SC_PRIORITY_SCHEDULING = 10
  857. const m__SC_RAW_SOCKETS = 236
  858. const m__SC_READER_WRITER_LOCKS = 153
  859. const m__SC_REALTIME_SIGNALS = 9
  860. const m__SC_REGEXP = 155
  861. const m__SC_RE_DUP_MAX = 44
  862. const m__SC_RTSIG_MAX = 31
  863. const m__SC_SAVED_IDS = 8
  864. const m__SC_SEMAPHORES = 21
  865. const m__SC_SEM_NSEMS_MAX = 32
  866. const m__SC_SEM_VALUE_MAX = 33
  867. const m__SC_SHARED_MEMORY_OBJECTS = 22
  868. const m__SC_SHELL = 157
  869. const m__SC_SIGQUEUE_MAX = 34
  870. const m__SC_SIGSTKSZ = 250
  871. const m__SC_SPAWN = 159
  872. const m__SC_SPIN_LOCKS = 154
  873. const m__SC_SPORADIC_SERVER = 160
  874. const m__SC_SS_REPL_MAX = 241
  875. const m__SC_STREAMS = 174
  876. const m__SC_STREAM_MAX = 5
  877. const m__SC_SYMLOOP_MAX = 173
  878. const m__SC_SYNCHRONIZED_IO = 14
  879. const m__SC_THREADS = 67
  880. const m__SC_THREAD_ATTR_STACKADDR = 77
  881. const m__SC_THREAD_ATTR_STACKSIZE = 78
  882. const m__SC_THREAD_CPUTIME = 139
  883. const m__SC_THREAD_DESTRUCTOR_ITERATIONS = 73
  884. const m__SC_THREAD_KEYS_MAX = 74
  885. const m__SC_THREAD_PRIORITY_SCHEDULING = 79
  886. const m__SC_THREAD_PRIO_INHERIT = 80
  887. const m__SC_THREAD_PRIO_PROTECT = 81
  888. const m__SC_THREAD_PROCESS_SHARED = 82
  889. const m__SC_THREAD_ROBUST_PRIO_INHERIT = 247
  890. const m__SC_THREAD_ROBUST_PRIO_PROTECT = 248
  891. const m__SC_THREAD_SAFE_FUNCTIONS = 68
  892. const m__SC_THREAD_SPORADIC_SERVER = 161
  893. const m__SC_THREAD_STACK_MIN = 75
  894. const m__SC_THREAD_THREADS_MAX = 76
  895. const m__SC_TIMEOUTS = 164
  896. const m__SC_TIMERS = 11
  897. const m__SC_TIMER_MAX = 35
  898. const m__SC_TRACE = 181
  899. const m__SC_TRACE_EVENT_FILTER = 182
  900. const m__SC_TRACE_EVENT_NAME_MAX = 242
  901. const m__SC_TRACE_INHERIT = 183
  902. const m__SC_TRACE_LOG = 184
  903. const m__SC_TRACE_NAME_MAX = 243
  904. const m__SC_TRACE_SYS_MAX = 244
  905. const m__SC_TRACE_USER_EVENT_MAX = 245
  906. const m__SC_TTY_NAME_MAX = 72
  907. const m__SC_TYPED_MEMORY_OBJECTS = 165
  908. const m__SC_TZNAME_MAX = 6
  909. const m__SC_UIO_MAXIOV = 60
  910. const m__SC_V6_ILP32_OFF32 = 176
  911. const m__SC_V6_ILP32_OFFBIG = 177
  912. const m__SC_V6_LP64_OFF64 = 178
  913. const m__SC_V6_LPBIG_OFFBIG = 179
  914. const m__SC_V7_ILP32_OFF32 = 237
  915. const m__SC_V7_ILP32_OFFBIG = 238
  916. const m__SC_V7_LP64_OFF64 = 239
  917. const m__SC_V7_LPBIG_OFFBIG = 240
  918. const m__SC_VERSION = 29
  919. const m__SC_XBS5_ILP32_OFF32 = 125
  920. const m__SC_XBS5_ILP32_OFFBIG = 126
  921. const m__SC_XBS5_LP64_OFF64 = 127
  922. const m__SC_XBS5_LPBIG_OFFBIG = 128
  923. const m__SC_XOPEN_CRYPT = 92
  924. const m__SC_XOPEN_ENH_I18N = 93
  925. const m__SC_XOPEN_LEGACY = 129
  926. const m__SC_XOPEN_REALTIME = 130
  927. const m__SC_XOPEN_REALTIME_THREADS = 131
  928. const m__SC_XOPEN_SHM = 94
  929. const m__SC_XOPEN_STREAMS = 246
  930. const m__SC_XOPEN_UNIX = 91
  931. const m__SC_XOPEN_VERSION = 89
  932. const m__SC_XOPEN_XCU_VERSION = 90
  933. const m__SC_XOPEN_XPG2 = 98
  934. const m__SC_XOPEN_XPG3 = 99
  935. const m__SC_XOPEN_XPG4 = 100
  936. const m__STDC_PREDEF_H = 1
  937. const m__XOPEN_ENH_I18N = 1
  938. const m__XOPEN_IOV_MAX = 16
  939. const m__XOPEN_NAME_MAX = 255
  940. const m__XOPEN_PATH_MAX = 1024
  941. const m__XOPEN_UNIX = 1
  942. const m__XOPEN_VERSION = 700
  943. const m___ACCUM_EPSILON__ = "0x1P-15K"
  944. const m___ACCUM_FBIT__ = 15
  945. const m___ACCUM_IBIT__ = 16
  946. const m___ACCUM_MAX__ = "0X7FFFFFFFP-15K"
  947. const m___APCS_32__ = 1
  948. const m___ARMEL__ = 1
  949. const m___ARM_32BIT_STATE = 1
  950. const m___ARM_ARCH = 6
  951. const m___ARM_ARCH_6__ = 1
  952. const m___ARM_ARCH_ISA_ARM = 1
  953. const m___ARM_ARCH_ISA_THUMB = 1
  954. const m___ARM_EABI__ = 1
  955. const m___ARM_FEATURE_CLZ = 1
  956. const m___ARM_FEATURE_COPROC = 15
  957. const m___ARM_FEATURE_DSP = 1
  958. const m___ARM_FEATURE_LDREX = 4
  959. const m___ARM_FEATURE_QBIT = 1
  960. const m___ARM_FEATURE_SAT = 1
  961. const m___ARM_FEATURE_SIMD32 = 1
  962. const m___ARM_FEATURE_UNALIGNED = 1
  963. const m___ARM_FP = 12
  964. const m___ARM_PCS_VFP = 1
  965. const m___ARM_SIZEOF_MINIMAL_ENUM = 4
  966. const m___ARM_SIZEOF_WCHAR_T = 4
  967. const m___ATOMIC_ACQUIRE = 2
  968. const m___ATOMIC_ACQ_REL = 4
  969. const m___ATOMIC_CONSUME = 1
  970. const m___ATOMIC_RELAXED = 0
  971. const m___ATOMIC_RELEASE = 3
  972. const m___ATOMIC_SEQ_CST = 5
  973. const m___BIGGEST_ALIGNMENT__ = 8
  974. const m___BIG_ENDIAN = 4321
  975. const m___BYTE_ORDER = 1234
  976. const m___BYTE_ORDER__ = "__ORDER_LITTLE_ENDIAN__"
  977. const m___CCGO__ = 1
  978. const m___CHAR_BIT__ = 8
  979. const m___CHAR_UNSIGNED__ = 1
  980. const m___DA_FBIT__ = 31
  981. const m___DA_IBIT__ = 32
  982. const m___DBL_DECIMAL_DIG__ = 17
  983. const m___DBL_DIG__ = 15
  984. const m___DBL_HAS_DENORM__ = 1
  985. const m___DBL_HAS_INFINITY__ = 1
  986. const m___DBL_HAS_QUIET_NAN__ = 1
  987. const m___DBL_IS_IEC_60559__ = 2
  988. const m___DBL_MANT_DIG__ = 53
  989. const m___DBL_MAX_10_EXP__ = 308
  990. const m___DBL_MAX_EXP__ = 1024
  991. const m___DECIMAL_DIG__ = 17
  992. const m___DEC_EVAL_METHOD__ = 2
  993. const m___DQ_FBIT__ = 63
  994. const m___DQ_IBIT__ = 0
  995. const m___ELF__ = 1
  996. const m___FINITE_MATH_ONLY__ = 0
  997. const m___FLOAT_WORD_ORDER__ = "__ORDER_LITTLE_ENDIAN__"
  998. const m___FLT32X_DECIMAL_DIG__ = 17
  999. const m___FLT32X_DENORM_MIN__ = 4.9406564584124654e-324
  1000. const m___FLT32X_DIG__ = 15
  1001. const m___FLT32X_EPSILON__ = 2.2204460492503131e-16
  1002. const m___FLT32X_HAS_DENORM__ = 1
  1003. const m___FLT32X_HAS_INFINITY__ = 1
  1004. const m___FLT32X_HAS_QUIET_NAN__ = 1
  1005. const m___FLT32X_IS_IEC_60559__ = 2
  1006. const m___FLT32X_MANT_DIG__ = 53
  1007. const m___FLT32X_MAX_10_EXP__ = 308
  1008. const m___FLT32X_MAX_EXP__ = 1024
  1009. const m___FLT32X_MAX__ = 1.7976931348623157e+308
  1010. const m___FLT32X_MIN__ = 2.2250738585072014e-308
  1011. const m___FLT32X_NORM_MAX__ = 1.7976931348623157e+308
  1012. const m___FLT32_DECIMAL_DIG__ = 9
  1013. const m___FLT32_DENORM_MIN__ = 1.4012984643248171e-45
  1014. const m___FLT32_DIG__ = 6
  1015. const m___FLT32_EPSILON__ = 1.1920928955078125e-7
  1016. const m___FLT32_HAS_DENORM__ = 1
  1017. const m___FLT32_HAS_INFINITY__ = 1
  1018. const m___FLT32_HAS_QUIET_NAN__ = 1
  1019. const m___FLT32_IS_IEC_60559__ = 2
  1020. const m___FLT32_MANT_DIG__ = 24
  1021. const m___FLT32_MAX_10_EXP__ = 38
  1022. const m___FLT32_MAX_EXP__ = 128
  1023. const m___FLT32_MAX__ = 3.4028234663852886e+38
  1024. const m___FLT32_MIN__ = 1.1754943508222875e-38
  1025. const m___FLT32_NORM_MAX__ = 3.4028234663852886e+38
  1026. const m___FLT64_DECIMAL_DIG__ = 17
  1027. const m___FLT64_DENORM_MIN__ = 4.9406564584124654e-324
  1028. const m___FLT64_DIG__ = 15
  1029. const m___FLT64_EPSILON__ = 2.2204460492503131e-16
  1030. const m___FLT64_HAS_DENORM__ = 1
  1031. const m___FLT64_HAS_INFINITY__ = 1
  1032. const m___FLT64_HAS_QUIET_NAN__ = 1
  1033. const m___FLT64_IS_IEC_60559__ = 2
  1034. const m___FLT64_MANT_DIG__ = 53
  1035. const m___FLT64_MAX_10_EXP__ = 308
  1036. const m___FLT64_MAX_EXP__ = 1024
  1037. const m___FLT64_MAX__ = 1.7976931348623157e+308
  1038. const m___FLT64_MIN__ = 2.2250738585072014e-308
  1039. const m___FLT64_NORM_MAX__ = 1.7976931348623157e+308
  1040. const m___FLT_DECIMAL_DIG__ = 9
  1041. const m___FLT_DENORM_MIN__ = 1.4012984643248171e-45
  1042. const m___FLT_DIG__ = 6
  1043. const m___FLT_EPSILON__ = 1.1920928955078125e-7
  1044. const m___FLT_EVAL_METHOD_TS_18661_3__ = 0
  1045. const m___FLT_EVAL_METHOD__ = 0
  1046. const m___FLT_HAS_DENORM__ = 1
  1047. const m___FLT_HAS_INFINITY__ = 1
  1048. const m___FLT_HAS_QUIET_NAN__ = 1
  1049. const m___FLT_IS_IEC_60559__ = 2
  1050. const m___FLT_MANT_DIG__ = 24
  1051. const m___FLT_MAX_10_EXP__ = 38
  1052. const m___FLT_MAX_EXP__ = 128
  1053. const m___FLT_MAX__ = 3.4028234663852886e+38
  1054. const m___FLT_MIN__ = 1.1754943508222875e-38
  1055. const m___FLT_NORM_MAX__ = 3.4028234663852886e+38
  1056. const m___FLT_RADIX__ = 2
  1057. const m___FRACT_EPSILON__ = "0x1P-15R"
  1058. const m___FRACT_FBIT__ = 15
  1059. const m___FRACT_IBIT__ = 0
  1060. const m___FRACT_MAX__ = "0X7FFFP-15R"
  1061. const m___FUNCTION__ = "__func__"
  1062. const m___GCC_ASM_FLAG_OUTPUTS__ = 1
  1063. const m___GCC_ATOMIC_BOOL_LOCK_FREE = 1
  1064. const m___GCC_ATOMIC_CHAR16_T_LOCK_FREE = 1
  1065. const m___GCC_ATOMIC_CHAR32_T_LOCK_FREE = 2
  1066. const m___GCC_ATOMIC_CHAR_LOCK_FREE = 1
  1067. const m___GCC_ATOMIC_INT_LOCK_FREE = 2
  1068. const m___GCC_ATOMIC_LLONG_LOCK_FREE = 1
  1069. const m___GCC_ATOMIC_LONG_LOCK_FREE = 2
  1070. const m___GCC_ATOMIC_POINTER_LOCK_FREE = 2
  1071. const m___GCC_ATOMIC_SHORT_LOCK_FREE = 1
  1072. const m___GCC_ATOMIC_TEST_AND_SET_TRUEVAL = 1
  1073. const m___GCC_ATOMIC_WCHAR_T_LOCK_FREE = 2
  1074. const m___GCC_CONSTRUCTIVE_SIZE = 64
  1075. const m___GCC_DESTRUCTIVE_SIZE = 64
  1076. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 = 1
  1077. const m___GCC_IEC_559 = 2
  1078. const m___GCC_IEC_559_COMPLEX = 2
  1079. const m___GNUC_EXECUTION_CHARSET_NAME = "UTF-8"
  1080. const m___GNUC_MINOR__ = 2
  1081. const m___GNUC_PATCHLEVEL__ = 0
  1082. const m___GNUC_STDC_INLINE__ = 1
  1083. const m___GNUC_WIDE_EXECUTION_CHARSET_NAME = "UTF-32LE"
  1084. const m___GNUC__ = 12
  1085. const m___GXX_ABI_VERSION = 1017
  1086. const m___GXX_TYPEINFO_EQUALITY_INLINE = 0
  1087. const m___HAVE_SPECULATION_SAFE_VALUE = 1
  1088. const m___HA_FBIT__ = 7
  1089. const m___HA_IBIT__ = 8
  1090. const m___HQ_FBIT__ = 15
  1091. const m___HQ_IBIT__ = 0
  1092. const m___INT16_MAX__ = 0x7fff
  1093. const m___INT32_MAX__ = 0x7fffffff
  1094. const m___INT32_TYPE__ = "int"
  1095. const m___INT64_MAX__ = 0x7fffffffffffffff
  1096. const m___INT8_MAX__ = 0x7f
  1097. const m___INTMAX_MAX__ = 0x7fffffffffffffff
  1098. const m___INTMAX_WIDTH__ = 64
  1099. const m___INTPTR_MAX__ = 0x7fffffff
  1100. const m___INTPTR_TYPE__ = "int"
  1101. const m___INTPTR_WIDTH__ = 32
  1102. const m___INT_FAST16_MAX__ = 0x7fffffff
  1103. const m___INT_FAST16_TYPE__ = "int"
  1104. const m___INT_FAST16_WIDTH__ = 32
  1105. const m___INT_FAST32_MAX__ = 0x7fffffff
  1106. const m___INT_FAST32_TYPE__ = "int"
  1107. const m___INT_FAST32_WIDTH__ = 32
  1108. const m___INT_FAST64_MAX__ = 0x7fffffffffffffff
  1109. const m___INT_FAST64_WIDTH__ = 64
  1110. const m___INT_FAST8_MAX__ = 0x7f
  1111. const m___INT_FAST8_WIDTH__ = 8
  1112. const m___INT_LEAST16_MAX__ = 0x7fff
  1113. const m___INT_LEAST16_WIDTH__ = 16
  1114. const m___INT_LEAST32_MAX__ = 0x7fffffff
  1115. const m___INT_LEAST32_TYPE__ = "int"
  1116. const m___INT_LEAST32_WIDTH__ = 32
  1117. const m___INT_LEAST64_MAX__ = 0x7fffffffffffffff
  1118. const m___INT_LEAST64_WIDTH__ = 64
  1119. const m___INT_LEAST8_MAX__ = 0x7f
  1120. const m___INT_LEAST8_WIDTH__ = 8
  1121. const m___INT_MAX__ = 0x7fffffff
  1122. const m___INT_WIDTH__ = 32
  1123. const m___LACCUM_EPSILON__ = "0x1P-31LK"
  1124. const m___LACCUM_FBIT__ = 31
  1125. const m___LACCUM_IBIT__ = 32
  1126. const m___LACCUM_MAX__ = "0X7FFFFFFFFFFFFFFFP-31LK"
  1127. const m___LDBL_DECIMAL_DIG__ = 17
  1128. const m___LDBL_DENORM_MIN__ = 4.9406564584124654e-324
  1129. const m___LDBL_DIG__ = 15
  1130. const m___LDBL_EPSILON__ = 2.2204460492503131e-16
  1131. const m___LDBL_HAS_DENORM__ = 1
  1132. const m___LDBL_HAS_INFINITY__ = 1
  1133. const m___LDBL_HAS_QUIET_NAN__ = 1
  1134. const m___LDBL_IS_IEC_60559__ = 2
  1135. const m___LDBL_MANT_DIG__ = 53
  1136. const m___LDBL_MAX_10_EXP__ = 308
  1137. const m___LDBL_MAX_EXP__ = 1024
  1138. const m___LDBL_MAX__ = 1.7976931348623157e+308
  1139. const m___LDBL_MIN__ = 2.2250738585072014e-308
  1140. const m___LDBL_NORM_MAX__ = 1.7976931348623157e+308
  1141. const m___LFRACT_EPSILON__ = "0x1P-31LR"
  1142. const m___LFRACT_FBIT__ = 31
  1143. const m___LFRACT_IBIT__ = 0
  1144. const m___LFRACT_MAX__ = "0X7FFFFFFFP-31LR"
  1145. const m___LITTLE_ENDIAN = 1234
  1146. const m___LLACCUM_EPSILON__ = "0x1P-31LLK"
  1147. const m___LLACCUM_FBIT__ = 31
  1148. const m___LLACCUM_IBIT__ = 32
  1149. const m___LLACCUM_MAX__ = "0X7FFFFFFFFFFFFFFFP-31LLK"
  1150. const m___LLFRACT_EPSILON__ = "0x1P-63LLR"
  1151. const m___LLFRACT_FBIT__ = 63
  1152. const m___LLFRACT_IBIT__ = 0
  1153. const m___LLFRACT_MAX__ = "0X7FFFFFFFFFFFFFFFP-63LLR"
  1154. const m___LONG_LONG_MAX__ = 0x7fffffffffffffff
  1155. const m___LONG_LONG_WIDTH__ = 64
  1156. const m___LONG_MAX = 0x7fffffff
  1157. const m___LONG_MAX__ = 0x7fffffff
  1158. const m___LONG_WIDTH__ = 32
  1159. const m___NO_INLINE__ = 1
  1160. const m___ORDER_BIG_ENDIAN__ = 4321
  1161. const m___ORDER_LITTLE_ENDIAN__ = 1234
  1162. const m___ORDER_PDP_ENDIAN__ = 3412
  1163. const m___PDP_ENDIAN = 3412
  1164. const m___PRAGMA_REDEFINE_EXTNAME = 1
  1165. const m___PRETTY_FUNCTION__ = "__func__"
  1166. const m___PTRDIFF_MAX__ = 0x7fffffff
  1167. const m___PTRDIFF_TYPE__ = "int"
  1168. const m___PTRDIFF_WIDTH__ = 32
  1169. const m___QQ_FBIT__ = 7
  1170. const m___QQ_IBIT__ = 0
  1171. const m___SACCUM_EPSILON__ = "0x1P-7HK"
  1172. const m___SACCUM_FBIT__ = 7
  1173. const m___SACCUM_IBIT__ = 8
  1174. const m___SACCUM_MAX__ = "0X7FFFP-7HK"
  1175. const m___SA_FBIT__ = 15
  1176. const m___SA_IBIT__ = 16
  1177. const m___SCHAR_MAX__ = 0x7f
  1178. const m___SCHAR_WIDTH__ = 8
  1179. const m___SFRACT_EPSILON__ = "0x1P-7HR"
  1180. const m___SFRACT_FBIT__ = 7
  1181. const m___SFRACT_IBIT__ = 0
  1182. const m___SFRACT_MAX__ = "0X7FP-7HR"
  1183. const m___SHRT_MAX__ = 0x7fff
  1184. const m___SHRT_WIDTH__ = 16
  1185. const m___SIG_ATOMIC_MAX__ = 0x7fffffff
  1186. const m___SIG_ATOMIC_TYPE__ = "int"
  1187. const m___SIG_ATOMIC_WIDTH__ = 32
  1188. const m___SIZEOF_DOUBLE__ = 8
  1189. const m___SIZEOF_FLOAT__ = 4
  1190. const m___SIZEOF_INT__ = 4
  1191. const m___SIZEOF_LONG_DOUBLE__ = 8
  1192. const m___SIZEOF_LONG_LONG__ = 8
  1193. const m___SIZEOF_LONG__ = 4
  1194. const m___SIZEOF_POINTER__ = 4
  1195. const m___SIZEOF_PTRDIFF_T__ = 4
  1196. const m___SIZEOF_SHORT__ = 2
  1197. const m___SIZEOF_SIZE_T__ = 4
  1198. const m___SIZEOF_WCHAR_T__ = 4
  1199. const m___SIZEOF_WINT_T__ = 4
  1200. const m___SIZE_MAX__ = 0xffffffff
  1201. const m___SIZE_WIDTH__ = 32
  1202. const m___SQ_FBIT__ = 31
  1203. const m___SQ_IBIT__ = 0
  1204. const m___STDC_HOSTED__ = 1
  1205. const m___STDC_IEC_559_COMPLEX__ = 1
  1206. const m___STDC_IEC_559__ = 1
  1207. const m___STDC_IEC_60559_BFP__ = 201404
  1208. const m___STDC_IEC_60559_COMPLEX__ = 201404
  1209. const m___STDC_ISO_10646__ = 201706
  1210. const m___STDC_UTF_16__ = 1
  1211. const m___STDC_UTF_32__ = 1
  1212. const m___STDC_VERSION__ = 201710
  1213. const m___STDC__ = 1
  1214. const m___TA_FBIT__ = 63
  1215. const m___TA_IBIT__ = 64
  1216. const m___THUMB_INTERWORK__ = 1
  1217. const m___TQ_FBIT__ = 127
  1218. const m___TQ_IBIT__ = 0
  1219. const m___UACCUM_EPSILON__ = "0x1P-16UK"
  1220. const m___UACCUM_FBIT__ = 16
  1221. const m___UACCUM_IBIT__ = 16
  1222. const m___UACCUM_MAX__ = "0XFFFFFFFFP-16UK"
  1223. const m___UACCUM_MIN__ = "0.0UK"
  1224. const m___UDA_FBIT__ = 32
  1225. const m___UDA_IBIT__ = 32
  1226. const m___UDQ_FBIT__ = 64
  1227. const m___UDQ_IBIT__ = 0
  1228. const m___UFRACT_EPSILON__ = "0x1P-16UR"
  1229. const m___UFRACT_FBIT__ = 16
  1230. const m___UFRACT_IBIT__ = 0
  1231. const m___UFRACT_MAX__ = "0XFFFFP-16UR"
  1232. const m___UFRACT_MIN__ = "0.0UR"
  1233. const m___UHA_FBIT__ = 8
  1234. const m___UHA_IBIT__ = 8
  1235. const m___UHQ_FBIT__ = 16
  1236. const m___UHQ_IBIT__ = 0
  1237. const m___UINT16_MAX__ = 0xffff
  1238. const m___UINT32_MAX__ = 0xffffffff
  1239. const m___UINT64_MAX__ = "0xffffffffffffffffU"
  1240. const m___UINT8_MAX__ = 0xff
  1241. const m___UINTMAX_MAX__ = "0xffffffffffffffffU"
  1242. const m___UINTPTR_MAX__ = 0xffffffff
  1243. const m___UINT_FAST16_MAX__ = 0xffffffff
  1244. const m___UINT_FAST32_MAX__ = 0xffffffff
  1245. const m___UINT_FAST64_MAX__ = "0xffffffffffffffffU"
  1246. const m___UINT_FAST8_MAX__ = 0xff
  1247. const m___UINT_LEAST16_MAX__ = 0xffff
  1248. const m___UINT_LEAST32_MAX__ = 0xffffffff
  1249. const m___UINT_LEAST64_MAX__ = "0xffffffffffffffffU"
  1250. const m___UINT_LEAST8_MAX__ = 0xff
  1251. const m___ULACCUM_EPSILON__ = "0x1P-32ULK"
  1252. const m___ULACCUM_FBIT__ = 32
  1253. const m___ULACCUM_IBIT__ = 32
  1254. const m___ULACCUM_MAX__ = "0XFFFFFFFFFFFFFFFFP-32ULK"
  1255. const m___ULACCUM_MIN__ = "0.0ULK"
  1256. const m___ULFRACT_EPSILON__ = "0x1P-32ULR"
  1257. const m___ULFRACT_FBIT__ = 32
  1258. const m___ULFRACT_IBIT__ = 0
  1259. const m___ULFRACT_MAX__ = "0XFFFFFFFFP-32ULR"
  1260. const m___ULFRACT_MIN__ = "0.0ULR"
  1261. const m___ULLACCUM_EPSILON__ = "0x1P-32ULLK"
  1262. const m___ULLACCUM_FBIT__ = 32
  1263. const m___ULLACCUM_IBIT__ = 32
  1264. const m___ULLACCUM_MAX__ = "0XFFFFFFFFFFFFFFFFP-32ULLK"
  1265. const m___ULLACCUM_MIN__ = "0.0ULLK"
  1266. const m___ULLFRACT_EPSILON__ = "0x1P-64ULLR"
  1267. const m___ULLFRACT_FBIT__ = 64
  1268. const m___ULLFRACT_IBIT__ = 0
  1269. const m___ULLFRACT_MAX__ = "0XFFFFFFFFFFFFFFFFP-64ULLR"
  1270. const m___ULLFRACT_MIN__ = "0.0ULLR"
  1271. const m___UQQ_FBIT__ = 8
  1272. const m___UQQ_IBIT__ = 0
  1273. const m___USACCUM_EPSILON__ = "0x1P-8UHK"
  1274. const m___USACCUM_FBIT__ = 8
  1275. const m___USACCUM_IBIT__ = 8
  1276. const m___USACCUM_MAX__ = "0XFFFFP-8UHK"
  1277. const m___USACCUM_MIN__ = "0.0UHK"
  1278. const m___USA_FBIT__ = 16
  1279. const m___USA_IBIT__ = 16
  1280. const m___USE_TIME_BITS64 = 1
  1281. const m___USFRACT_EPSILON__ = "0x1P-8UHR"
  1282. const m___USFRACT_FBIT__ = 8
  1283. const m___USFRACT_IBIT__ = 0
  1284. const m___USFRACT_MAX__ = "0XFFP-8UHR"
  1285. const m___USFRACT_MIN__ = "0.0UHR"
  1286. const m___USQ_FBIT__ = 32
  1287. const m___USQ_IBIT__ = 0
  1288. const m___UTA_FBIT__ = 64
  1289. const m___UTA_IBIT__ = 64
  1290. const m___UTQ_FBIT__ = 128
  1291. const m___UTQ_IBIT__ = 0
  1292. const m___VERSION__ = "12.2.0"
  1293. const m___VFP_FP__ = 1
  1294. const m___WCHAR_MAX__ = 0xffffffff
  1295. const m___WCHAR_MIN__ = 0
  1296. const m___WCHAR_WIDTH__ = 32
  1297. const m___WINT_MAX__ = 0xffffffff
  1298. const m___WINT_MIN__ = 0
  1299. const m___WINT_WIDTH__ = 32
  1300. const m___arm__ = 1
  1301. const m___gnu_linux__ = 1
  1302. const m___inline = "inline"
  1303. const m___linux = 1
  1304. const m___linux__ = 1
  1305. const m___restrict = "restrict"
  1306. const m___restrict_arr = "restrict"
  1307. const m___unix = 1
  1308. const m___unix__ = 1
  1309. const m_alloca = "__builtin_alloca"
  1310. const m_inline = "__inline"
  1311. const m_linux = 1
  1312. const m_loff_t = "off_t"
  1313. const m_math_errhandling = 2
  1314. const m_static_assert = "_Static_assert"
  1315. const m_unix = 1
  1316. type t__builtin_va_list = uintptr
  1317. type t__predefined_size_t = uint32
  1318. type t__predefined_wchar_t = uint32
  1319. type t__predefined_ptrdiff_t = int32
  1320. type Twchar_t = uint32
  1321. type Tmax_align_t = struct {
  1322. F__ccgo_align [0]uint32
  1323. F__ll int64
  1324. F__ld float64
  1325. }
  1326. type Tsize_t = uint32
  1327. type Tptrdiff_t = int32
  1328. type Tlocale_t = uintptr
  1329. type Tssize_t = int32
  1330. type Toff_t = int64
  1331. type Tva_list = uintptr
  1332. type t__isoc_va_list = uintptr
  1333. type Tfpos_t = struct {
  1334. F__ccgo_align [0]uint32
  1335. F__lldata [0]int64
  1336. F__align [0]float64
  1337. F__opaque [16]uint8
  1338. }
  1339. type T_G_fpos64_t = Tfpos_t
  1340. type Tcookie_io_functions_t = struct {
  1341. Fread uintptr
  1342. Fwrite uintptr
  1343. Fseek uintptr
  1344. Fclose1 uintptr
  1345. }
  1346. type T_IO_cookie_io_functions_t = Tcookie_io_functions_t
  1347. type Tdiv_t = struct {
  1348. Fquot int32
  1349. Frem int32
  1350. }
  1351. type Tldiv_t = struct {
  1352. Fquot int32
  1353. Frem int32
  1354. }
  1355. type Tlldiv_t = struct {
  1356. F__ccgo_align [0]uint32
  1357. Fquot int64
  1358. Frem int64
  1359. }
  1360. type Tuintptr_t = uint32
  1361. type Tintptr_t = int32
  1362. type Tint8_t = int8
  1363. type Tint16_t = int16
  1364. type Tint32_t = int32
  1365. type Tint64_t = int64
  1366. type Tintmax_t = int64
  1367. type Tuint8_t = uint8
  1368. type Tuint16_t = uint16
  1369. type Tuint32_t = uint32
  1370. type Tuint64_t = uint64
  1371. type Tuintmax_t = uint64
  1372. type Tint_fast8_t = int8
  1373. type Tint_fast64_t = int64
  1374. type Tint_least8_t = int8
  1375. type Tint_least16_t = int16
  1376. type Tint_least32_t = int32
  1377. type Tint_least64_t = int64
  1378. type Tuint_fast8_t = uint8
  1379. type Tuint_fast64_t = uint64
  1380. type Tuint_least8_t = uint8
  1381. type Tuint_least16_t = uint16
  1382. type Tuint_least32_t = uint32
  1383. type Tuint_least64_t = uint64
  1384. type Tint_fast16_t = int32
  1385. type Tint_fast32_t = int32
  1386. type Tuint_fast16_t = uint32
  1387. type Tuint_fast32_t = uint32
  1388. type Tfloat_t = float32
  1389. type Tdouble_t = float64
  1390. type Ttime_t = int64
  1391. type Tsuseconds_t = int64
  1392. type Ttimeval = struct {
  1393. F__ccgo_align [0]uint32
  1394. Ftv_sec Ttime_t
  1395. Ftv_usec Tsuseconds_t
  1396. }
  1397. type Ttimespec = struct {
  1398. F__ccgo_align [0]uint32
  1399. Ftv_sec Ttime_t
  1400. Ftv_nsec int32
  1401. F__ccgo12 uint32
  1402. }
  1403. type Tsigset_t = struct {
  1404. F__bits [32]uint32
  1405. }
  1406. type t__sigset_t = Tsigset_t
  1407. type Tfd_mask = uint32
  1408. type Tfd_set = struct {
  1409. Ffds_bits [32]uint32
  1410. }
  1411. type Titimerval = struct {
  1412. F__ccgo_align [0]uint32
  1413. Fit_interval Ttimeval
  1414. Fit_value Ttimeval
  1415. }
  1416. type Ttimezone = struct {
  1417. Ftz_minuteswest int32
  1418. Ftz_dsttime int32
  1419. }
  1420. type Tregister_t = int32
  1421. type Tu_int64_t = uint64
  1422. type Tmode_t = uint32
  1423. type Tnlink_t = uint32
  1424. type Tino_t = uint64
  1425. type Tdev_t = uint64
  1426. type Tblksize_t = int32
  1427. type Tblkcnt_t = int64
  1428. type Tfsblkcnt_t = uint64
  1429. type Tfsfilcnt_t = uint64
  1430. type Ttimer_t = uintptr
  1431. type Tclockid_t = int32
  1432. type Tclock_t = int32
  1433. type Tpid_t = int32
  1434. type Tid_t = uint32
  1435. type Tuid_t = uint32
  1436. type Tgid_t = uint32
  1437. type Tkey_t = int32
  1438. type Tuseconds_t = uint32
  1439. type Tpthread_t = uintptr
  1440. type Tpthread_once_t = int32
  1441. type Tpthread_key_t = uint32
  1442. type Tpthread_spinlock_t = int32
  1443. type Tpthread_mutexattr_t = struct {
  1444. F__attr uint32
  1445. }
  1446. type Tpthread_condattr_t = struct {
  1447. F__attr uint32
  1448. }
  1449. type Tpthread_barrierattr_t = struct {
  1450. F__attr uint32
  1451. }
  1452. type Tpthread_rwlockattr_t = struct {
  1453. F__attr [2]uint32
  1454. }
  1455. type Tpthread_attr_t = struct {
  1456. F__u struct {
  1457. F__vi [0][9]int32
  1458. F__s [0][9]uint32
  1459. F__i [9]int32
  1460. }
  1461. }
  1462. type Tpthread_mutex_t = struct {
  1463. F__u struct {
  1464. F__vi [0][6]int32
  1465. F__p [0][6]uintptr
  1466. F__i [6]int32
  1467. }
  1468. F__ccgo_room int32
  1469. }
  1470. type Tpthread_cond_t = struct {
  1471. F__u struct {
  1472. F__vi [0][12]int32
  1473. F__p [0][12]uintptr
  1474. F__i [12]int32
  1475. }
  1476. }
  1477. type Tpthread_rwlock_t = struct {
  1478. F__u struct {
  1479. F__vi [0][8]int32
  1480. F__p [0][8]uintptr
  1481. F__i [8]int32
  1482. }
  1483. }
  1484. type Tpthread_barrier_t = struct {
  1485. F__u struct {
  1486. F__vi [0][5]int32
  1487. F__p [0][5]uintptr
  1488. F__i [5]int32
  1489. }
  1490. }
  1491. type Tu_int8_t = uint8
  1492. type Tu_int16_t = uint16
  1493. type Tu_int32_t = uint32
  1494. type Tcaddr_t = uintptr
  1495. type Tu_char = uint8
  1496. type Tu_short = uint16
  1497. type Tushort = uint16
  1498. type Tu_int = uint32
  1499. type Tuint = uint32
  1500. type Tu_long = uint32
  1501. type Tulong = uint32
  1502. type Tquad_t = int64
  1503. type Tu_quad_t = uint64
  1504. type Tiovec = struct {
  1505. Fiov_base uintptr
  1506. Fiov_len Tsize_t
  1507. }
  1508. type Tflock = struct {
  1509. F__ccgo_align [0]uint32
  1510. Fl_type int16
  1511. Fl_whence int16
  1512. F__ccgo_align2 [4]byte
  1513. Fl_start Toff_t
  1514. Fl_len Toff_t
  1515. Fl_pid Tpid_t
  1516. F__ccgo_pad5 [4]byte
  1517. }
  1518. type Tfile_handle = struct {
  1519. Fhandle_bytes uint32
  1520. Fhandle_type int32
  1521. }
  1522. type Tf_owner_ex = struct {
  1523. Ftype1 int32
  1524. Fpid Tpid_t
  1525. }
  1526. type TXML_Char = uint8
  1527. type TXML_LChar = uint8
  1528. type TXML_Index = int32
  1529. type TXML_Size = uint32
  1530. type TXML_ParserStruct = struct {
  1531. F__ccgo_align [0]uint32
  1532. Fm_userData uintptr
  1533. Fm_handlerArg uintptr
  1534. Fm_buffer uintptr
  1535. Fm_mem TXML_Memory_Handling_Suite
  1536. Fm_bufferPtr uintptr
  1537. Fm_bufferEnd uintptr
  1538. Fm_bufferLim uintptr
  1539. Fm_parseEndByteIndex TXML_Index
  1540. Fm_parseEndPtr uintptr
  1541. Fm_dataBuf uintptr
  1542. Fm_dataBufEnd uintptr
  1543. Fm_startElementHandler TXML_StartElementHandler
  1544. Fm_endElementHandler TXML_EndElementHandler
  1545. Fm_characterDataHandler TXML_CharacterDataHandler
  1546. Fm_processingInstructionHandler TXML_ProcessingInstructionHandler
  1547. Fm_commentHandler TXML_CommentHandler
  1548. Fm_startCdataSectionHandler TXML_StartCdataSectionHandler
  1549. Fm_endCdataSectionHandler TXML_EndCdataSectionHandler
  1550. Fm_defaultHandler TXML_DefaultHandler
  1551. Fm_startDoctypeDeclHandler TXML_StartDoctypeDeclHandler
  1552. Fm_endDoctypeDeclHandler TXML_EndDoctypeDeclHandler
  1553. Fm_unparsedEntityDeclHandler TXML_UnparsedEntityDeclHandler
  1554. Fm_notationDeclHandler TXML_NotationDeclHandler
  1555. Fm_startNamespaceDeclHandler TXML_StartNamespaceDeclHandler
  1556. Fm_endNamespaceDeclHandler TXML_EndNamespaceDeclHandler
  1557. Fm_notStandaloneHandler TXML_NotStandaloneHandler
  1558. Fm_externalEntityRefHandler TXML_ExternalEntityRefHandler
  1559. Fm_externalEntityRefHandlerArg TXML_Parser
  1560. Fm_skippedEntityHandler TXML_SkippedEntityHandler
  1561. Fm_unknownEncodingHandler TXML_UnknownEncodingHandler
  1562. Fm_elementDeclHandler TXML_ElementDeclHandler
  1563. Fm_attlistDeclHandler TXML_AttlistDeclHandler
  1564. Fm_entityDeclHandler TXML_EntityDeclHandler
  1565. Fm_xmlDeclHandler TXML_XmlDeclHandler
  1566. Fm_encoding uintptr
  1567. Fm_initEncoding TINIT_ENCODING
  1568. Fm_internalEncoding uintptr
  1569. Fm_protocolEncodingName uintptr
  1570. Fm_ns TXML_Bool
  1571. Fm_ns_triplets TXML_Bool
  1572. Fm_unknownEncodingMem uintptr
  1573. Fm_unknownEncodingData uintptr
  1574. Fm_unknownEncodingHandlerData uintptr
  1575. Fm_unknownEncodingRelease uintptr
  1576. Fm_prologState TPROLOG_STATE
  1577. Fm_processor uintptr
  1578. Fm_errorCode _XML_Error
  1579. Fm_eventPtr uintptr
  1580. Fm_eventEndPtr uintptr
  1581. Fm_positionPtr uintptr
  1582. Fm_openInternalEntities uintptr
  1583. Fm_freeInternalEntities uintptr
  1584. Fm_defaultExpandInternalEntities TXML_Bool
  1585. Fm_tagLevel int32
  1586. Fm_declEntity uintptr
  1587. Fm_doctypeName uintptr
  1588. Fm_doctypeSysid uintptr
  1589. Fm_doctypePubid uintptr
  1590. Fm_declAttributeType uintptr
  1591. Fm_declNotationName uintptr
  1592. Fm_declNotationPublicId uintptr
  1593. Fm_declElementType uintptr
  1594. Fm_declAttributeId uintptr
  1595. Fm_declAttributeIsCdata TXML_Bool
  1596. Fm_declAttributeIsId TXML_Bool
  1597. Fm_dtd uintptr
  1598. Fm_curBase uintptr
  1599. Fm_tagStack uintptr
  1600. Fm_freeTagList uintptr
  1601. Fm_inheritedBindings uintptr
  1602. Fm_freeBindingList uintptr
  1603. Fm_attsSize int32
  1604. Fm_nSpecifiedAtts int32
  1605. Fm_idAttIndex int32
  1606. Fm_atts uintptr
  1607. Fm_nsAtts uintptr
  1608. Fm_nsAttsVersion uint32
  1609. Fm_nsAttsPower uint8
  1610. Fm_position TPOSITION
  1611. Fm_tempPool TSTRING_POOL
  1612. Fm_temp2Pool TSTRING_POOL
  1613. Fm_groupConnector uintptr
  1614. Fm_groupSize uint32
  1615. Fm_namespaceSeparator TXML_Char
  1616. Fm_parentParser TXML_Parser
  1617. Fm_parsingStatus TXML_ParsingStatus
  1618. Fm_isParamEntity TXML_Bool
  1619. Fm_useForeignDTD TXML_Bool
  1620. Fm_paramEntityParsing _XML_ParamEntityParsing
  1621. Fm_hash_secret_salt uint32
  1622. Fm_accounting TACCOUNTING
  1623. Fm_entity_stats TENTITY_STATS
  1624. }
  1625. type _XML_Error = int32
  1626. const _XML_ERROR_NONE = 0
  1627. const _XML_ERROR_NO_MEMORY = 1
  1628. const _XML_ERROR_SYNTAX = 2
  1629. const _XML_ERROR_NO_ELEMENTS = 3
  1630. const _XML_ERROR_INVALID_TOKEN = 4
  1631. const _XML_ERROR_UNCLOSED_TOKEN = 5
  1632. const _XML_ERROR_PARTIAL_CHAR = 6
  1633. const _XML_ERROR_TAG_MISMATCH = 7
  1634. const _XML_ERROR_DUPLICATE_ATTRIBUTE = 8
  1635. const _XML_ERROR_JUNK_AFTER_DOC_ELEMENT = 9
  1636. const _XML_ERROR_PARAM_ENTITY_REF = 10
  1637. const _XML_ERROR_UNDEFINED_ENTITY = 11
  1638. const _XML_ERROR_RECURSIVE_ENTITY_REF = 12
  1639. const _XML_ERROR_ASYNC_ENTITY = 13
  1640. const _XML_ERROR_BAD_CHAR_REF = 14
  1641. const _XML_ERROR_BINARY_ENTITY_REF = 15
  1642. const _XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF = 16
  1643. const _XML_ERROR_MISPLACED_XML_PI = 17
  1644. const _XML_ERROR_UNKNOWN_ENCODING = 18
  1645. const _XML_ERROR_INCORRECT_ENCODING = 19
  1646. const _XML_ERROR_UNCLOSED_CDATA_SECTION = 20
  1647. const _XML_ERROR_EXTERNAL_ENTITY_HANDLING = 21
  1648. const _XML_ERROR_NOT_STANDALONE = 22
  1649. const _XML_ERROR_UNEXPECTED_STATE = 23
  1650. const _XML_ERROR_ENTITY_DECLARED_IN_PE = 24
  1651. const _XML_ERROR_FEATURE_REQUIRES_XML_DTD = 25
  1652. const _XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING = 26
  1653. const _XML_ERROR_UNBOUND_PREFIX = 27
  1654. const _XML_ERROR_UNDECLARING_PREFIX = 28
  1655. const _XML_ERROR_INCOMPLETE_PE = 29
  1656. const _XML_ERROR_XML_DECL = 30
  1657. const _XML_ERROR_TEXT_DECL = 31
  1658. const _XML_ERROR_PUBLICID = 32
  1659. const _XML_ERROR_SUSPENDED = 33
  1660. const _XML_ERROR_NOT_SUSPENDED = 34
  1661. const _XML_ERROR_ABORTED = 35
  1662. const _XML_ERROR_FINISHED = 36
  1663. const _XML_ERROR_SUSPEND_PE = 37
  1664. const _XML_ERROR_RESERVED_PREFIX_XML = 38
  1665. const _XML_ERROR_RESERVED_PREFIX_XMLNS = 39
  1666. const _XML_ERROR_RESERVED_NAMESPACE_URI = 40
  1667. const _XML_ERROR_INVALID_ARGUMENT = 41
  1668. const _XML_ERROR_NO_BUFFER = 42
  1669. const _XML_ERROR_AMPLIFICATION_LIMIT_BREACH = 43
  1670. type _XML_ParamEntityParsing = int32
  1671. const _XML_PARAM_ENTITY_PARSING_NEVER = 0
  1672. const _XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE = 1
  1673. const _XML_PARAM_ENTITY_PARSING_ALWAYS = 2
  1674. type TXML_Parser = uintptr
  1675. type TXML_Bool = uint8
  1676. type _XML_Status = int32
  1677. const _XML_STATUS_ERROR = 0
  1678. const _XML_STATUS_OK = 1
  1679. const _XML_STATUS_SUSPENDED = 2
  1680. type _XML_Content_Type = int32
  1681. const _XML_CTYPE_EMPTY = 1
  1682. const _XML_CTYPE_ANY = 2
  1683. const _XML_CTYPE_MIXED = 3
  1684. const _XML_CTYPE_NAME = 4
  1685. const _XML_CTYPE_CHOICE = 5
  1686. const _XML_CTYPE_SEQ = 6
  1687. type _XML_Content_Quant = int32
  1688. const _XML_CQUANT_NONE = 0
  1689. const _XML_CQUANT_OPT = 1
  1690. const _XML_CQUANT_REP = 2
  1691. const _XML_CQUANT_PLUS = 3
  1692. type TXML_Content = struct {
  1693. Ftype1 _XML_Content_Type
  1694. Fquant _XML_Content_Quant
  1695. Fname uintptr
  1696. Fnumchildren uint32
  1697. Fchildren uintptr
  1698. }
  1699. type TXML_cp = TXML_Content
  1700. type TXML_ElementDeclHandler = uintptr
  1701. type TXML_AttlistDeclHandler = uintptr
  1702. type TXML_XmlDeclHandler = uintptr
  1703. type TXML_Memory_Handling_Suite = struct {
  1704. Fmalloc_fcn uintptr
  1705. Frealloc_fcn uintptr
  1706. Ffree_fcn uintptr
  1707. }
  1708. type TXML_StartElementHandler = uintptr
  1709. type TXML_EndElementHandler = uintptr
  1710. type TXML_CharacterDataHandler = uintptr
  1711. type TXML_ProcessingInstructionHandler = uintptr
  1712. type TXML_CommentHandler = uintptr
  1713. type TXML_StartCdataSectionHandler = uintptr
  1714. type TXML_EndCdataSectionHandler = uintptr
  1715. type TXML_DefaultHandler = uintptr
  1716. type TXML_StartDoctypeDeclHandler = uintptr
  1717. type TXML_EndDoctypeDeclHandler = uintptr
  1718. type TXML_EntityDeclHandler = uintptr
  1719. type TXML_UnparsedEntityDeclHandler = uintptr
  1720. type TXML_NotationDeclHandler = uintptr
  1721. type TXML_StartNamespaceDeclHandler = uintptr
  1722. type TXML_EndNamespaceDeclHandler = uintptr
  1723. type TXML_NotStandaloneHandler = uintptr
  1724. type TXML_ExternalEntityRefHandler = uintptr
  1725. type TXML_SkippedEntityHandler = uintptr
  1726. type TXML_Encoding = struct {
  1727. Fmap1 [256]int32
  1728. Fdata uintptr
  1729. Fconvert uintptr
  1730. Frelease uintptr
  1731. }
  1732. type TXML_UnknownEncodingHandler = uintptr
  1733. type _XML_Parsing = int32
  1734. const _XML_INITIALIZED = 0
  1735. const _XML_PARSING = 1
  1736. const _XML_FINISHED = 2
  1737. const _XML_SUSPENDED = 3
  1738. type TXML_ParsingStatus = struct {
  1739. Fparsing _XML_Parsing
  1740. FfinalBuffer TXML_Bool
  1741. }
  1742. type TXML_Expat_Version = struct {
  1743. Fmajor int32
  1744. Fminor int32
  1745. Fmicro int32
  1746. }
  1747. type _XML_FeatureEnum = int32
  1748. const _XML_FEATURE_END = 0
  1749. const _XML_FEATURE_UNICODE = 1
  1750. const _XML_FEATURE_UNICODE_WCHAR_T = 2
  1751. const _XML_FEATURE_DTD = 3
  1752. const _XML_FEATURE_CONTEXT_BYTES = 4
  1753. const _XML_FEATURE_MIN_SIZE = 5
  1754. const _XML_FEATURE_SIZEOF_XML_CHAR = 6
  1755. const _XML_FEATURE_SIZEOF_XML_LCHAR = 7
  1756. const _XML_FEATURE_NS = 8
  1757. const _XML_FEATURE_LARGE_SIZE = 9
  1758. const _XML_FEATURE_ATTR_INFO = 10
  1759. const _XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT = 11
  1760. const _XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT = 12
  1761. type TXML_Feature = struct {
  1762. Ffeature _XML_FeatureEnum
  1763. Fname uintptr
  1764. Fvalue int32
  1765. }
  1766. type Tsiphash = struct {
  1767. F__ccgo_align [0]uint32
  1768. Fv0 Tuint64_t
  1769. Fv1 Tuint64_t
  1770. Fv2 Tuint64_t
  1771. Fv3 Tuint64_t
  1772. Fbuf [8]uint8
  1773. Fp uintptr
  1774. F__ccgo_align6 [4]byte
  1775. Fc Tuint64_t
  1776. }
  1777. type Tsipkey = struct {
  1778. F__ccgo_align [0]uint32
  1779. Fk [2]Tuint64_t
  1780. }
  1781. func _sip_tokey(tls *libc.TLS, key uintptr, src uintptr) (r uintptr) {
  1782. *(*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)
  1783. *(*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)
  1784. return key
  1785. }
  1786. func _sip_round(tls *libc.TLS, H uintptr, rounds int32) {
  1787. var i int32
  1788. _ = i
  1789. i = 0
  1790. for {
  1791. if !(i < rounds) {
  1792. break
  1793. }
  1794. *(*Tuint64_t)(unsafe.Pointer(H)) += (*Tsiphash)(unsafe.Pointer(H)).Fv1
  1795. (*Tsiphash)(unsafe.Pointer(H)).Fv1 = (*Tsiphash)(unsafe.Pointer(H)).Fv1<<libc.Int32FromInt32(13) | (*Tsiphash)(unsafe.Pointer(H)).Fv1>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(13))
  1796. *(*Tuint64_t)(unsafe.Pointer(H + 8)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv0
  1797. (*Tsiphash)(unsafe.Pointer(H)).Fv0 = (*Tsiphash)(unsafe.Pointer(H)).Fv0<<libc.Int32FromInt32(32) | (*Tsiphash)(unsafe.Pointer(H)).Fv0>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(32))
  1798. *(*Tuint64_t)(unsafe.Pointer(H + 16)) += (*Tsiphash)(unsafe.Pointer(H)).Fv3
  1799. (*Tsiphash)(unsafe.Pointer(H)).Fv3 = (*Tsiphash)(unsafe.Pointer(H)).Fv3<<libc.Int32FromInt32(16) | (*Tsiphash)(unsafe.Pointer(H)).Fv3>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(16))
  1800. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv2
  1801. *(*Tuint64_t)(unsafe.Pointer(H)) += (*Tsiphash)(unsafe.Pointer(H)).Fv3
  1802. (*Tsiphash)(unsafe.Pointer(H)).Fv3 = (*Tsiphash)(unsafe.Pointer(H)).Fv3<<libc.Int32FromInt32(21) | (*Tsiphash)(unsafe.Pointer(H)).Fv3>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(21))
  1803. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv0
  1804. *(*Tuint64_t)(unsafe.Pointer(H + 16)) += (*Tsiphash)(unsafe.Pointer(H)).Fv1
  1805. (*Tsiphash)(unsafe.Pointer(H)).Fv1 = (*Tsiphash)(unsafe.Pointer(H)).Fv1<<libc.Int32FromInt32(17) | (*Tsiphash)(unsafe.Pointer(H)).Fv1>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(17))
  1806. *(*Tuint64_t)(unsafe.Pointer(H + 8)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv2
  1807. (*Tsiphash)(unsafe.Pointer(H)).Fv2 = (*Tsiphash)(unsafe.Pointer(H)).Fv2<<libc.Int32FromInt32(32) | (*Tsiphash)(unsafe.Pointer(H)).Fv2>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(32))
  1808. goto _1
  1809. _1:
  1810. ;
  1811. i++
  1812. }
  1813. }
  1814. func _sip24_init(tls *libc.TLS, H uintptr, key uintptr) (r uintptr) {
  1815. (*Tsiphash)(unsafe.Pointer(H)).Fv0 = libc.Uint64FromUint32(0x736f6d65)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x70736575)) ^ *(*Tuint64_t)(unsafe.Pointer(key))
  1816. (*Tsiphash)(unsafe.Pointer(H)).Fv1 = libc.Uint64FromUint32(0x646f7261)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x6e646f6d)) ^ *(*Tuint64_t)(unsafe.Pointer(key + 1*8))
  1817. (*Tsiphash)(unsafe.Pointer(H)).Fv2 = libc.Uint64FromUint32(0x6c796765)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x6e657261)) ^ *(*Tuint64_t)(unsafe.Pointer(key))
  1818. (*Tsiphash)(unsafe.Pointer(H)).Fv3 = libc.Uint64FromUint32(0x74656462)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x79746573)) ^ *(*Tuint64_t)(unsafe.Pointer(key + 1*8))
  1819. (*Tsiphash)(unsafe.Pointer(H)).Fp = H + 32
  1820. (*Tsiphash)(unsafe.Pointer(H)).Fc = uint64(0)
  1821. return H
  1822. }
  1823. func _sip24_update(tls *libc.TLS, H uintptr, src uintptr, len1 Tsize_t) (r uintptr) {
  1824. var m Tuint64_t
  1825. var p, pe, v1, v2, v3 uintptr
  1826. _, _, _, _, _, _ = m, p, pe, v1, v2, v3
  1827. p = src
  1828. pe = p + uintptr(len1)
  1829. for cond := true; cond; cond = p < pe {
  1830. for p < pe && (*Tsiphash)(unsafe.Pointer(H)).Fp < H+32+uintptr(libc.Uint32FromInt64(8)/libc.Uint32FromInt64(1)) {
  1831. v2 = H + 40
  1832. v1 = *(*uintptr)(unsafe.Pointer(v2))
  1833. *(*uintptr)(unsafe.Pointer(v2))++
  1834. v3 = p
  1835. p++
  1836. *(*uint8)(unsafe.Pointer(v1)) = *(*uint8)(unsafe.Pointer(v3))
  1837. }
  1838. if (*Tsiphash)(unsafe.Pointer(H)).Fp < H+32+uintptr(libc.Uint32FromInt64(8)/libc.Uint32FromInt64(1)) {
  1839. break
  1840. }
  1841. 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)
  1842. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= m
  1843. _sip_round(tls, H, int32(2))
  1844. *(*Tuint64_t)(unsafe.Pointer(H)) ^= m
  1845. (*Tsiphash)(unsafe.Pointer(H)).Fp = H + 32
  1846. *(*Tuint64_t)(unsafe.Pointer(H + 48)) += uint64(8)
  1847. }
  1848. return H
  1849. }
  1850. func _sip24_final(tls *libc.TLS, H uintptr) (r Tuint64_t) {
  1851. var b Tuint64_t
  1852. var left uint8
  1853. _, _ = b, left
  1854. left = libc.Uint8FromInt32(int32((*Tsiphash)(unsafe.Pointer(H)).Fp) - t__predefined_ptrdiff_t(H+32))
  1855. b = ((*Tsiphash)(unsafe.Pointer(H)).Fc + uint64(left)) << int32(56)
  1856. switch libc.Int32FromUint8(left) {
  1857. case int32(7):
  1858. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 6))) << int32(48)
  1859. fallthrough
  1860. case int32(6):
  1861. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 5))) << int32(40)
  1862. fallthrough
  1863. case int32(5):
  1864. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 4))) << int32(32)
  1865. fallthrough
  1866. case int32(4):
  1867. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 3))) << int32(24)
  1868. fallthrough
  1869. case int32(3):
  1870. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 2))) << int32(16)
  1871. fallthrough
  1872. case int32(2):
  1873. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 1))) << int32(8)
  1874. fallthrough
  1875. case int32(1):
  1876. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32))) << 0
  1877. fallthrough
  1878. case 0:
  1879. break
  1880. }
  1881. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= b
  1882. _sip_round(tls, H, int32(2))
  1883. *(*Tuint64_t)(unsafe.Pointer(H)) ^= b
  1884. *(*Tuint64_t)(unsafe.Pointer(H + 16)) ^= uint64(0xff)
  1885. _sip_round(tls, H, int32(4))
  1886. return (*Tsiphash)(unsafe.Pointer(H)).Fv0 ^ (*Tsiphash)(unsafe.Pointer(H)).Fv1 ^ (*Tsiphash)(unsafe.Pointer(H)).Fv2 ^ (*Tsiphash)(unsafe.Pointer(H)).Fv3
  1887. }
  1888. func _siphash24(tls *libc.TLS, src uintptr, len1 Tsize_t, key uintptr) (r Tuint64_t) {
  1889. bp := tls.Alloc(64)
  1890. defer tls.Free(64)
  1891. var _ /* state at bp+0 */ Tsiphash
  1892. *(*Tsiphash)(unsafe.Pointer(bp)) = Tsiphash{}
  1893. return _sip24_final(tls, _sip24_update(tls, _sip24_init(tls, bp, key), src, len1))
  1894. }
  1895. func _sip24_valid(tls *libc.TLS) (r int32) {
  1896. bp := tls.Alloc(80)
  1897. defer tls.Free(80)
  1898. var i Tsize_t
  1899. var _ /* in at bp+0 */ [64]uint8
  1900. var _ /* k at bp+64 */ Tsipkey
  1901. _ = i
  1902. _sip_tokey(tls, bp+64, __ccgo_ts)
  1903. i = uint32(0)
  1904. for {
  1905. if !(i < uint32(64)) {
  1906. break
  1907. }
  1908. (*(*[64]uint8)(unsafe.Pointer(bp)))[i] = uint8(i)
  1909. 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) {
  1910. return 0
  1911. }
  1912. goto _1
  1913. _1:
  1914. ;
  1915. i++
  1916. }
  1917. return int32(1)
  1918. }
  1919. var _vectors = [64][8]uint8{
  1920. 0: {
  1921. 0: uint8(0x31),
  1922. 1: uint8(0x0e),
  1923. 2: uint8(0x0e),
  1924. 3: uint8(0xdd),
  1925. 4: uint8(0x47),
  1926. 5: uint8(0xdb),
  1927. 6: uint8(0x6f),
  1928. 7: uint8(0x72),
  1929. },
  1930. 1: {
  1931. 0: uint8(0xfd),
  1932. 1: uint8(0x67),
  1933. 2: uint8(0xdc),
  1934. 3: uint8(0x93),
  1935. 4: uint8(0xc5),
  1936. 5: uint8(0x39),
  1937. 6: uint8(0xf8),
  1938. 7: uint8(0x74),
  1939. },
  1940. 2: {
  1941. 0: uint8(0x5a),
  1942. 1: uint8(0x4f),
  1943. 2: uint8(0xa9),
  1944. 3: uint8(0xd9),
  1945. 4: uint8(0x09),
  1946. 5: uint8(0x80),
  1947. 6: uint8(0x6c),
  1948. 7: uint8(0x0d),
  1949. },
  1950. 3: {
  1951. 0: uint8(0x2d),
  1952. 1: uint8(0x7e),
  1953. 2: uint8(0xfb),
  1954. 3: uint8(0xd7),
  1955. 4: uint8(0x96),
  1956. 5: uint8(0x66),
  1957. 6: uint8(0x67),
  1958. 7: uint8(0x85),
  1959. },
  1960. 4: {
  1961. 0: uint8(0xb7),
  1962. 1: uint8(0x87),
  1963. 2: uint8(0x71),
  1964. 3: uint8(0x27),
  1965. 4: uint8(0xe0),
  1966. 5: uint8(0x94),
  1967. 6: uint8(0x27),
  1968. 7: uint8(0xcf),
  1969. },
  1970. 5: {
  1971. 0: uint8(0x8d),
  1972. 1: uint8(0xa6),
  1973. 2: uint8(0x99),
  1974. 3: uint8(0xcd),
  1975. 4: uint8(0x64),
  1976. 5: uint8(0x55),
  1977. 6: uint8(0x76),
  1978. 7: uint8(0x18),
  1979. },
  1980. 6: {
  1981. 0: uint8(0xce),
  1982. 1: uint8(0xe3),
  1983. 2: uint8(0xfe),
  1984. 3: uint8(0x58),
  1985. 4: uint8(0x6e),
  1986. 5: uint8(0x46),
  1987. 6: uint8(0xc9),
  1988. 7: uint8(0xcb),
  1989. },
  1990. 7: {
  1991. 0: uint8(0x37),
  1992. 1: uint8(0xd1),
  1993. 2: uint8(0x01),
  1994. 3: uint8(0x8b),
  1995. 4: uint8(0xf5),
  1996. 6: uint8(0x02),
  1997. 7: uint8(0xab),
  1998. },
  1999. 8: {
  2000. 0: uint8(0x62),
  2001. 1: uint8(0x24),
  2002. 2: uint8(0x93),
  2003. 3: uint8(0x9a),
  2004. 4: uint8(0x79),
  2005. 5: uint8(0xf5),
  2006. 6: uint8(0xf5),
  2007. 7: uint8(0x93),
  2008. },
  2009. 9: {
  2010. 0: uint8(0xb0),
  2011. 1: uint8(0xe4),
  2012. 2: uint8(0xa9),
  2013. 3: uint8(0x0b),
  2014. 4: uint8(0xdf),
  2015. 5: uint8(0x82),
  2016. 7: uint8(0x9e),
  2017. },
  2018. 10: {
  2019. 0: uint8(0xf3),
  2020. 1: uint8(0xb9),
  2021. 2: uint8(0xdd),
  2022. 3: uint8(0x94),
  2023. 4: uint8(0xc5),
  2024. 5: uint8(0xbb),
  2025. 6: uint8(0x5d),
  2026. 7: uint8(0x7a),
  2027. },
  2028. 11: {
  2029. 0: uint8(0xa7),
  2030. 1: uint8(0xad),
  2031. 2: uint8(0x6b),
  2032. 3: uint8(0x22),
  2033. 4: uint8(0x46),
  2034. 5: uint8(0x2f),
  2035. 6: uint8(0xb3),
  2036. 7: uint8(0xf4),
  2037. },
  2038. 12: {
  2039. 0: uint8(0xfb),
  2040. 1: uint8(0xe5),
  2041. 2: uint8(0x0e),
  2042. 3: uint8(0x86),
  2043. 4: uint8(0xbc),
  2044. 5: uint8(0x8f),
  2045. 6: uint8(0x1e),
  2046. 7: uint8(0x75),
  2047. },
  2048. 13: {
  2049. 0: uint8(0x90),
  2050. 1: uint8(0x3d),
  2051. 2: uint8(0x84),
  2052. 3: uint8(0xc0),
  2053. 4: uint8(0x27),
  2054. 5: uint8(0x56),
  2055. 6: uint8(0xea),
  2056. 7: uint8(0x14),
  2057. },
  2058. 14: {
  2059. 0: uint8(0xee),
  2060. 1: uint8(0xf2),
  2061. 2: uint8(0x7a),
  2062. 3: uint8(0x8e),
  2063. 4: uint8(0x90),
  2064. 5: uint8(0xca),
  2065. 6: uint8(0x23),
  2066. 7: uint8(0xf7),
  2067. },
  2068. 15: {
  2069. 0: uint8(0xe5),
  2070. 1: uint8(0x45),
  2071. 2: uint8(0xbe),
  2072. 3: uint8(0x49),
  2073. 4: uint8(0x61),
  2074. 5: uint8(0xca),
  2075. 6: uint8(0x29),
  2076. 7: uint8(0xa1),
  2077. },
  2078. 16: {
  2079. 0: uint8(0xdb),
  2080. 1: uint8(0x9b),
  2081. 2: uint8(0xc2),
  2082. 3: uint8(0x57),
  2083. 4: uint8(0x7f),
  2084. 5: uint8(0xcc),
  2085. 6: uint8(0x2a),
  2086. 7: uint8(0x3f),
  2087. },
  2088. 17: {
  2089. 0: uint8(0x94),
  2090. 1: uint8(0x47),
  2091. 2: uint8(0xbe),
  2092. 3: uint8(0x2c),
  2093. 4: uint8(0xf5),
  2094. 5: uint8(0xe9),
  2095. 6: uint8(0x9a),
  2096. 7: uint8(0x69),
  2097. },
  2098. 18: {
  2099. 0: uint8(0x9c),
  2100. 1: uint8(0xd3),
  2101. 2: uint8(0x8d),
  2102. 3: uint8(0x96),
  2103. 4: uint8(0xf0),
  2104. 5: uint8(0xb3),
  2105. 6: uint8(0xc1),
  2106. 7: uint8(0x4b),
  2107. },
  2108. 19: {
  2109. 0: uint8(0xbd),
  2110. 1: uint8(0x61),
  2111. 2: uint8(0x79),
  2112. 3: uint8(0xa7),
  2113. 4: uint8(0x1d),
  2114. 5: uint8(0xc9),
  2115. 6: uint8(0x6d),
  2116. 7: uint8(0xbb),
  2117. },
  2118. 20: {
  2119. 0: uint8(0x98),
  2120. 1: uint8(0xee),
  2121. 2: uint8(0xa2),
  2122. 3: uint8(0x1a),
  2123. 4: uint8(0xf2),
  2124. 5: uint8(0x5c),
  2125. 6: uint8(0xd6),
  2126. 7: uint8(0xbe),
  2127. },
  2128. 21: {
  2129. 0: uint8(0xc7),
  2130. 1: uint8(0x67),
  2131. 2: uint8(0x3b),
  2132. 3: uint8(0x2e),
  2133. 4: uint8(0xb0),
  2134. 5: uint8(0xcb),
  2135. 6: uint8(0xf2),
  2136. 7: uint8(0xd0),
  2137. },
  2138. 22: {
  2139. 0: uint8(0x88),
  2140. 1: uint8(0x3e),
  2141. 2: uint8(0xa3),
  2142. 3: uint8(0xe3),
  2143. 4: uint8(0x95),
  2144. 5: uint8(0x67),
  2145. 6: uint8(0x53),
  2146. 7: uint8(0x93),
  2147. },
  2148. 23: {
  2149. 0: uint8(0xc8),
  2150. 1: uint8(0xce),
  2151. 2: uint8(0x5c),
  2152. 3: uint8(0xcd),
  2153. 4: uint8(0x8c),
  2154. 5: uint8(0x03),
  2155. 6: uint8(0x0c),
  2156. 7: uint8(0xa8),
  2157. },
  2158. 24: {
  2159. 0: uint8(0x94),
  2160. 1: uint8(0xaf),
  2161. 2: uint8(0x49),
  2162. 3: uint8(0xf6),
  2163. 4: uint8(0xc6),
  2164. 5: uint8(0x50),
  2165. 6: uint8(0xad),
  2166. 7: uint8(0xb8),
  2167. },
  2168. 25: {
  2169. 0: uint8(0xea),
  2170. 1: uint8(0xb8),
  2171. 2: uint8(0x85),
  2172. 3: uint8(0x8a),
  2173. 4: uint8(0xde),
  2174. 5: uint8(0x92),
  2175. 6: uint8(0xe1),
  2176. 7: uint8(0xbc),
  2177. },
  2178. 26: {
  2179. 0: uint8(0xf3),
  2180. 1: uint8(0x15),
  2181. 2: uint8(0xbb),
  2182. 3: uint8(0x5b),
  2183. 4: uint8(0xb8),
  2184. 5: uint8(0x35),
  2185. 6: uint8(0xd8),
  2186. 7: uint8(0x17),
  2187. },
  2188. 27: {
  2189. 0: uint8(0xad),
  2190. 1: uint8(0xcf),
  2191. 2: uint8(0x6b),
  2192. 3: uint8(0x07),
  2193. 4: uint8(0x63),
  2194. 5: uint8(0x61),
  2195. 6: uint8(0x2e),
  2196. 7: uint8(0x2f),
  2197. },
  2198. 28: {
  2199. 0: uint8(0xa5),
  2200. 1: uint8(0xc9),
  2201. 2: uint8(0x1d),
  2202. 3: uint8(0xa7),
  2203. 4: uint8(0xac),
  2204. 5: uint8(0xaa),
  2205. 6: uint8(0x4d),
  2206. 7: uint8(0xde),
  2207. },
  2208. 29: {
  2209. 0: uint8(0x71),
  2210. 1: uint8(0x65),
  2211. 2: uint8(0x95),
  2212. 3: uint8(0x87),
  2213. 4: uint8(0x66),
  2214. 5: uint8(0x50),
  2215. 6: uint8(0xa2),
  2216. 7: uint8(0xa6),
  2217. },
  2218. 30: {
  2219. 0: uint8(0x28),
  2220. 1: uint8(0xef),
  2221. 2: uint8(0x49),
  2222. 3: uint8(0x5c),
  2223. 4: uint8(0x53),
  2224. 5: uint8(0xa3),
  2225. 6: uint8(0x87),
  2226. 7: uint8(0xad),
  2227. },
  2228. 31: {
  2229. 0: uint8(0x42),
  2230. 1: uint8(0xc3),
  2231. 2: uint8(0x41),
  2232. 3: uint8(0xd8),
  2233. 4: uint8(0xfa),
  2234. 5: uint8(0x92),
  2235. 6: uint8(0xd8),
  2236. 7: uint8(0x32),
  2237. },
  2238. 32: {
  2239. 0: uint8(0xce),
  2240. 1: uint8(0x7c),
  2241. 2: uint8(0xf2),
  2242. 3: uint8(0x72),
  2243. 4: uint8(0x2f),
  2244. 5: uint8(0x51),
  2245. 6: uint8(0x27),
  2246. 7: uint8(0x71),
  2247. },
  2248. 33: {
  2249. 0: uint8(0xe3),
  2250. 1: uint8(0x78),
  2251. 2: uint8(0x59),
  2252. 3: uint8(0xf9),
  2253. 4: uint8(0x46),
  2254. 5: uint8(0x23),
  2255. 6: uint8(0xf3),
  2256. 7: uint8(0xa7),
  2257. },
  2258. 34: {
  2259. 0: uint8(0x38),
  2260. 1: uint8(0x12),
  2261. 2: uint8(0x05),
  2262. 3: uint8(0xbb),
  2263. 4: uint8(0x1a),
  2264. 5: uint8(0xb0),
  2265. 6: uint8(0xe0),
  2266. 7: uint8(0x12),
  2267. },
  2268. 35: {
  2269. 0: uint8(0xae),
  2270. 1: uint8(0x97),
  2271. 2: uint8(0xa1),
  2272. 3: uint8(0x0f),
  2273. 4: uint8(0xd4),
  2274. 5: uint8(0x34),
  2275. 6: uint8(0xe0),
  2276. 7: uint8(0x15),
  2277. },
  2278. 36: {
  2279. 0: uint8(0xb4),
  2280. 1: uint8(0xa3),
  2281. 2: uint8(0x15),
  2282. 3: uint8(0x08),
  2283. 4: uint8(0xbe),
  2284. 5: uint8(0xff),
  2285. 6: uint8(0x4d),
  2286. 7: uint8(0x31),
  2287. },
  2288. 37: {
  2289. 0: uint8(0x81),
  2290. 1: uint8(0x39),
  2291. 2: uint8(0x62),
  2292. 3: uint8(0x29),
  2293. 4: uint8(0xf0),
  2294. 5: uint8(0x90),
  2295. 6: uint8(0x79),
  2296. 7: uint8(0x02),
  2297. },
  2298. 38: {
  2299. 0: uint8(0x4d),
  2300. 1: uint8(0x0c),
  2301. 2: uint8(0xf4),
  2302. 3: uint8(0x9e),
  2303. 4: uint8(0xe5),
  2304. 5: uint8(0xd4),
  2305. 6: uint8(0xdc),
  2306. 7: uint8(0xca),
  2307. },
  2308. 39: {
  2309. 0: uint8(0x5c),
  2310. 1: uint8(0x73),
  2311. 2: uint8(0x33),
  2312. 3: uint8(0x6a),
  2313. 4: uint8(0x76),
  2314. 5: uint8(0xd8),
  2315. 6: uint8(0xbf),
  2316. 7: uint8(0x9a),
  2317. },
  2318. 40: {
  2319. 0: uint8(0xd0),
  2320. 1: uint8(0xa7),
  2321. 2: uint8(0x04),
  2322. 3: uint8(0x53),
  2323. 4: uint8(0x6b),
  2324. 5: uint8(0xa9),
  2325. 6: uint8(0x3e),
  2326. 7: uint8(0x0e),
  2327. },
  2328. 41: {
  2329. 0: uint8(0x92),
  2330. 1: uint8(0x59),
  2331. 2: uint8(0x58),
  2332. 3: uint8(0xfc),
  2333. 4: uint8(0xd6),
  2334. 5: uint8(0x42),
  2335. 6: uint8(0x0c),
  2336. 7: uint8(0xad),
  2337. },
  2338. 42: {
  2339. 0: uint8(0xa9),
  2340. 1: uint8(0x15),
  2341. 2: uint8(0xc2),
  2342. 3: uint8(0x9b),
  2343. 4: uint8(0xc8),
  2344. 5: uint8(0x06),
  2345. 6: uint8(0x73),
  2346. 7: uint8(0x18),
  2347. },
  2348. 43: {
  2349. 0: uint8(0x95),
  2350. 1: uint8(0x2b),
  2351. 2: uint8(0x79),
  2352. 3: uint8(0xf3),
  2353. 4: uint8(0xbc),
  2354. 5: uint8(0x0a),
  2355. 6: uint8(0xa6),
  2356. 7: uint8(0xd4),
  2357. },
  2358. 44: {
  2359. 0: uint8(0xf2),
  2360. 1: uint8(0x1d),
  2361. 2: uint8(0xf2),
  2362. 3: uint8(0xe4),
  2363. 4: uint8(0x1d),
  2364. 5: uint8(0x45),
  2365. 6: uint8(0x35),
  2366. 7: uint8(0xf9),
  2367. },
  2368. 45: {
  2369. 0: uint8(0x87),
  2370. 1: uint8(0x57),
  2371. 2: uint8(0x75),
  2372. 3: uint8(0x19),
  2373. 4: uint8(0x04),
  2374. 5: uint8(0x8f),
  2375. 6: uint8(0x53),
  2376. 7: uint8(0xa9),
  2377. },
  2378. 46: {
  2379. 0: uint8(0x10),
  2380. 1: uint8(0xa5),
  2381. 2: uint8(0x6c),
  2382. 3: uint8(0xf5),
  2383. 4: uint8(0xdf),
  2384. 5: uint8(0xcd),
  2385. 6: uint8(0x9a),
  2386. 7: uint8(0xdb),
  2387. },
  2388. 47: {
  2389. 0: uint8(0xeb),
  2390. 1: uint8(0x75),
  2391. 2: uint8(0x09),
  2392. 3: uint8(0x5c),
  2393. 4: uint8(0xcd),
  2394. 5: uint8(0x98),
  2395. 6: uint8(0x6c),
  2396. 7: uint8(0xd0),
  2397. },
  2398. 48: {
  2399. 0: uint8(0x51),
  2400. 1: uint8(0xa9),
  2401. 2: uint8(0xcb),
  2402. 3: uint8(0x9e),
  2403. 4: uint8(0xcb),
  2404. 5: uint8(0xa3),
  2405. 6: uint8(0x12),
  2406. 7: uint8(0xe6),
  2407. },
  2408. 49: {
  2409. 0: uint8(0x96),
  2410. 1: uint8(0xaf),
  2411. 2: uint8(0xad),
  2412. 3: uint8(0xfc),
  2413. 4: uint8(0x2c),
  2414. 5: uint8(0xe6),
  2415. 6: uint8(0x66),
  2416. 7: uint8(0xc7),
  2417. },
  2418. 50: {
  2419. 0: uint8(0x72),
  2420. 1: uint8(0xfe),
  2421. 2: uint8(0x52),
  2422. 3: uint8(0x97),
  2423. 4: uint8(0x5a),
  2424. 5: uint8(0x43),
  2425. 6: uint8(0x64),
  2426. 7: uint8(0xee),
  2427. },
  2428. 51: {
  2429. 0: uint8(0x5a),
  2430. 1: uint8(0x16),
  2431. 2: uint8(0x45),
  2432. 3: uint8(0xb2),
  2433. 4: uint8(0x76),
  2434. 5: uint8(0xd5),
  2435. 6: uint8(0x92),
  2436. 7: uint8(0xa1),
  2437. },
  2438. 52: {
  2439. 0: uint8(0xb2),
  2440. 1: uint8(0x74),
  2441. 2: uint8(0xcb),
  2442. 3: uint8(0x8e),
  2443. 4: uint8(0xbf),
  2444. 5: uint8(0x87),
  2445. 6: uint8(0x87),
  2446. 7: uint8(0x0a),
  2447. },
  2448. 53: {
  2449. 0: uint8(0x6f),
  2450. 1: uint8(0x9b),
  2451. 2: uint8(0xb4),
  2452. 3: uint8(0x20),
  2453. 4: uint8(0x3d),
  2454. 5: uint8(0xe7),
  2455. 6: uint8(0xb3),
  2456. 7: uint8(0x81),
  2457. },
  2458. 54: {
  2459. 0: uint8(0xea),
  2460. 1: uint8(0xec),
  2461. 2: uint8(0xb2),
  2462. 3: uint8(0xa3),
  2463. 4: uint8(0x0b),
  2464. 5: uint8(0x22),
  2465. 6: uint8(0xa8),
  2466. 7: uint8(0x7f),
  2467. },
  2468. 55: {
  2469. 0: uint8(0x99),
  2470. 1: uint8(0x24),
  2471. 2: uint8(0xa4),
  2472. 3: uint8(0x3c),
  2473. 4: uint8(0xc1),
  2474. 5: uint8(0x31),
  2475. 6: uint8(0x57),
  2476. 7: uint8(0x24),
  2477. },
  2478. 56: {
  2479. 0: uint8(0xbd),
  2480. 1: uint8(0x83),
  2481. 2: uint8(0x8d),
  2482. 3: uint8(0x3a),
  2483. 4: uint8(0xaf),
  2484. 5: uint8(0xbf),
  2485. 6: uint8(0x8d),
  2486. 7: uint8(0xb7),
  2487. },
  2488. 57: {
  2489. 0: uint8(0x0b),
  2490. 1: uint8(0x1a),
  2491. 2: uint8(0x2a),
  2492. 3: uint8(0x32),
  2493. 4: uint8(0x65),
  2494. 5: uint8(0xd5),
  2495. 6: uint8(0x1a),
  2496. 7: uint8(0xea),
  2497. },
  2498. 58: {
  2499. 0: uint8(0x13),
  2500. 1: uint8(0x50),
  2501. 2: uint8(0x79),
  2502. 3: uint8(0xa3),
  2503. 4: uint8(0x23),
  2504. 5: uint8(0x1c),
  2505. 6: uint8(0xe6),
  2506. 7: uint8(0x60),
  2507. },
  2508. 59: {
  2509. 0: uint8(0x93),
  2510. 1: uint8(0x2b),
  2511. 2: uint8(0x28),
  2512. 3: uint8(0x46),
  2513. 4: uint8(0xe4),
  2514. 5: uint8(0xd7),
  2515. 6: uint8(0x06),
  2516. 7: uint8(0x66),
  2517. },
  2518. 60: {
  2519. 0: uint8(0xe1),
  2520. 1: uint8(0x91),
  2521. 2: uint8(0x5f),
  2522. 3: uint8(0x5c),
  2523. 4: uint8(0xb1),
  2524. 5: uint8(0xec),
  2525. 6: uint8(0xa4),
  2526. 7: uint8(0x6c),
  2527. },
  2528. 61: {
  2529. 0: uint8(0xf3),
  2530. 1: uint8(0x25),
  2531. 2: uint8(0x96),
  2532. 3: uint8(0x5c),
  2533. 4: uint8(0xa1),
  2534. 5: uint8(0x6d),
  2535. 6: uint8(0x62),
  2536. 7: uint8(0x9f),
  2537. },
  2538. 62: {
  2539. 0: uint8(0x57),
  2540. 1: uint8(0x5f),
  2541. 2: uint8(0xf2),
  2542. 3: uint8(0x8e),
  2543. 4: uint8(0x60),
  2544. 5: uint8(0x38),
  2545. 6: uint8(0x1b),
  2546. 7: uint8(0xe5),
  2547. },
  2548. 63: {
  2549. 0: uint8(0x72),
  2550. 1: uint8(0x45),
  2551. 2: uint8(0x06),
  2552. 3: uint8(0xeb),
  2553. 4: uint8(0x4c),
  2554. 5: uint8(0x32),
  2555. 6: uint8(0x8a),
  2556. 7: uint8(0x95),
  2557. },
  2558. }
  2559. type TICHAR = uint8
  2560. type TPOSITION = struct {
  2561. FlineNumber TXML_Size
  2562. FcolumnNumber TXML_Size
  2563. }
  2564. type Tposition = TPOSITION
  2565. type TATTRIBUTE = struct {
  2566. Fname uintptr
  2567. FvaluePtr uintptr
  2568. FvalueEnd uintptr
  2569. Fnormalized uint8
  2570. }
  2571. type Tencoding = struct {
  2572. Fscanners [4]TSCANNER
  2573. FliteralScanners [2]TSCANNER
  2574. FnameMatchesAscii uintptr
  2575. FnameLength uintptr
  2576. FskipS uintptr
  2577. FgetAtts uintptr
  2578. FcharRefNumber uintptr
  2579. FpredefinedEntityName uintptr
  2580. FupdatePosition uintptr
  2581. FisPublicId uintptr
  2582. Futf8Convert uintptr
  2583. Futf16Convert uintptr
  2584. FminBytesPerChar int32
  2585. FisUtf8 uint8
  2586. FisUtf16 uint8
  2587. }
  2588. type TENCODING = struct {
  2589. Fscanners [4]TSCANNER
  2590. FliteralScanners [2]TSCANNER
  2591. FnameMatchesAscii uintptr
  2592. FnameLength uintptr
  2593. FskipS uintptr
  2594. FgetAtts uintptr
  2595. FcharRefNumber uintptr
  2596. FpredefinedEntityName uintptr
  2597. FupdatePosition uintptr
  2598. FisPublicId uintptr
  2599. Futf8Convert uintptr
  2600. Futf16Convert uintptr
  2601. FminBytesPerChar int32
  2602. FisUtf8 uint8
  2603. FisUtf16 uint8
  2604. }
  2605. type TSCANNER = uintptr
  2606. type _XML_Convert_Result = int32
  2607. const _XML_CONVERT_COMPLETED = 0
  2608. const _XML_CONVERT_INPUT_INCOMPLETE = 1
  2609. const _XML_CONVERT_OUTPUT_EXHAUSTED = 2
  2610. type TINIT_ENCODING = struct {
  2611. FinitEnc TENCODING
  2612. FencPtr uintptr
  2613. }
  2614. type TCONVERTER = uintptr
  2615. const _XML_ROLE_ERROR = -1
  2616. const _XML_ROLE_NONE = 0
  2617. const _XML_ROLE_XML_DECL = 1
  2618. const _XML_ROLE_INSTANCE_START = 2
  2619. const _XML_ROLE_DOCTYPE_NONE = 3
  2620. const _XML_ROLE_DOCTYPE_NAME = 4
  2621. const _XML_ROLE_DOCTYPE_SYSTEM_ID = 5
  2622. const _XML_ROLE_DOCTYPE_PUBLIC_ID = 6
  2623. const _XML_ROLE_DOCTYPE_INTERNAL_SUBSET = 7
  2624. const _XML_ROLE_DOCTYPE_CLOSE = 8
  2625. const _XML_ROLE_GENERAL_ENTITY_NAME = 9
  2626. const _XML_ROLE_PARAM_ENTITY_NAME = 10
  2627. const _XML_ROLE_ENTITY_NONE = 11
  2628. const _XML_ROLE_ENTITY_VALUE = 12
  2629. const _XML_ROLE_ENTITY_SYSTEM_ID = 13
  2630. const _XML_ROLE_ENTITY_PUBLIC_ID = 14
  2631. const _XML_ROLE_ENTITY_COMPLETE = 15
  2632. const _XML_ROLE_ENTITY_NOTATION_NAME = 16
  2633. const _XML_ROLE_NOTATION_NONE = 17
  2634. const _XML_ROLE_NOTATION_NAME = 18
  2635. const _XML_ROLE_NOTATION_SYSTEM_ID = 19
  2636. const _XML_ROLE_NOTATION_NO_SYSTEM_ID = 20
  2637. const _XML_ROLE_NOTATION_PUBLIC_ID = 21
  2638. const _XML_ROLE_ATTRIBUTE_NAME = 22
  2639. const _XML_ROLE_ATTRIBUTE_TYPE_CDATA = 23
  2640. const _XML_ROLE_ATTRIBUTE_TYPE_ID = 24
  2641. const _XML_ROLE_ATTRIBUTE_TYPE_IDREF = 25
  2642. const _XML_ROLE_ATTRIBUTE_TYPE_IDREFS = 26
  2643. const _XML_ROLE_ATTRIBUTE_TYPE_ENTITY = 27
  2644. const _XML_ROLE_ATTRIBUTE_TYPE_ENTITIES = 28
  2645. const _XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN = 29
  2646. const _XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS = 30
  2647. const _XML_ROLE_ATTRIBUTE_ENUM_VALUE = 31
  2648. const _XML_ROLE_ATTRIBUTE_NOTATION_VALUE = 32
  2649. const _XML_ROLE_ATTLIST_NONE = 33
  2650. const _XML_ROLE_ATTLIST_ELEMENT_NAME = 34
  2651. const _XML_ROLE_IMPLIED_ATTRIBUTE_VALUE = 35
  2652. const _XML_ROLE_REQUIRED_ATTRIBUTE_VALUE = 36
  2653. const _XML_ROLE_DEFAULT_ATTRIBUTE_VALUE = 37
  2654. const _XML_ROLE_FIXED_ATTRIBUTE_VALUE = 38
  2655. const _XML_ROLE_ELEMENT_NONE = 39
  2656. const _XML_ROLE_ELEMENT_NAME = 40
  2657. const _XML_ROLE_CONTENT_ANY = 41
  2658. const _XML_ROLE_CONTENT_EMPTY = 42
  2659. const _XML_ROLE_CONTENT_PCDATA = 43
  2660. const _XML_ROLE_GROUP_OPEN = 44
  2661. const _XML_ROLE_GROUP_CLOSE = 45
  2662. const _XML_ROLE_GROUP_CLOSE_REP = 46
  2663. const _XML_ROLE_GROUP_CLOSE_OPT = 47
  2664. const _XML_ROLE_GROUP_CLOSE_PLUS = 48
  2665. const _XML_ROLE_GROUP_CHOICE = 49
  2666. const _XML_ROLE_GROUP_SEQUENCE = 50
  2667. const _XML_ROLE_CONTENT_ELEMENT = 51
  2668. const _XML_ROLE_CONTENT_ELEMENT_REP = 52
  2669. const _XML_ROLE_CONTENT_ELEMENT_OPT = 53
  2670. const _XML_ROLE_CONTENT_ELEMENT_PLUS = 54
  2671. const _XML_ROLE_PI = 55
  2672. const _XML_ROLE_COMMENT = 56
  2673. const _XML_ROLE_TEXT_DECL = 57
  2674. const _XML_ROLE_IGNORE_SECT = 58
  2675. const _XML_ROLE_INNER_PARAM_ENTITY_REF = 59
  2676. const _XML_ROLE_PARAM_ENTITY_REF = 60
  2677. type TPROLOG_STATE = struct {
  2678. Fhandler uintptr
  2679. Flevel uint32
  2680. Frole_none int32
  2681. FincludeLevel uint32
  2682. FdocumentEntity int32
  2683. FinEntityValue int32
  2684. }
  2685. type Tprolog_state = TPROLOG_STATE
  2686. type TKEY = uintptr
  2687. type TNAMED = struct {
  2688. Fname TKEY
  2689. }
  2690. type THASH_TABLE = struct {
  2691. Fv uintptr
  2692. Fpower uint8
  2693. Fsize Tsize_t
  2694. Fused Tsize_t
  2695. Fmem uintptr
  2696. }
  2697. /* For probing (after a collision) we need a step size relative prime
  2698. to the hash table size, which is a power of 2. We use double-hashing,
  2699. since we can calculate a second hash value cheaply by taking those bits
  2700. of the first hash value that were discarded (masked out) when the table
  2701. index was calculated: index = hash & mask, where mask = table->size - 1.
  2702. We limit the maximum step size to table->size / 4 (mask >> 2) and make
  2703. it odd, since odd numbers are always relative prime to a power of 2.
  2704. */
  2705. type THASH_TABLE_ITER = struct {
  2706. Fp uintptr
  2707. Fend uintptr
  2708. }
  2709. type TBINDING = struct {
  2710. Fprefix uintptr
  2711. FnextTagBinding uintptr
  2712. FprevPrefixBinding uintptr
  2713. FattId uintptr
  2714. Furi uintptr
  2715. FuriLen int32
  2716. FuriAlloc int32
  2717. }
  2718. type Tbinding = TBINDING
  2719. type TPREFIX = struct {
  2720. Fname uintptr
  2721. Fbinding uintptr
  2722. }
  2723. type Tprefix = TPREFIX
  2724. type TTAG_NAME = struct {
  2725. Fstr uintptr
  2726. FlocalPart uintptr
  2727. Fprefix uintptr
  2728. FstrLen int32
  2729. FuriLen int32
  2730. FprefixLen int32
  2731. }
  2732. // C documentation
  2733. //
  2734. // /* TAG represents an open element.
  2735. // The name of the element is stored in both the document and API
  2736. // encodings. The memory buffer 'buf' is a separately-allocated
  2737. // memory area which stores the name. During the XML_Parse()/
  2738. // XMLParseBuffer() when the element is open, the memory for the 'raw'
  2739. // version of the name (in the document encoding) is shared with the
  2740. // document buffer. If the element is open across calls to
  2741. // XML_Parse()/XML_ParseBuffer(), the buffer is re-allocated to
  2742. // contain the 'raw' name as well.
  2743. //
  2744. // A parser re-uses these structures, maintaining a list of allocated
  2745. // TAG objects in a free list.
  2746. // */
  2747. type TTAG = struct {
  2748. Fparent uintptr
  2749. FrawName uintptr
  2750. FrawNameLength int32
  2751. Fname TTAG_NAME
  2752. Fbuf uintptr
  2753. FbufEnd uintptr
  2754. Fbindings uintptr
  2755. }
  2756. // C documentation
  2757. //
  2758. // /* TAG represents an open element.
  2759. // The name of the element is stored in both the document and API
  2760. // encodings. The memory buffer 'buf' is a separately-allocated
  2761. // memory area which stores the name. During the XML_Parse()/
  2762. // XMLParseBuffer() when the element is open, the memory for the 'raw'
  2763. // version of the name (in the document encoding) is shared with the
  2764. // document buffer. If the element is open across calls to
  2765. // XML_Parse()/XML_ParseBuffer(), the buffer is re-allocated to
  2766. // contain the 'raw' name as well.
  2767. //
  2768. // A parser re-uses these structures, maintaining a list of allocated
  2769. // TAG objects in a free list.
  2770. // */
  2771. type Ttag = TTAG
  2772. type TENTITY = struct {
  2773. Fname uintptr
  2774. FtextPtr uintptr
  2775. FtextLen int32
  2776. Fprocessed int32
  2777. FsystemId uintptr
  2778. Fbase uintptr
  2779. FpublicId uintptr
  2780. Fnotation uintptr
  2781. Fopen TXML_Bool
  2782. Fis_param TXML_Bool
  2783. Fis_internal TXML_Bool
  2784. }
  2785. type TCONTENT_SCAFFOLD = struct {
  2786. Ftype1 _XML_Content_Type
  2787. Fquant _XML_Content_Quant
  2788. Fname uintptr
  2789. Ffirstchild int32
  2790. Flastchild int32
  2791. Fchildcnt int32
  2792. Fnextsib int32
  2793. }
  2794. type TBLOCK = struct {
  2795. Fnext uintptr
  2796. Fsize int32
  2797. Fs [1]TXML_Char
  2798. }
  2799. type Tblock = TBLOCK
  2800. type TSTRING_POOL = struct {
  2801. Fblocks uintptr
  2802. FfreeBlocks uintptr
  2803. Fend uintptr
  2804. Fptr uintptr
  2805. Fstart uintptr
  2806. Fmem uintptr
  2807. }
  2808. // C documentation
  2809. //
  2810. // /* The XML_Char before the name is used to determine whether
  2811. // an attribute has been specified. */
  2812. type TATTRIBUTE_ID = struct {
  2813. Fname uintptr
  2814. Fprefix uintptr
  2815. FmaybeTokenized TXML_Bool
  2816. Fxmlns TXML_Bool
  2817. }
  2818. // C documentation
  2819. //
  2820. // /* The XML_Char before the name is used to determine whether
  2821. // an attribute has been specified. */
  2822. type Tattribute_id = TATTRIBUTE_ID
  2823. type TDEFAULT_ATTRIBUTE = struct {
  2824. Fid uintptr
  2825. FisCdata TXML_Bool
  2826. Fvalue uintptr
  2827. }
  2828. type TNS_ATT = struct {
  2829. Fversion uint32
  2830. Fhash uint32
  2831. FuriName uintptr
  2832. }
  2833. type TELEMENT_TYPE = struct {
  2834. Fname uintptr
  2835. Fprefix uintptr
  2836. FidAtt uintptr
  2837. FnDefaultAtts int32
  2838. FallocDefaultAtts int32
  2839. FdefaultAtts uintptr
  2840. }
  2841. type TDTD = struct {
  2842. FgeneralEntities THASH_TABLE
  2843. FelementTypes THASH_TABLE
  2844. FattributeIds THASH_TABLE
  2845. Fprefixes THASH_TABLE
  2846. Fpool TSTRING_POOL
  2847. FentityValuePool TSTRING_POOL
  2848. FkeepProcessing TXML_Bool
  2849. FhasParamEntityRefs TXML_Bool
  2850. Fstandalone TXML_Bool
  2851. FparamEntityRead TXML_Bool
  2852. FparamEntities THASH_TABLE
  2853. FdefaultPrefix TPREFIX
  2854. Fin_eldecl TXML_Bool
  2855. Fscaffold uintptr
  2856. FcontentStringLen uint32
  2857. FscaffSize uint32
  2858. FscaffCount uint32
  2859. FscaffLevel int32
  2860. FscaffIndex uintptr
  2861. }
  2862. type TOPEN_INTERNAL_ENTITY = struct {
  2863. FinternalEventPtr uintptr
  2864. FinternalEventEndPtr uintptr
  2865. Fnext uintptr
  2866. Fentity uintptr
  2867. FstartTagLevel int32
  2868. FbetweenDecl TXML_Bool
  2869. }
  2870. type Topen_internal_entity = TOPEN_INTERNAL_ENTITY
  2871. type _XML_Account = int32
  2872. const _XML_ACCOUNT_DIRECT = 0
  2873. const /* bytes directly passed to the Expat parser */
  2874. _XML_ACCOUNT_ENTITY_EXPANSION = 1
  2875. const /* intermediate bytes produced during entity
  2876. expansion */
  2877. _XML_ACCOUNT_NONE = 2
  2878. type TXmlBigCount = uint64
  2879. type TACCOUNTING = struct {
  2880. F__ccgo_align [0]uint32
  2881. FcountBytesDirect TXmlBigCount
  2882. FcountBytesIndirect TXmlBigCount
  2883. FdebugLevel int32
  2884. FmaximumAmplificationFactor float32
  2885. FactivationThresholdBytes uint64
  2886. }
  2887. type Taccounting = TACCOUNTING
  2888. type TENTITY_STATS = struct {
  2889. FcountEverOpened uint32
  2890. FcurrentDepth uint32
  2891. FmaximumDepthSeen uint32
  2892. FdebugLevel int32
  2893. }
  2894. type Tentity_stats = TENTITY_STATS
  2895. func XXML_ParserCreate(tls *libc.TLS, encodingName uintptr) (r TXML_Parser) {
  2896. return XXML_ParserCreate_MM(tls, encodingName, libc.UintptrFromInt32(0), libc.UintptrFromInt32(0))
  2897. }
  2898. func XXML_ParserCreateNS(tls *libc.TLS, encodingName uintptr, nsSep TXML_Char) (r TXML_Parser) {
  2899. bp := tls.Alloc(16)
  2900. defer tls.Free(16)
  2901. var _ /* tmp at bp+0 */ [2]TXML_Char
  2902. *(*[2]TXML_Char)(unsafe.Pointer(bp)) = [2]TXML_Char{
  2903. 0: nsSep,
  2904. }
  2905. return XXML_ParserCreate_MM(tls, encodingName, libc.UintptrFromInt32(0), bp)
  2906. }
  2907. // C documentation
  2908. //
  2909. // // "xml=http://www.w3.org/XML/1998/namespace"
  2910. var _implicitContext = [41]TXML_Char{
  2911. 0: uint8(m_ASCII_x),
  2912. 1: uint8(m_ASCII_m),
  2913. 2: uint8(m_ASCII_l),
  2914. 3: uint8(m_ASCII_EQUALS),
  2915. 4: uint8(m_ASCII_h),
  2916. 5: uint8(m_ASCII_t),
  2917. 6: uint8(m_ASCII_t),
  2918. 7: uint8(m_ASCII_p),
  2919. 8: uint8(m_ASCII_COLON),
  2920. 9: uint8(m_ASCII_SLASH),
  2921. 10: uint8(m_ASCII_SLASH),
  2922. 11: uint8(m_ASCII_w),
  2923. 12: uint8(m_ASCII_w),
  2924. 13: uint8(m_ASCII_w),
  2925. 14: uint8(m_ASCII_PERIOD),
  2926. 15: uint8(m_ASCII_w),
  2927. 16: uint8(m_ASCII_3),
  2928. 17: uint8(m_ASCII_PERIOD),
  2929. 18: uint8(m_ASCII_o),
  2930. 19: uint8(m_ASCII_r),
  2931. 20: uint8(m_ASCII_g),
  2932. 21: uint8(m_ASCII_SLASH),
  2933. 22: uint8(m_ASCII_X),
  2934. 23: uint8(m_ASCII_M),
  2935. 24: uint8(m_ASCII_L),
  2936. 25: uint8(m_ASCII_SLASH),
  2937. 26: uint8(m_ASCII_1),
  2938. 27: uint8(m_ASCII_9),
  2939. 28: uint8(m_ASCII_9),
  2940. 29: uint8(m_ASCII_8),
  2941. 30: uint8(m_ASCII_SLASH),
  2942. 31: uint8(m_ASCII_n),
  2943. 32: uint8(m_ASCII_a),
  2944. 33: uint8(m_ASCII_m),
  2945. 34: uint8(m_ASCII_e),
  2946. 35: uint8(m_ASCII_s),
  2947. 36: uint8(m_ASCII_p),
  2948. 37: uint8(m_ASCII_a),
  2949. 38: uint8(m_ASCII_c),
  2950. 39: uint8(m_ASCII_e),
  2951. }
  2952. /* To avoid warnings about unused functions: */
  2953. func _ENTROPY_DEBUG(tls *libc.TLS, label uintptr, entropy uint32) (r uint32) {
  2954. bp := tls.Alloc(48)
  2955. defer tls.Free(48)
  2956. if _getDebugLevel(tls, __ccgo_ts+17, uint32(0)) >= uint32(1) {
  2957. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+37, libc.VaList(bp+8, label, libc.Int32FromInt64(4)*libc.Int32FromInt32(2), entropy, libc.Uint32FromInt64(4)))
  2958. }
  2959. return entropy
  2960. }
  2961. func _generate_hash_secret_salt(tls *libc.TLS, parser TXML_Parser) (r uint32) {
  2962. bp := tls.Alloc(16)
  2963. defer tls.Free(16)
  2964. var _ /* entropy at bp+0 */ uint32
  2965. _ = parser
  2966. /* "Failproof" high quality providers: */
  2967. libbsd.Xarc4random_buf(tls, bp, uint32(4))
  2968. return _ENTROPY_DEBUG(tls, __ccgo_ts+81, *(*uint32)(unsafe.Pointer(bp)))
  2969. }
  2970. func _get_hash_secret_salt(tls *libc.TLS, parser TXML_Parser) (r uint32) {
  2971. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != libc.UintptrFromInt32(0) {
  2972. return _get_hash_secret_salt(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser)
  2973. }
  2974. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt
  2975. }
  2976. func _startParsing(tls *libc.TLS, parser TXML_Parser) (r TXML_Bool) {
  2977. /* hash functions must be initialized before setContext() is called */
  2978. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt == uint32(0) {
  2979. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = _generate_hash_secret_salt(tls, parser)
  2980. }
  2981. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  2982. /* implicit context only set for root parser, since child
  2983. parsers (i.e. external entity parsers) will inherit it
  2984. */
  2985. return _setContext(tls, parser, uintptr(unsafe.Pointer(&_implicitContext)))
  2986. }
  2987. return libc.Uint8FromInt32(1)
  2988. }
  2989. func XXML_ParserCreate_MM(tls *libc.TLS, encodingName uintptr, memsuite uintptr, nameSep uintptr) (r TXML_Parser) {
  2990. return _parserCreate(tls, encodingName, memsuite, nameSep, libc.UintptrFromInt32(0))
  2991. }
  2992. func _parserCreate(tls *libc.TLS, encodingName uintptr, memsuite uintptr, nameSep uintptr, dtd uintptr) (r TXML_Parser) {
  2993. var mtemp, mtemp1 uintptr
  2994. var parser TXML_Parser
  2995. _, _, _ = mtemp, mtemp1, parser
  2996. if memsuite != 0 {
  2997. parser = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Fmalloc_fcn})))(tls, uint32(544))
  2998. if parser != libc.UintptrFromInt32(0) {
  2999. mtemp = parser + 12
  3000. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp)).Fmalloc_fcn = (*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Fmalloc_fcn
  3001. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp)).Frealloc_fcn = (*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Frealloc_fcn
  3002. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp)).Ffree_fcn = (*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Ffree_fcn
  3003. }
  3004. } else {
  3005. parser = libc.Xmalloc(tls, uint32(544))
  3006. if parser != libc.UintptrFromInt32(0) {
  3007. mtemp1 = parser + 12
  3008. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp1)).Fmalloc_fcn = __ccgo_fp(libc.Xmalloc)
  3009. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp1)).Frealloc_fcn = __ccgo_fp(libc.Xrealloc)
  3010. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp1)).Ffree_fcn = __ccgo_fp(libc.Xfree)
  3011. }
  3012. }
  3013. if !(parser != 0) {
  3014. return parser
  3015. }
  3016. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer = libc.UintptrFromInt32(0)
  3017. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim = libc.UintptrFromInt32(0)
  3018. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = int32(m_INIT_ATTS_SIZE)
  3019. (*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.Uint32FromInt32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize)*libc.Uint32FromInt64(16))
  3020. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts == libc.UintptrFromInt32(0) {
  3021. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  3022. return libc.UintptrFromInt32(0)
  3023. }
  3024. (*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.Uint32FromInt32(m_INIT_DATA_BUF_SIZE)*libc.Uint32FromInt64(1))
  3025. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf == libc.UintptrFromInt32(0) {
  3026. (*(*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)
  3027. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  3028. return libc.UintptrFromInt32(0)
  3029. }
  3030. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf + uintptr(m_INIT_DATA_BUF_SIZE)
  3031. if dtd != 0 {
  3032. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd = dtd
  3033. } else {
  3034. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd = _dtdCreate(tls, parser+12)
  3035. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd == libc.UintptrFromInt32(0) {
  3036. (*(*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)
  3037. (*(*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)
  3038. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  3039. return libc.UintptrFromInt32(0)
  3040. }
  3041. }
  3042. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = libc.UintptrFromInt32(0)
  3043. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = libc.UintptrFromInt32(0)
  3044. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = libc.UintptrFromInt32(0)
  3045. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize = uint32(0)
  3046. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector = libc.UintptrFromInt32(0)
  3047. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler = libc.UintptrFromInt32(0)
  3048. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandlerData = libc.UintptrFromInt32(0)
  3049. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator = uint8(m_ASCII_EXCL)
  3050. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns = libc.Uint8FromInt32(0)
  3051. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets = libc.Uint8FromInt32(0)
  3052. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts = libc.UintptrFromInt32(0)
  3053. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsVersion = uint32(0)
  3054. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = uint8(0)
  3055. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = libc.UintptrFromInt32(0)
  3056. _poolInit(tls, parser+412, parser+12)
  3057. _poolInit(tls, parser+436, parser+12)
  3058. _parserInit(tls, parser, encodingName)
  3059. if encodingName != 0 && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName != 0) {
  3060. if dtd != 0 {
  3061. // We need to stop the upcoming call to XML_ParserFree from happily
  3062. // destroying parser->m_dtd because the DTD is shared with the parent
  3063. // parser and the only guard that keeps XML_ParserFree from destroying
  3064. // parser->m_dtd is parser->m_isParamEntity but it will be set to
  3065. // XML_TRUE only later in XML_ExternalEntityParserCreate (or not at all).
  3066. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd = libc.UintptrFromInt32(0)
  3067. }
  3068. XXML_ParserFree(tls, parser)
  3069. return libc.UintptrFromInt32(0)
  3070. }
  3071. if nameSep != 0 {
  3072. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns = libc.Uint8FromInt32(1)
  3073. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding = XXmlGetUtf8InternalEncodingNS(tls)
  3074. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator = *(*TXML_Char)(unsafe.Pointer(nameSep))
  3075. } else {
  3076. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding = XXmlGetUtf8InternalEncoding(tls)
  3077. }
  3078. return parser
  3079. }
  3080. func _parserInit(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) {
  3081. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologInitProcessor)
  3082. XXmlPrologStateInit(tls, parser+252)
  3083. if encodingName != libc.UintptrFromInt32(0) {
  3084. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = _copyString(tls, encodingName, parser+12)
  3085. }
  3086. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase = libc.UintptrFromInt32(0)
  3087. XXmlInitEncoding(tls, parser+148, parser+144, uintptr(0))
  3088. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = libc.UintptrFromInt32(0)
  3089. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = libc.UintptrFromInt32(0)
  3090. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = libc.UintptrFromInt32(0)
  3091. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = libc.UintptrFromInt32(0)
  3092. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler = libc.UintptrFromInt32(0)
  3093. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler = libc.UintptrFromInt32(0)
  3094. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler = libc.UintptrFromInt32(0)
  3095. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = libc.UintptrFromInt32(0)
  3096. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = libc.UintptrFromInt32(0)
  3097. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = libc.UintptrFromInt32(0)
  3098. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler = libc.UintptrFromInt32(0)
  3099. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler = libc.UintptrFromInt32(0)
  3100. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler = libc.UintptrFromInt32(0)
  3101. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler = libc.UintptrFromInt32(0)
  3102. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = libc.UintptrFromInt32(0)
  3103. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = libc.UintptrFromInt32(0)
  3104. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler = libc.UintptrFromInt32(0)
  3105. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler = libc.UintptrFromInt32(0)
  3106. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = parser
  3107. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler = libc.UintptrFromInt32(0)
  3108. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler = libc.UintptrFromInt32(0)
  3109. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler = libc.UintptrFromInt32(0)
  3110. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler = libc.UintptrFromInt32(0)
  3111. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler = libc.UintptrFromInt32(0)
  3112. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer
  3113. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer
  3114. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndByteIndex = 0
  3115. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr = libc.UintptrFromInt32(0)
  3116. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = libc.UintptrFromInt32(0)
  3117. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId = libc.UintptrFromInt32(0)
  3118. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  3119. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName = libc.UintptrFromInt32(0)
  3120. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = libc.UintptrFromInt32(0)
  3121. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid = libc.UintptrFromInt32(0)
  3122. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = libc.UintptrFromInt32(0)
  3123. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName = libc.UintptrFromInt32(0)
  3124. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId = libc.UintptrFromInt32(0)
  3125. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata = libc.Uint8FromInt32(0)
  3126. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId = libc.Uint8FromInt32(0)
  3127. libc.Xmemset(tls, parser+404, 0, uint32(8))
  3128. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NONE)
  3129. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = libc.UintptrFromInt32(0)
  3130. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = libc.UintptrFromInt32(0)
  3131. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = libc.UintptrFromInt32(0)
  3132. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = libc.UintptrFromInt32(0)
  3133. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = libc.Uint8FromInt32(1)
  3134. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel = 0
  3135. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack = libc.UintptrFromInt32(0)
  3136. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_inheritedBindings = libc.UintptrFromInt32(0)
  3137. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nSpecifiedAtts = 0
  3138. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem = libc.UintptrFromInt32(0)
  3139. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease = libc.UintptrFromInt32(0)
  3140. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData = libc.UintptrFromInt32(0)
  3141. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser = libc.UintptrFromInt32(0)
  3142. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_INITIALIZED)
  3143. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity = libc.Uint8FromInt32(0)
  3144. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  3145. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = int32(_XML_PARAM_ENTITY_PARSING_NEVER)
  3146. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = uint32(0)
  3147. libc.Xmemset(tls, parser+496, 0, uint32(32))
  3148. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FdebugLevel = libc.Int32FromUint32(_getDebugLevel(tls, __ccgo_ts+96, 0))
  3149. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FmaximumAmplificationFactor = libc.Float32FromFloat32(100)
  3150. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FactivationThresholdBytes = uint64(m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT)
  3151. libc.Xmemset(tls, parser+528, 0, uint32(16))
  3152. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entity_stats.FdebugLevel = libc.Int32FromUint32(_getDebugLevel(tls, __ccgo_ts+119, 0))
  3153. }
  3154. // C documentation
  3155. //
  3156. // /* moves list of bindings to m_freeBindingList */
  3157. func _moveToFreeBindingList(tls *libc.TLS, parser TXML_Parser, bindings uintptr) {
  3158. var b uintptr
  3159. _ = b
  3160. for bindings != 0 {
  3161. b = bindings
  3162. bindings = (*TBINDING)(unsafe.Pointer(bindings)).FnextTagBinding
  3163. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  3164. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = b
  3165. }
  3166. }
  3167. func XXML_ParserReset(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) (r TXML_Bool) {
  3168. var openEntity, openEntityList, tStk, tag uintptr
  3169. _, _, _, _ = openEntity, openEntityList, tStk, tag
  3170. if parser == libc.UintptrFromInt32(0) {
  3171. return libc.Uint8FromInt32(0)
  3172. }
  3173. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 {
  3174. return libc.Uint8FromInt32(0)
  3175. }
  3176. /* move m_tagStack to m_freeTagList */
  3177. tStk = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  3178. for tStk != 0 {
  3179. tag = tStk
  3180. tStk = (*TTAG)(unsafe.Pointer(tStk)).Fparent
  3181. (*TTAG)(unsafe.Pointer(tag)).Fparent = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  3182. _moveToFreeBindingList(tls, parser, (*TTAG)(unsafe.Pointer(tag)).Fbindings)
  3183. (*TTAG)(unsafe.Pointer(tag)).Fbindings = libc.UintptrFromInt32(0)
  3184. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = tag
  3185. }
  3186. /* move m_openInternalEntities to m_freeInternalEntities */
  3187. openEntityList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  3188. for openEntityList != 0 {
  3189. openEntity = openEntityList
  3190. openEntityList = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  3191. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  3192. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = openEntity
  3193. }
  3194. _moveToFreeBindingList(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_inheritedBindings)
  3195. (*(*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)
  3196. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease != 0 {
  3197. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData)
  3198. }
  3199. _poolClear(tls, parser+412)
  3200. _poolClear(tls, parser+436)
  3201. (*(*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)
  3202. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = libc.UintptrFromInt32(0)
  3203. _parserInit(tls, parser, encodingName)
  3204. _dtdReset(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd, parser+12)
  3205. return libc.Uint8FromInt32(1)
  3206. }
  3207. func XXML_SetEncoding(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) (r _XML_Status) {
  3208. if parser == libc.UintptrFromInt32(0) {
  3209. return int32(_XML_STATUS_ERROR)
  3210. }
  3211. /* Block after XML_Parse()/XML_ParseBuffer() has been called.
  3212. XXX There's no way for the caller to determine which of the
  3213. XXX possible error cases caused the XML_STATUS_ERROR return.
  3214. */
  3215. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3216. return int32(_XML_STATUS_ERROR)
  3217. }
  3218. /* Get rid of any previous encoding name */
  3219. (*(*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)
  3220. if encodingName == libc.UintptrFromInt32(0) {
  3221. /* No new encoding name */
  3222. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = libc.UintptrFromInt32(0)
  3223. } else {
  3224. /* Copy the new encoding name into allocated memory */
  3225. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = _copyString(tls, encodingName, parser+12)
  3226. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName != 0) {
  3227. return int32(_XML_STATUS_ERROR)
  3228. }
  3229. }
  3230. return int32(_XML_STATUS_OK)
  3231. }
  3232. func XXML_ExternalEntityParserCreate(tls *libc.TLS, oldParser TXML_Parser, context uintptr, encodingName uintptr) (r TXML_Parser) {
  3233. bp := tls.Alloc(16)
  3234. defer tls.Free(16)
  3235. var newDtd, oldDeclElementType, oldDtd, oldHandlerArg, oldUserData uintptr
  3236. var oldAttlistDeclHandler TXML_AttlistDeclHandler
  3237. var oldCharacterDataHandler TXML_CharacterDataHandler
  3238. var oldCommentHandler TXML_CommentHandler
  3239. var oldDefaultExpandInternalEntities, oldns_triplets TXML_Bool
  3240. var oldDefaultHandler TXML_DefaultHandler
  3241. var oldElementDeclHandler TXML_ElementDeclHandler
  3242. var oldEndCdataSectionHandler TXML_EndCdataSectionHandler
  3243. var oldEndElementHandler TXML_EndElementHandler
  3244. var oldEndNamespaceDeclHandler TXML_EndNamespaceDeclHandler
  3245. var oldEntityDeclHandler TXML_EntityDeclHandler
  3246. var oldExternalEntityRefHandler TXML_ExternalEntityRefHandler
  3247. var oldExternalEntityRefHandlerArg, parser TXML_Parser
  3248. var oldInEntityValue int32
  3249. var oldNotStandaloneHandler TXML_NotStandaloneHandler
  3250. var oldNotationDeclHandler TXML_NotationDeclHandler
  3251. var oldParamEntityParsing _XML_ParamEntityParsing
  3252. var oldProcessingInstructionHandler TXML_ProcessingInstructionHandler
  3253. var oldSkippedEntityHandler TXML_SkippedEntityHandler
  3254. var oldStartCdataSectionHandler TXML_StartCdataSectionHandler
  3255. var oldStartElementHandler TXML_StartElementHandler
  3256. var oldStartNamespaceDeclHandler TXML_StartNamespaceDeclHandler
  3257. var oldUnknownEncodingHandler TXML_UnknownEncodingHandler
  3258. var oldUnparsedEntityDeclHandler TXML_UnparsedEntityDeclHandler
  3259. var oldXmlDeclHandler TXML_XmlDeclHandler
  3260. var oldhash_secret_salt uint32
  3261. var _ /* tmp at bp+0 */ [2]TXML_Char
  3262. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  3263. parser = oldParser
  3264. newDtd = libc.UintptrFromInt32(0)
  3265. /* Validate the oldParser parameter before we pull everything out of it */
  3266. if oldParser == libc.UintptrFromInt32(0) {
  3267. return libc.UintptrFromInt32(0)
  3268. }
  3269. /* Stash the original parser contents on the stack */
  3270. oldDtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  3271. oldStartElementHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler
  3272. oldEndElementHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler
  3273. oldCharacterDataHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler
  3274. oldProcessingInstructionHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler
  3275. oldCommentHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler
  3276. oldStartCdataSectionHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler
  3277. oldEndCdataSectionHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler
  3278. oldDefaultHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler
  3279. oldUnparsedEntityDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler
  3280. oldNotationDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler
  3281. oldStartNamespaceDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler
  3282. oldEndNamespaceDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler
  3283. oldNotStandaloneHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler
  3284. oldExternalEntityRefHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler
  3285. oldSkippedEntityHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler
  3286. oldUnknownEncodingHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler
  3287. oldElementDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler
  3288. oldAttlistDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler
  3289. oldEntityDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler
  3290. oldXmlDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler
  3291. oldDeclElementType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType
  3292. oldUserData = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData
  3293. oldHandlerArg = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg
  3294. oldDefaultExpandInternalEntities = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities
  3295. oldExternalEntityRefHandlerArg = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg
  3296. oldParamEntityParsing = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing
  3297. oldInEntityValue = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue
  3298. oldns_triplets = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets
  3299. /* Note that the new parser shares the same hash secret as the old
  3300. parser, so that dtdCopy and copyEntityTable can lookup values
  3301. from hash tables associated with either parser without us having
  3302. to worry which hash secrets each table has.
  3303. */
  3304. oldhash_secret_salt = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt
  3305. if !(context != 0) {
  3306. newDtd = oldDtd
  3307. }
  3308. /* Note that the magical uses of the pre-processor to make field
  3309. access look more like C++ require that `parser' be overwritten
  3310. here. This makes this function more painful to follow than it
  3311. would be otherwise.
  3312. */
  3313. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  3314. *(*[2]TXML_Char)(unsafe.Pointer(bp)) = [2]TXML_Char{
  3315. 0: (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator,
  3316. }
  3317. parser = _parserCreate(tls, encodingName, parser+12, bp, newDtd)
  3318. } else {
  3319. parser = _parserCreate(tls, encodingName, parser+12, libc.UintptrFromInt32(0), newDtd)
  3320. }
  3321. if !(parser != 0) {
  3322. return libc.UintptrFromInt32(0)
  3323. }
  3324. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = oldStartElementHandler
  3325. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = oldEndElementHandler
  3326. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler = oldCharacterDataHandler
  3327. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler = oldProcessingInstructionHandler
  3328. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler = oldCommentHandler
  3329. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = oldStartCdataSectionHandler
  3330. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = oldEndCdataSectionHandler
  3331. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = oldDefaultHandler
  3332. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler = oldUnparsedEntityDeclHandler
  3333. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler = oldNotationDeclHandler
  3334. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = oldStartNamespaceDeclHandler
  3335. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = oldEndNamespaceDeclHandler
  3336. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler = oldNotStandaloneHandler
  3337. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler = oldExternalEntityRefHandler
  3338. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler = oldSkippedEntityHandler
  3339. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler = oldUnknownEncodingHandler
  3340. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler = oldElementDeclHandler
  3341. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler = oldAttlistDeclHandler
  3342. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler = oldEntityDeclHandler
  3343. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler = oldXmlDeclHandler
  3344. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = oldDeclElementType
  3345. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = oldUserData
  3346. if oldUserData == oldHandlerArg {
  3347. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData
  3348. } else {
  3349. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = parser
  3350. }
  3351. if oldExternalEntityRefHandlerArg != oldParser {
  3352. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg
  3353. }
  3354. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = oldDefaultExpandInternalEntities
  3355. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets = oldns_triplets
  3356. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = oldhash_secret_salt
  3357. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser = oldParser
  3358. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = oldParamEntityParsing
  3359. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue = oldInEntityValue
  3360. if context != 0 {
  3361. if !(_dtdCopy(tls, oldParser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd, oldDtd, parser+12) != 0) || !(_setContext(tls, parser, context) != 0) {
  3362. XXML_ParserFree(tls, parser)
  3363. return libc.UintptrFromInt32(0)
  3364. }
  3365. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityInitProcessor)
  3366. } else {
  3367. /* The DTD instance referenced by parser->m_dtd is shared between the
  3368. document's root parser and external PE parsers, therefore one does not
  3369. need to call setContext. In addition, one also *must* not call
  3370. setContext, because this would overwrite existing prefix->binding
  3371. pointers in parser->m_dtd with ones that get destroyed with the external
  3372. PE parser. This would leave those prefixes with dangling pointers.
  3373. */
  3374. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity = libc.Uint8FromInt32(1)
  3375. XXmlPrologStateInitExternalEntity(tls, parser+252)
  3376. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalParEntInitProcessor)
  3377. }
  3378. return parser
  3379. }
  3380. func _destroyBindings(tls *libc.TLS, bindings uintptr, parser TXML_Parser) {
  3381. var b uintptr
  3382. _ = b
  3383. for {
  3384. b = bindings
  3385. if !(b != 0) {
  3386. break
  3387. }
  3388. bindings = (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding
  3389. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TBINDING)(unsafe.Pointer(b)).Furi)
  3390. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, b)
  3391. goto _1
  3392. _1:
  3393. }
  3394. }
  3395. func XXML_ParserFree(tls *libc.TLS, parser TXML_Parser) {
  3396. var entityList, openEntity, p, tagList uintptr
  3397. _, _, _, _ = entityList, openEntity, p, tagList
  3398. if parser == libc.UintptrFromInt32(0) {
  3399. return
  3400. }
  3401. /* free m_tagStack and m_freeTagList */
  3402. tagList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  3403. for {
  3404. if tagList == libc.UintptrFromInt32(0) {
  3405. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList == libc.UintptrFromInt32(0) {
  3406. break
  3407. }
  3408. tagList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  3409. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = libc.UintptrFromInt32(0)
  3410. }
  3411. p = tagList
  3412. tagList = (*TTAG)(unsafe.Pointer(tagList)).Fparent
  3413. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TTAG)(unsafe.Pointer(p)).Fbuf)
  3414. _destroyBindings(tls, (*TTAG)(unsafe.Pointer(p)).Fbindings, parser)
  3415. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, p)
  3416. goto _1
  3417. _1:
  3418. }
  3419. /* free m_openInternalEntities and m_freeInternalEntities */
  3420. entityList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  3421. for {
  3422. if entityList == libc.UintptrFromInt32(0) {
  3423. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities == libc.UintptrFromInt32(0) {
  3424. break
  3425. }
  3426. entityList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  3427. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = libc.UintptrFromInt32(0)
  3428. }
  3429. openEntity = entityList
  3430. entityList = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(entityList)).Fnext
  3431. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, openEntity)
  3432. goto _2
  3433. _2:
  3434. }
  3435. _destroyBindings(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList, parser)
  3436. _destroyBindings(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_inheritedBindings, parser)
  3437. _poolDestroy(tls, parser+412)
  3438. _poolDestroy(tls, parser+436)
  3439. (*(*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)
  3440. /* external parameter entity parsers share the DTD structure
  3441. parser->m_dtd with the root parser, so we must not destroy it
  3442. */
  3443. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd != 0 {
  3444. _dtdDestroy(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd, libc.BoolUint8(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0)), parser+12)
  3445. }
  3446. (*(*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)
  3447. (*(*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)
  3448. (*(*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)
  3449. (*(*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)
  3450. (*(*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)
  3451. (*(*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)
  3452. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease != 0 {
  3453. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData)
  3454. }
  3455. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  3456. }
  3457. func XXML_UseParserAsHandlerArg(tls *libc.TLS, parser TXML_Parser) {
  3458. if parser != libc.UintptrFromInt32(0) {
  3459. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = parser
  3460. }
  3461. }
  3462. func XXML_UseForeignDTD(tls *libc.TLS, parser TXML_Parser, useDTD TXML_Bool) (r _XML_Error) {
  3463. if parser == libc.UintptrFromInt32(0) {
  3464. return int32(_XML_ERROR_INVALID_ARGUMENT)
  3465. }
  3466. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3467. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3468. return int32(_XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING)
  3469. }
  3470. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = useDTD
  3471. return int32(_XML_ERROR_NONE)
  3472. }
  3473. func XXML_SetReturnNSTriplet(tls *libc.TLS, parser TXML_Parser, do_nst int32) {
  3474. var v1 int32
  3475. _ = v1
  3476. if parser == libc.UintptrFromInt32(0) {
  3477. return
  3478. }
  3479. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3480. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3481. return
  3482. }
  3483. if do_nst != 0 {
  3484. v1 = libc.Int32FromUint8(libc.Uint8FromInt32(1))
  3485. } else {
  3486. v1 = libc.Int32FromUint8(libc.Uint8FromInt32(0))
  3487. }
  3488. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets = libc.Uint8FromInt32(v1)
  3489. }
  3490. func XXML_SetUserData(tls *libc.TLS, parser TXML_Parser, p uintptr) {
  3491. var v1 uintptr
  3492. _ = v1
  3493. if parser == libc.UintptrFromInt32(0) {
  3494. return
  3495. }
  3496. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData {
  3497. v1 = p
  3498. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = v1
  3499. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = v1
  3500. } else {
  3501. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = p
  3502. }
  3503. }
  3504. func XXML_SetBase(tls *libc.TLS, parser TXML_Parser, p uintptr) (r _XML_Status) {
  3505. if parser == libc.UintptrFromInt32(0) {
  3506. return int32(_XML_STATUS_ERROR)
  3507. }
  3508. if p != 0 {
  3509. p = _poolCopyString(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd+80, p)
  3510. if !(p != 0) {
  3511. return int32(_XML_STATUS_ERROR)
  3512. }
  3513. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase = p
  3514. } else {
  3515. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase = libc.UintptrFromInt32(0)
  3516. }
  3517. return int32(_XML_STATUS_OK)
  3518. }
  3519. func XXML_GetBase(tls *libc.TLS, parser TXML_Parser) (r uintptr) {
  3520. if parser == libc.UintptrFromInt32(0) {
  3521. return libc.UintptrFromInt32(0)
  3522. }
  3523. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  3524. }
  3525. func XXML_GetSpecifiedAttributeCount(tls *libc.TLS, parser TXML_Parser) (r int32) {
  3526. if parser == libc.UintptrFromInt32(0) {
  3527. return -int32(1)
  3528. }
  3529. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nSpecifiedAtts
  3530. }
  3531. func XXML_GetIdAttributeIndex(tls *libc.TLS, parser TXML_Parser) (r int32) {
  3532. if parser == libc.UintptrFromInt32(0) {
  3533. return -int32(1)
  3534. }
  3535. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_idAttIndex
  3536. }
  3537. func XXML_SetElementHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartElementHandler, end TXML_EndElementHandler) {
  3538. if parser == libc.UintptrFromInt32(0) {
  3539. return
  3540. }
  3541. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = start
  3542. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = end
  3543. }
  3544. func XXML_SetStartElementHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartElementHandler) {
  3545. if parser != libc.UintptrFromInt32(0) {
  3546. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = start
  3547. }
  3548. }
  3549. func XXML_SetEndElementHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndElementHandler) {
  3550. if parser != libc.UintptrFromInt32(0) {
  3551. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = end
  3552. }
  3553. }
  3554. func XXML_SetCharacterDataHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_CharacterDataHandler) {
  3555. if parser != libc.UintptrFromInt32(0) {
  3556. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler = handler
  3557. }
  3558. }
  3559. func XXML_SetProcessingInstructionHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_ProcessingInstructionHandler) {
  3560. if parser != libc.UintptrFromInt32(0) {
  3561. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler = handler
  3562. }
  3563. }
  3564. func XXML_SetCommentHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_CommentHandler) {
  3565. if parser != libc.UintptrFromInt32(0) {
  3566. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler = handler
  3567. }
  3568. }
  3569. func XXML_SetCdataSectionHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartCdataSectionHandler, end TXML_EndCdataSectionHandler) {
  3570. if parser == libc.UintptrFromInt32(0) {
  3571. return
  3572. }
  3573. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = start
  3574. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = end
  3575. }
  3576. func XXML_SetStartCdataSectionHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartCdataSectionHandler) {
  3577. if parser != libc.UintptrFromInt32(0) {
  3578. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = start
  3579. }
  3580. }
  3581. func XXML_SetEndCdataSectionHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndCdataSectionHandler) {
  3582. if parser != libc.UintptrFromInt32(0) {
  3583. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = end
  3584. }
  3585. }
  3586. func XXML_SetDefaultHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_DefaultHandler) {
  3587. if parser == libc.UintptrFromInt32(0) {
  3588. return
  3589. }
  3590. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = handler
  3591. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = libc.Uint8FromInt32(0)
  3592. }
  3593. func XXML_SetDefaultHandlerExpand(tls *libc.TLS, parser TXML_Parser, handler TXML_DefaultHandler) {
  3594. if parser == libc.UintptrFromInt32(0) {
  3595. return
  3596. }
  3597. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = handler
  3598. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = libc.Uint8FromInt32(1)
  3599. }
  3600. func XXML_SetDoctypeDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartDoctypeDeclHandler, end TXML_EndDoctypeDeclHandler) {
  3601. if parser == libc.UintptrFromInt32(0) {
  3602. return
  3603. }
  3604. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler = start
  3605. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler = end
  3606. }
  3607. func XXML_SetStartDoctypeDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartDoctypeDeclHandler) {
  3608. if parser != libc.UintptrFromInt32(0) {
  3609. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler = start
  3610. }
  3611. }
  3612. func XXML_SetEndDoctypeDeclHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndDoctypeDeclHandler) {
  3613. if parser != libc.UintptrFromInt32(0) {
  3614. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler = end
  3615. }
  3616. }
  3617. func XXML_SetUnparsedEntityDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_UnparsedEntityDeclHandler) {
  3618. if parser != libc.UintptrFromInt32(0) {
  3619. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler = handler
  3620. }
  3621. }
  3622. func XXML_SetNotationDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_NotationDeclHandler) {
  3623. if parser != libc.UintptrFromInt32(0) {
  3624. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler = handler
  3625. }
  3626. }
  3627. func XXML_SetNamespaceDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartNamespaceDeclHandler, end TXML_EndNamespaceDeclHandler) {
  3628. if parser == libc.UintptrFromInt32(0) {
  3629. return
  3630. }
  3631. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = start
  3632. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = end
  3633. }
  3634. func XXML_SetStartNamespaceDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartNamespaceDeclHandler) {
  3635. if parser != libc.UintptrFromInt32(0) {
  3636. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = start
  3637. }
  3638. }
  3639. func XXML_SetEndNamespaceDeclHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndNamespaceDeclHandler) {
  3640. if parser != libc.UintptrFromInt32(0) {
  3641. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = end
  3642. }
  3643. }
  3644. func XXML_SetNotStandaloneHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_NotStandaloneHandler) {
  3645. if parser != libc.UintptrFromInt32(0) {
  3646. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler = handler
  3647. }
  3648. }
  3649. func XXML_SetExternalEntityRefHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_ExternalEntityRefHandler) {
  3650. if parser != libc.UintptrFromInt32(0) {
  3651. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler = handler
  3652. }
  3653. }
  3654. func XXML_SetExternalEntityRefHandlerArg(tls *libc.TLS, parser TXML_Parser, arg uintptr) {
  3655. if parser == libc.UintptrFromInt32(0) {
  3656. return
  3657. }
  3658. if arg != 0 {
  3659. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = arg
  3660. } else {
  3661. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = parser
  3662. }
  3663. }
  3664. func XXML_SetSkippedEntityHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_SkippedEntityHandler) {
  3665. if parser != libc.UintptrFromInt32(0) {
  3666. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler = handler
  3667. }
  3668. }
  3669. func XXML_SetUnknownEncodingHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_UnknownEncodingHandler, data uintptr) {
  3670. if parser == libc.UintptrFromInt32(0) {
  3671. return
  3672. }
  3673. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler = handler
  3674. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandlerData = data
  3675. }
  3676. func XXML_SetElementDeclHandler(tls *libc.TLS, parser TXML_Parser, eldecl TXML_ElementDeclHandler) {
  3677. if parser != libc.UintptrFromInt32(0) {
  3678. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler = eldecl
  3679. }
  3680. }
  3681. func XXML_SetAttlistDeclHandler(tls *libc.TLS, parser TXML_Parser, attdecl TXML_AttlistDeclHandler) {
  3682. if parser != libc.UintptrFromInt32(0) {
  3683. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler = attdecl
  3684. }
  3685. }
  3686. func XXML_SetEntityDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_EntityDeclHandler) {
  3687. if parser != libc.UintptrFromInt32(0) {
  3688. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler = handler
  3689. }
  3690. }
  3691. func XXML_SetXmlDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_XmlDeclHandler) {
  3692. if parser != libc.UintptrFromInt32(0) {
  3693. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler = handler
  3694. }
  3695. }
  3696. func XXML_SetParamEntityParsing(tls *libc.TLS, parser TXML_Parser, peParsing _XML_ParamEntityParsing) (r int32) {
  3697. if parser == libc.UintptrFromInt32(0) {
  3698. return 0
  3699. }
  3700. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3701. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3702. return 0
  3703. }
  3704. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = peParsing
  3705. return int32(1)
  3706. }
  3707. func XXML_SetHashSalt(tls *libc.TLS, parser TXML_Parser, hash_salt uint32) (r int32) {
  3708. if parser == libc.UintptrFromInt32(0) {
  3709. return 0
  3710. }
  3711. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 {
  3712. return XXML_SetHashSalt(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser, hash_salt)
  3713. }
  3714. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3715. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3716. return 0
  3717. }
  3718. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = hash_salt
  3719. return int32(1)
  3720. }
  3721. func XXML_Parse(tls *libc.TLS, parser TXML_Parser, s uintptr, len1 int32, isFinal int32) (r _XML_Status) {
  3722. var buff uintptr
  3723. _ = buff
  3724. if parser == libc.UintptrFromInt32(0) || len1 < 0 || s == libc.UintptrFromInt32(0) && len1 != 0 {
  3725. if parser != libc.UintptrFromInt32(0) {
  3726. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_INVALID_ARGUMENT)
  3727. }
  3728. return int32(_XML_STATUS_ERROR)
  3729. }
  3730. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3731. case int32(_XML_SUSPENDED):
  3732. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3733. return int32(_XML_STATUS_ERROR)
  3734. case int32(_XML_FINISHED):
  3735. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3736. return int32(_XML_STATUS_ERROR)
  3737. case int32(_XML_INITIALIZED):
  3738. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser == libc.UintptrFromInt32(0) && !(_startParsing(tls, parser) != 0) {
  3739. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3740. return int32(_XML_STATUS_ERROR)
  3741. }
  3742. /* fall through */
  3743. fallthrough
  3744. default:
  3745. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_PARSING)
  3746. }
  3747. if len1 == 0 {
  3748. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer = libc.Uint8FromInt32(isFinal)
  3749. if !(isFinal != 0) {
  3750. return int32(_XML_STATUS_OK)
  3751. }
  3752. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3753. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd
  3754. /* If data are left over from last buffer, and we now know that these
  3755. data are the final chunk of input, then we have to check them again
  3756. to detect errors based on that fact.
  3757. */
  3758. (*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+24)
  3759. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode == int32(_XML_ERROR_NONE) {
  3760. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3761. case int32(_XML_SUSPENDED):
  3762. /* It is hard to be certain, but it seems that this case
  3763. * cannot occur. This code is cleaning up a previous parse
  3764. * with no new data (since len == 0). Changing the parsing
  3765. * state requires getting to execute a handler function, and
  3766. * there doesn't seem to be an opportunity for that while in
  3767. * this circumstance.
  3768. *
  3769. * Given the uncertainty, we retain the code but exclude it
  3770. * from coverage tests.
  3771. *
  3772. * LCOV_EXCL_START
  3773. */
  3774. (*(*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+404)
  3775. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3776. return int32(_XML_STATUS_SUSPENDED)
  3777. /* LCOV_EXCL_STOP */
  3778. fallthrough
  3779. case int32(_XML_INITIALIZED):
  3780. fallthrough
  3781. case int32(_XML_PARSING):
  3782. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3783. /* fall through */
  3784. fallthrough
  3785. default:
  3786. return int32(_XML_STATUS_OK)
  3787. }
  3788. }
  3789. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  3790. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_errorProcessor)
  3791. return int32(_XML_STATUS_ERROR)
  3792. } else {
  3793. buff = XXML_GetBuffer(tls, parser, len1)
  3794. if buff == libc.UintptrFromInt32(0) {
  3795. return int32(_XML_STATUS_ERROR)
  3796. } else {
  3797. libc.Xmemcpy(tls, buff, s, libc.Uint32FromInt32(len1))
  3798. return XXML_ParseBuffer(tls, parser, len1, isFinal)
  3799. }
  3800. }
  3801. return r
  3802. }
  3803. func XXML_ParseBuffer(tls *libc.TLS, parser TXML_Parser, len1 int32, isFinal int32) (r _XML_Status) {
  3804. var result _XML_Status
  3805. var start uintptr
  3806. _, _ = result, start
  3807. result = int32(_XML_STATUS_OK)
  3808. if parser == libc.UintptrFromInt32(0) {
  3809. return int32(_XML_STATUS_ERROR)
  3810. }
  3811. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3812. case int32(_XML_SUSPENDED):
  3813. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3814. return int32(_XML_STATUS_ERROR)
  3815. case int32(_XML_FINISHED):
  3816. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3817. return int32(_XML_STATUS_ERROR)
  3818. case int32(_XML_INITIALIZED):
  3819. /* Has someone called XML_GetBuffer successfully before? */
  3820. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0) {
  3821. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_BUFFER)
  3822. return int32(_XML_STATUS_ERROR)
  3823. }
  3824. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser == libc.UintptrFromInt32(0) && !(_startParsing(tls, parser) != 0) {
  3825. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3826. return int32(_XML_STATUS_ERROR)
  3827. }
  3828. /* fall through */
  3829. fallthrough
  3830. default:
  3831. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_PARSING)
  3832. }
  3833. start = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3834. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = start
  3835. *(*uintptr)(unsafe.Pointer(parser + 28)) += uintptr(len1)
  3836. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd
  3837. *(*TXML_Index)(unsafe.Pointer(parser + 36)) += len1
  3838. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer = libc.Uint8FromInt32(isFinal)
  3839. (*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+24)
  3840. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode != int32(_XML_ERROR_NONE) {
  3841. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  3842. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_errorProcessor)
  3843. return int32(_XML_STATUS_ERROR)
  3844. } else {
  3845. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3846. case int32(_XML_SUSPENDED):
  3847. result = int32(_XML_STATUS_SUSPENDED)
  3848. case int32(_XML_INITIALIZED):
  3849. fallthrough
  3850. case int32(_XML_PARSING):
  3851. if isFinal != 0 {
  3852. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3853. return result
  3854. }
  3855. fallthrough
  3856. default: /* should not happen */
  3857. }
  3858. }
  3859. (*(*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+404)
  3860. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3861. return result
  3862. }
  3863. func XXML_GetBuffer(tls *libc.TLS, parser TXML_Parser, len1 int32) (r uintptr) {
  3864. var bufferSize, keep, neededSize, offset, v1, v2, v3, v4, v5, v6, v7, v8, v9 int32
  3865. var newBuf, v10, v11 uintptr
  3866. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bufferSize, keep, neededSize, newBuf, offset, v1, v10, v11, v2, v3, v4, v5, v6, v7, v8, v9
  3867. if parser == libc.UintptrFromInt32(0) {
  3868. return libc.UintptrFromInt32(0)
  3869. }
  3870. if len1 < 0 {
  3871. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3872. return libc.UintptrFromInt32(0)
  3873. }
  3874. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3875. case int32(_XML_SUSPENDED):
  3876. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3877. return libc.UintptrFromInt32(0)
  3878. case int32(_XML_FINISHED):
  3879. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3880. return libc.UintptrFromInt32(0)
  3881. default:
  3882. }
  3883. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 {
  3884. v1 = int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim) - int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd)
  3885. } else {
  3886. v1 = 0
  3887. }
  3888. if len1 > v1 {
  3889. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3890. v2 = int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3891. } else {
  3892. v2 = 0
  3893. }
  3894. /* Do not invoke signed arithmetic overflow: */
  3895. neededSize = libc.Int32FromUint32(libc.Uint32FromInt32(len1) + libc.Uint32FromInt32(v2))
  3896. if neededSize < 0 {
  3897. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3898. return libc.UintptrFromInt32(0)
  3899. }
  3900. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3901. v3 = int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr) - int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3902. } else {
  3903. v3 = 0
  3904. }
  3905. keep = v3
  3906. if keep > int32(m_XML_CONTEXT_BYTES) {
  3907. keep = int32(m_XML_CONTEXT_BYTES)
  3908. }
  3909. /* Detect and prevent integer overflow */
  3910. if keep > int32(m_INT_MAX)-neededSize {
  3911. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3912. return libc.UintptrFromInt32(0)
  3913. }
  3914. neededSize += keep
  3915. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3916. v4 = int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim) - int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3917. } else {
  3918. v4 = 0
  3919. }
  3920. if neededSize <= v4 {
  3921. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3922. v5 = int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr) - int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3923. } else {
  3924. v5 = 0
  3925. }
  3926. if keep < v5 {
  3927. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3928. v6 = int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr) - int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3929. } else {
  3930. v6 = 0
  3931. }
  3932. offset = v6 - keep
  3933. /* The buffer pointers cannot be NULL here; we have at least some bytes
  3934. * in the buffer */
  3935. libc.Xmemmove(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer+uintptr(offset), libc.Uint32FromInt32(int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd)-int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)+keep))
  3936. *(*uintptr)(unsafe.Pointer(parser + 28)) -= uintptr(offset)
  3937. *(*uintptr)(unsafe.Pointer(parser + 24)) -= uintptr(offset)
  3938. }
  3939. } else {
  3940. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3941. v7 = int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim) - int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3942. } else {
  3943. v7 = 0
  3944. }
  3945. bufferSize = v7
  3946. if bufferSize == 0 {
  3947. bufferSize = int32(m_INIT_BUFFER_SIZE)
  3948. }
  3949. for cond := true; cond; cond = bufferSize < neededSize && bufferSize > 0 {
  3950. /* Do not invoke signed arithmetic overflow: */
  3951. bufferSize = libc.Int32FromUint32(libc.Uint32FromUint32(2) * libc.Uint32FromInt32(bufferSize))
  3952. }
  3953. if bufferSize <= 0 {
  3954. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3955. return libc.UintptrFromInt32(0)
  3956. }
  3957. newBuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint32FromInt32(bufferSize))
  3958. if newBuf == uintptr(0) {
  3959. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3960. return libc.UintptrFromInt32(0)
  3961. }
  3962. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim = newBuf + uintptr(bufferSize)
  3963. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3964. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3965. v8 = int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3966. } else {
  3967. v8 = 0
  3968. }
  3969. libc.Xmemcpy(tls, newBuf, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr+uintptr(-keep), libc.Uint32FromInt32(v8+keep))
  3970. (*(*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)
  3971. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer = newBuf
  3972. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3973. v9 = int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3974. } else {
  3975. v9 = 0
  3976. }
  3977. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer + uintptr(v9) + uintptr(keep)
  3978. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer + uintptr(keep)
  3979. } else {
  3980. /* This must be a brand new buffer with no data in it yet */
  3981. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd = newBuf
  3982. v10 = newBuf
  3983. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer = v10
  3984. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr = v10
  3985. }
  3986. }
  3987. v11 = libc.UintptrFromInt32(0)
  3988. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = v11
  3989. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = v11
  3990. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = libc.UintptrFromInt32(0)
  3991. }
  3992. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd
  3993. }
  3994. func XXML_StopParser(tls *libc.TLS, parser TXML_Parser, resumable TXML_Bool) (r _XML_Status) {
  3995. if parser == libc.UintptrFromInt32(0) {
  3996. return int32(_XML_STATUS_ERROR)
  3997. }
  3998. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3999. case int32(_XML_SUSPENDED):
  4000. if resumable != 0 {
  4001. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  4002. return int32(_XML_STATUS_ERROR)
  4003. }
  4004. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  4005. case int32(_XML_FINISHED):
  4006. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  4007. return int32(_XML_STATUS_ERROR)
  4008. default:
  4009. if resumable != 0 {
  4010. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0 {
  4011. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPEND_PE)
  4012. return int32(_XML_STATUS_ERROR)
  4013. }
  4014. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_SUSPENDED)
  4015. } else {
  4016. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  4017. }
  4018. }
  4019. return int32(_XML_STATUS_OK)
  4020. }
  4021. func XXML_ResumeParser(tls *libc.TLS, parser TXML_Parser) (r _XML_Status) {
  4022. var result _XML_Status
  4023. _ = result
  4024. result = int32(_XML_STATUS_OK)
  4025. if parser == libc.UintptrFromInt32(0) {
  4026. return int32(_XML_STATUS_ERROR)
  4027. }
  4028. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing != int32(_XML_SUSPENDED) {
  4029. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NOT_SUSPENDED)
  4030. return int32(_XML_STATUS_ERROR)
  4031. }
  4032. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_PARSING)
  4033. (*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+24)
  4034. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode != int32(_XML_ERROR_NONE) {
  4035. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  4036. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_errorProcessor)
  4037. return int32(_XML_STATUS_ERROR)
  4038. } else {
  4039. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  4040. case int32(_XML_SUSPENDED):
  4041. result = int32(_XML_STATUS_SUSPENDED)
  4042. case int32(_XML_INITIALIZED):
  4043. fallthrough
  4044. case int32(_XML_PARSING):
  4045. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0 {
  4046. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  4047. return result
  4048. }
  4049. fallthrough
  4050. default:
  4051. }
  4052. }
  4053. (*(*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+404)
  4054. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  4055. return result
  4056. }
  4057. func XXML_GetParsingStatus(tls *libc.TLS, parser TXML_Parser, status uintptr) {
  4058. if parser == libc.UintptrFromInt32(0) {
  4059. return
  4060. }
  4061. *(*TXML_ParsingStatus)(unsafe.Pointer(status)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus
  4062. }
  4063. func XXML_GetErrorCode(tls *libc.TLS, parser TXML_Parser) (r _XML_Error) {
  4064. if parser == libc.UintptrFromInt32(0) {
  4065. return int32(_XML_ERROR_INVALID_ARGUMENT)
  4066. }
  4067. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode
  4068. }
  4069. func XXML_GetCurrentByteIndex(tls *libc.TLS, parser TXML_Parser) (r TXML_Index) {
  4070. if parser == libc.UintptrFromInt32(0) {
  4071. return -int32(1)
  4072. }
  4073. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 {
  4074. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndByteIndex - (int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr) - int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr))
  4075. }
  4076. return -int32(1)
  4077. }
  4078. func XXML_GetCurrentByteCount(tls *libc.TLS, parser TXML_Parser) (r int32) {
  4079. if parser == libc.UintptrFromInt32(0) {
  4080. return 0
  4081. }
  4082. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 {
  4083. return int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr) - int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr)
  4084. }
  4085. return 0
  4086. }
  4087. func XXML_GetInputContext(tls *libc.TLS, parser TXML_Parser, offset uintptr, size uintptr) (r uintptr) {
  4088. if parser == libc.UintptrFromInt32(0) {
  4089. return libc.UintptrFromInt32(0)
  4090. }
  4091. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  4092. if offset != libc.UintptrFromInt32(0) {
  4093. *(*int32)(unsafe.Pointer(offset)) = int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr) - int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  4094. }
  4095. if size != libc.UintptrFromInt32(0) {
  4096. *(*int32)(unsafe.Pointer(size)) = int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  4097. }
  4098. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer
  4099. }
  4100. return libc.UintptrFromInt32(0)
  4101. }
  4102. func XXML_GetCurrentLineNumber(tls *libc.TLS, parser TXML_Parser) (r TXML_Size) {
  4103. if parser == libc.UintptrFromInt32(0) {
  4104. return uint32(0)
  4105. }
  4106. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr >= (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr {
  4107. (*(*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+404)
  4108. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  4109. }
  4110. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_position.FlineNumber + uint32(1)
  4111. }
  4112. func XXML_GetCurrentColumnNumber(tls *libc.TLS, parser TXML_Parser) (r TXML_Size) {
  4113. if parser == libc.UintptrFromInt32(0) {
  4114. return uint32(0)
  4115. }
  4116. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr >= (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr {
  4117. (*(*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+404)
  4118. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  4119. }
  4120. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_position.FcolumnNumber
  4121. }
  4122. func XXML_FreeContentModel(tls *libc.TLS, parser TXML_Parser, model uintptr) {
  4123. if parser != libc.UintptrFromInt32(0) {
  4124. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, model)
  4125. }
  4126. }
  4127. func XXML_MemMalloc(tls *libc.TLS, parser TXML_Parser, size Tsize_t) (r uintptr) {
  4128. if parser == libc.UintptrFromInt32(0) {
  4129. return libc.UintptrFromInt32(0)
  4130. }
  4131. return (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, size)
  4132. }
  4133. func XXML_MemRealloc(tls *libc.TLS, parser TXML_Parser, ptr uintptr, size Tsize_t) (r uintptr) {
  4134. if parser == libc.UintptrFromInt32(0) {
  4135. return libc.UintptrFromInt32(0)
  4136. }
  4137. return (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, ptr, size)
  4138. }
  4139. func XXML_MemFree(tls *libc.TLS, parser TXML_Parser, ptr uintptr) {
  4140. if parser != libc.UintptrFromInt32(0) {
  4141. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, ptr)
  4142. }
  4143. }
  4144. func XXML_DefaultCurrent(tls *libc.TLS, parser TXML_Parser) {
  4145. if parser == libc.UintptrFromInt32(0) {
  4146. return
  4147. }
  4148. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4149. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0 {
  4150. _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)
  4151. } else {
  4152. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr)
  4153. }
  4154. }
  4155. }
  4156. func XXML_ErrorString(tls *libc.TLS, code _XML_Error) (r uintptr) {
  4157. switch code {
  4158. case int32(_XML_ERROR_NONE):
  4159. return libc.UintptrFromInt32(0)
  4160. case int32(_XML_ERROR_NO_MEMORY):
  4161. return __ccgo_ts + 138
  4162. case int32(_XML_ERROR_SYNTAX):
  4163. return __ccgo_ts + 152
  4164. case int32(_XML_ERROR_NO_ELEMENTS):
  4165. return __ccgo_ts + 165
  4166. case int32(_XML_ERROR_INVALID_TOKEN):
  4167. return __ccgo_ts + 182
  4168. case int32(_XML_ERROR_UNCLOSED_TOKEN):
  4169. return __ccgo_ts + 214
  4170. case int32(_XML_ERROR_PARTIAL_CHAR):
  4171. return __ccgo_ts + 229
  4172. case int32(_XML_ERROR_TAG_MISMATCH):
  4173. return __ccgo_ts + 247
  4174. case int32(_XML_ERROR_DUPLICATE_ATTRIBUTE):
  4175. return __ccgo_ts + 262
  4176. case int32(_XML_ERROR_JUNK_AFTER_DOC_ELEMENT):
  4177. return __ccgo_ts + 282
  4178. case int32(_XML_ERROR_PARAM_ENTITY_REF):
  4179. return __ccgo_ts + 310
  4180. case int32(_XML_ERROR_UNDEFINED_ENTITY):
  4181. return __ccgo_ts + 345
  4182. case int32(_XML_ERROR_RECURSIVE_ENTITY_REF):
  4183. return __ccgo_ts + 362
  4184. case int32(_XML_ERROR_ASYNC_ENTITY):
  4185. return __ccgo_ts + 389
  4186. case int32(_XML_ERROR_BAD_CHAR_REF):
  4187. return __ccgo_ts + 409
  4188. case int32(_XML_ERROR_BINARY_ENTITY_REF):
  4189. return __ccgo_ts + 447
  4190. case int32(_XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF):
  4191. return __ccgo_ts + 474
  4192. case int32(_XML_ERROR_MISPLACED_XML_PI):
  4193. return __ccgo_ts + 516
  4194. case int32(_XML_ERROR_UNKNOWN_ENCODING):
  4195. return __ccgo_ts + 563
  4196. case int32(_XML_ERROR_INCORRECT_ENCODING):
  4197. return __ccgo_ts + 580
  4198. case int32(_XML_ERROR_UNCLOSED_CDATA_SECTION):
  4199. return __ccgo_ts + 631
  4200. case int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING):
  4201. return __ccgo_ts + 654
  4202. case int32(_XML_ERROR_NOT_STANDALONE):
  4203. return __ccgo_ts + 700
  4204. case int32(_XML_ERROR_UNEXPECTED_STATE):
  4205. return __ccgo_ts + 727
  4206. case int32(_XML_ERROR_ENTITY_DECLARED_IN_PE):
  4207. return __ccgo_ts + 778
  4208. case int32(_XML_ERROR_FEATURE_REQUIRES_XML_DTD):
  4209. return __ccgo_ts + 814
  4210. case int32(_XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING):
  4211. return __ccgo_ts + 866
  4212. /* Added in 1.95.7. */
  4213. fallthrough
  4214. case int32(_XML_ERROR_UNBOUND_PREFIX):
  4215. return __ccgo_ts + 911
  4216. /* Added in 1.95.8. */
  4217. fallthrough
  4218. case int32(_XML_ERROR_UNDECLARING_PREFIX):
  4219. return __ccgo_ts + 926
  4220. case int32(_XML_ERROR_INCOMPLETE_PE):
  4221. return __ccgo_ts + 952
  4222. case int32(_XML_ERROR_XML_DECL):
  4223. return __ccgo_ts + 990
  4224. case int32(_XML_ERROR_TEXT_DECL):
  4225. return __ccgo_ts + 1022
  4226. case int32(_XML_ERROR_PUBLICID):
  4227. return __ccgo_ts + 1055
  4228. case int32(_XML_ERROR_SUSPENDED):
  4229. return __ccgo_ts + 1089
  4230. case int32(_XML_ERROR_NOT_SUSPENDED):
  4231. return __ccgo_ts + 1106
  4232. case int32(_XML_ERROR_ABORTED):
  4233. return __ccgo_ts + 1127
  4234. case int32(_XML_ERROR_FINISHED):
  4235. return __ccgo_ts + 1143
  4236. case int32(_XML_ERROR_SUSPEND_PE):
  4237. return __ccgo_ts + 1160
  4238. /* Added in 2.0.0. */
  4239. fallthrough
  4240. case int32(_XML_ERROR_RESERVED_PREFIX_XML):
  4241. return __ccgo_ts + 1204
  4242. case int32(_XML_ERROR_RESERVED_PREFIX_XMLNS):
  4243. return __ccgo_ts + 1284
  4244. case int32(_XML_ERROR_RESERVED_NAMESPACE_URI):
  4245. return __ccgo_ts + 1343
  4246. /* Added in 2.2.5. */
  4247. fallthrough
  4248. case int32(_XML_ERROR_INVALID_ARGUMENT): /* Constant added in 2.2.1, already */
  4249. return __ccgo_ts + 1407
  4250. /* Added in 2.3.0. */
  4251. fallthrough
  4252. case int32(_XML_ERROR_NO_BUFFER):
  4253. return __ccgo_ts + 1424
  4254. /* Added in 2.4.0. */
  4255. fallthrough
  4256. case int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH):
  4257. return __ccgo_ts + 1486
  4258. }
  4259. return libc.UintptrFromInt32(0)
  4260. }
  4261. func XXML_ExpatVersion(tls *libc.TLS) (r uintptr) {
  4262. /* V1 is used to string-ize the version number. However, it would
  4263. string-ize the actual version macro *names* unless we get them
  4264. substituted before being passed to V1. CPP is defined to expand
  4265. a macro, then rescan for more expansions. Thus, we use V2 to expand
  4266. the version macros, then CPP will expand the resulting V1() macro
  4267. with the correct numerals. */
  4268. /* ### I'm assuming cpp is portable in this respect... */
  4269. return __ccgo_ts + 1555
  4270. }
  4271. func XXML_ExpatVersionInfo(tls *libc.TLS) (r TXML_Expat_Version) {
  4272. var version TXML_Expat_Version
  4273. _ = version
  4274. version.Fmajor = int32(m_XML_MAJOR_VERSION)
  4275. version.Fminor = int32(m_XML_MINOR_VERSION)
  4276. version.Fmicro = m_XML_MICRO_VERSION
  4277. return version
  4278. }
  4279. func XXML_GetFeatureList(tls *libc.TLS) (r uintptr) {
  4280. return uintptr(unsafe.Pointer(&_features))
  4281. }
  4282. var _features = [8]TXML_Feature{
  4283. 0: {
  4284. Ffeature: int32(_XML_FEATURE_SIZEOF_XML_CHAR),
  4285. Fname: __ccgo_ts + 1567,
  4286. Fvalue: int32(1),
  4287. },
  4288. 1: {
  4289. Ffeature: int32(_XML_FEATURE_SIZEOF_XML_LCHAR),
  4290. Fname: __ccgo_ts + 1584,
  4291. Fvalue: int32(1),
  4292. },
  4293. 2: {
  4294. Ffeature: int32(_XML_FEATURE_DTD),
  4295. Fname: __ccgo_ts + 1602,
  4296. },
  4297. 3: {
  4298. Ffeature: int32(_XML_FEATURE_CONTEXT_BYTES),
  4299. Fname: __ccgo_ts + 1610,
  4300. Fvalue: int32(m_XML_CONTEXT_BYTES),
  4301. },
  4302. 4: {
  4303. Ffeature: int32(_XML_FEATURE_NS),
  4304. Fname: __ccgo_ts + 1628,
  4305. },
  4306. 5: {
  4307. Ffeature: int32(_XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT),
  4308. Fname: __ccgo_ts + 1635,
  4309. Fvalue: libc.Int32FromFloat32(100),
  4310. },
  4311. 6: {
  4312. Ffeature: int32(_XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT),
  4313. Fname: __ccgo_ts + 1652,
  4314. Fvalue: int32(m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT),
  4315. },
  4316. 7: {},
  4317. }
  4318. func XXML_SetBillionLaughsAttackProtectionMaximumAmplification(tls *libc.TLS, parser TXML_Parser, maximumAmplificationFactor float32) (r TXML_Bool) {
  4319. bp := tls.Alloc(16)
  4320. defer tls.Free(16)
  4321. var v1 uint32
  4322. var v3 bool
  4323. var _ /* __u at bp+0 */ struct {
  4324. F__i [0]uint32
  4325. F__f float32
  4326. }
  4327. _, _ = v1, v3
  4328. if v3 = parser == libc.UintptrFromInt32(0) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != libc.UintptrFromInt32(0); !v3 {
  4329. *(*float32)(unsafe.Pointer(bp)) = maximumAmplificationFactor
  4330. v1 = *(*uint32)(unsafe.Pointer(bp))
  4331. goto _2
  4332. _2:
  4333. }
  4334. if v3 || libc.BoolInt32(v1&uint32(0x7fffffff) > uint32(0x7f800000)) != 0 || maximumAmplificationFactor < libc.Float32FromFloat32(1) {
  4335. return libc.Uint8FromInt32(0)
  4336. }
  4337. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FmaximumAmplificationFactor = maximumAmplificationFactor
  4338. return libc.Uint8FromInt32(1)
  4339. }
  4340. func XXML_SetBillionLaughsAttackProtectionActivationThreshold(tls *libc.TLS, parser TXML_Parser, activationThresholdBytes uint64) (r TXML_Bool) {
  4341. if parser == libc.UintptrFromInt32(0) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != libc.UintptrFromInt32(0) {
  4342. return libc.Uint8FromInt32(0)
  4343. }
  4344. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FactivationThresholdBytes = activationThresholdBytes
  4345. return libc.Uint8FromInt32(1)
  4346. }
  4347. // C documentation
  4348. //
  4349. // /* Initially tag->rawName always points into the parse buffer;
  4350. // for those TAG instances opened while the current parse buffer was
  4351. // processed, and not yet closed, we need to store tag->rawName in a more
  4352. // permanent location, since the parse buffer is about to be discarded.
  4353. // */
  4354. func _storeRawNames(tls *libc.TLS, parser TXML_Parser) (r TXML_Bool) {
  4355. var bufSize, nameLen int32
  4356. var rawNameBuf, tag, temp uintptr
  4357. var rawNameLen Tsize_t
  4358. _, _, _, _, _, _ = bufSize, nameLen, rawNameBuf, rawNameLen, tag, temp
  4359. tag = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  4360. for tag != 0 {
  4361. nameLen = libc.Int32FromUint32(uint32(1) * libc.Uint32FromInt32((*TTAG)(unsafe.Pointer(tag)).Fname.FstrLen+libc.Int32FromInt32(1)))
  4362. rawNameBuf = (*TTAG)(unsafe.Pointer(tag)).Fbuf + uintptr(nameLen)
  4363. /* Stop if already stored. Since m_tagStack is a stack, we can stop
  4364. at the first entry that has already been copied; everything
  4365. below it in the stack is already been accounted for in a
  4366. previous call to this function.
  4367. */
  4368. if (*TTAG)(unsafe.Pointer(tag)).FrawName == rawNameBuf {
  4369. break
  4370. }
  4371. /* For re-use purposes we need to ensure that the
  4372. size of tag->buf is a multiple of sizeof(XML_Char).
  4373. */
  4374. rawNameLen = (libc.Uint32FromInt32((*TTAG)(unsafe.Pointer(tag)).FrawNameLength) + (libc.Uint32FromInt64(1) - libc.Uint32FromInt32(1))) & ^(libc.Uint32FromInt64(1) - libc.Uint32FromInt32(1))
  4375. /* Detect and prevent integer overflow. */
  4376. if rawNameLen > libc.Uint32FromInt32(m_INT_MAX)-libc.Uint32FromInt32(nameLen) {
  4377. return libc.Uint8FromInt32(0)
  4378. }
  4379. bufSize = nameLen + libc.Int32FromUint32(rawNameLen)
  4380. if bufSize > int32((*TTAG)(unsafe.Pointer(tag)).FbufEnd)-int32((*TTAG)(unsafe.Pointer(tag)).Fbuf) {
  4381. 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.Uint32FromInt32(bufSize))
  4382. if temp == libc.UintptrFromInt32(0) {
  4383. return libc.Uint8FromInt32(0)
  4384. }
  4385. /* if tag->name.str points to tag->buf (only when namespace
  4386. processing is off) then we have to update it
  4387. */
  4388. if (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr == (*TTAG)(unsafe.Pointer(tag)).Fbuf {
  4389. (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr = temp
  4390. }
  4391. /* if tag->name.localPart is set (when namespace processing is on)
  4392. then update it as well, since it will always point into tag->buf
  4393. */
  4394. if (*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart != 0 {
  4395. (*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart = temp + uintptr(int32((*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart)-int32((*TTAG)(unsafe.Pointer(tag)).Fbuf))
  4396. }
  4397. (*TTAG)(unsafe.Pointer(tag)).Fbuf = temp
  4398. (*TTAG)(unsafe.Pointer(tag)).FbufEnd = temp + uintptr(bufSize)
  4399. rawNameBuf = temp + uintptr(nameLen)
  4400. }
  4401. libc.Xmemcpy(tls, rawNameBuf, (*TTAG)(unsafe.Pointer(tag)).FrawName, libc.Uint32FromInt32((*TTAG)(unsafe.Pointer(tag)).FrawNameLength))
  4402. (*TTAG)(unsafe.Pointer(tag)).FrawName = rawNameBuf
  4403. tag = (*TTAG)(unsafe.Pointer(tag)).Fparent
  4404. }
  4405. return libc.Uint8FromInt32(1)
  4406. }
  4407. func _contentProcessor(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4408. var result _XML_Error
  4409. _ = result
  4410. 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))
  4411. if result == int32(_XML_ERROR_NONE) {
  4412. if !(_storeRawNames(tls, parser) != 0) {
  4413. return int32(_XML_ERROR_NO_MEMORY)
  4414. }
  4415. }
  4416. return result
  4417. }
  4418. func _externalEntityInitProcessor(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4419. var result _XML_Error
  4420. _ = result
  4421. result = _initializeEncoding(tls, parser)
  4422. if result != int32(_XML_ERROR_NONE) {
  4423. return result
  4424. }
  4425. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityInitProcessor2)
  4426. return _externalEntityInitProcessor2(tls, parser, start, end, endPtr)
  4427. }
  4428. func _externalEntityInitProcessor2(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4429. bp := tls.Alloc(16)
  4430. defer tls.Free(16)
  4431. var tok int32
  4432. var _ /* next at bp+0 */ uintptr
  4433. _ = tok
  4434. *(*uintptr)(unsafe.Pointer(bp)) = start /* XmlContentTok doesn't always set the last arg */
  4435. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding + 1*4))})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, start, end, bp)
  4436. switch tok {
  4437. case int32(m_XML_TOK_BOM):
  4438. if !(_accountingDiffTolerated(tls, parser, tok, start, *(*uintptr)(unsafe.Pointer(bp)), int32(2649), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  4439. _accountingOnAbort(tls, parser)
  4440. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  4441. }
  4442. /* If we are at the end of the buffer, this would cause the next stage,
  4443. i.e. externalEntityInitProcessor3, to pass control directly to
  4444. doContent (by detecting XML_TOK_NONE) without processing any xml text
  4445. declaration - causing the error XML_ERROR_MISPLACED_XML_PI in doContent.
  4446. */
  4447. if *(*uintptr)(unsafe.Pointer(bp)) == end && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4448. *(*uintptr)(unsafe.Pointer(endPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4449. return int32(_XML_ERROR_NONE)
  4450. }
  4451. start = *(*uintptr)(unsafe.Pointer(bp))
  4452. case -int32(1):
  4453. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4454. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4455. return int32(_XML_ERROR_NONE)
  4456. }
  4457. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  4458. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  4459. case -int32(2):
  4460. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4461. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4462. return int32(_XML_ERROR_NONE)
  4463. }
  4464. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  4465. return int32(_XML_ERROR_PARTIAL_CHAR)
  4466. }
  4467. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityInitProcessor3)
  4468. return _externalEntityInitProcessor3(tls, parser, start, end, endPtr)
  4469. }
  4470. func _externalEntityInitProcessor3(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4471. bp := tls.Alloc(16)
  4472. defer tls.Free(16)
  4473. var result _XML_Error
  4474. var tok int32
  4475. var _ /* next at bp+0 */ uintptr
  4476. _, _ = result, tok
  4477. *(*uintptr)(unsafe.Pointer(bp)) = start /* XmlContentTok doesn't always set the last arg */
  4478. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  4479. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding + 1*4))})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, start, end, bp)
  4480. /* Note: These bytes are accounted later in:
  4481. - processXmlDecl
  4482. - externalEntityContentProcessor
  4483. */
  4484. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = *(*uintptr)(unsafe.Pointer(bp))
  4485. switch tok {
  4486. case int32(m_XML_TOK_XML_DECL):
  4487. result = _processXmlDecl(tls, parser, int32(1), start, *(*uintptr)(unsafe.Pointer(bp)))
  4488. if result != int32(_XML_ERROR_NONE) {
  4489. return result
  4490. }
  4491. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  4492. case int32(_XML_SUSPENDED):
  4493. *(*uintptr)(unsafe.Pointer(endPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4494. return int32(_XML_ERROR_NONE)
  4495. case int32(_XML_FINISHED):
  4496. return int32(_XML_ERROR_ABORTED)
  4497. default:
  4498. start = *(*uintptr)(unsafe.Pointer(bp))
  4499. }
  4500. case -int32(1):
  4501. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4502. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4503. return int32(_XML_ERROR_NONE)
  4504. }
  4505. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  4506. case -int32(2):
  4507. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4508. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4509. return int32(_XML_ERROR_NONE)
  4510. }
  4511. return int32(_XML_ERROR_PARTIAL_CHAR)
  4512. }
  4513. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityContentProcessor)
  4514. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel = int32(1)
  4515. return _externalEntityContentProcessor(tls, parser, start, end, endPtr)
  4516. }
  4517. func _externalEntityContentProcessor(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4518. var result _XML_Error
  4519. _ = result
  4520. 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))
  4521. if result == int32(_XML_ERROR_NONE) {
  4522. if !(_storeRawNames(tls, parser) != 0) {
  4523. return int32(_XML_ERROR_NO_MEMORY)
  4524. }
  4525. }
  4526. return result
  4527. }
  4528. 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) {
  4529. bp := tls.Alloc(64)
  4530. defer tls.Free(64)
  4531. *(*uintptr)(unsafe.Pointer(bp)) = _s
  4532. 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
  4533. var bufSize, convLen, len1, n, tok int32
  4534. var charDataHandler TXML_CharacterDataHandler
  4535. var convert_res, convert_res1 _XML_Convert_Result
  4536. var noElmHandlers TXML_Bool
  4537. var result, result1, result2, result3 _XML_Error
  4538. var _ /* bindings at bp+20 */ uintptr
  4539. var _ /* buf at bp+48 */ [4]TXML_Char
  4540. var _ /* c at bp+52 */ TXML_Char
  4541. var _ /* c at bp+8 */ TXML_Char
  4542. var _ /* ch at bp+9 */ TXML_Char
  4543. var _ /* dataPtr at bp+56 */ uintptr
  4544. var _ /* dataPtr at bp+60 */ uintptr
  4545. var _ /* fromPtr at bp+16 */ uintptr
  4546. var _ /* name at bp+24 */ TTAG_NAME
  4547. var _ /* next at bp+4 */ uintptr
  4548. var _ /* toPtr at bp+12 */ uintptr
  4549. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  4550. /* save one level of indirection */
  4551. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  4552. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  4553. eventPP = parser + 284
  4554. eventEndPP = parser + 288
  4555. } else {
  4556. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  4557. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 4
  4558. }
  4559. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  4560. for {
  4561. *(*uintptr)(unsafe.Pointer(bp + 4)) = *(*uintptr)(unsafe.Pointer(bp)) /* XmlContentTok doesn't always set the last arg */
  4562. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 1*4))})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+4)
  4563. if tok == -int32(5) || tok == -int32(3) {
  4564. if haveMore != 0 {
  4565. v3 = *(*uintptr)(unsafe.Pointer(bp))
  4566. } else {
  4567. v3 = end
  4568. }
  4569. v2 = v3
  4570. } else {
  4571. v2 = *(*uintptr)(unsafe.Pointer(bp + 4))
  4572. }
  4573. accountAfter = v2
  4574. if !(_accountingDiffTolerated(tls, parser, tok, *(*uintptr)(unsafe.Pointer(bp)), accountAfter, int32(2773), account) != 0) {
  4575. _accountingOnAbort(tls, parser)
  4576. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  4577. }
  4578. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp + 4))
  4579. switch tok {
  4580. case -int32(3):
  4581. if haveMore != 0 {
  4582. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4583. return int32(_XML_ERROR_NONE)
  4584. }
  4585. *(*uintptr)(unsafe.Pointer(eventEndPP)) = end
  4586. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4587. *(*TXML_Char)(unsafe.Pointer(bp + 8)) = uint8(0xA)
  4588. (*(*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+8, int32(1))
  4589. } else {
  4590. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4591. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), end)
  4592. }
  4593. }
  4594. /* We are at the end of the final buffer, should we check for
  4595. XML_SUSPENDED, XML_FINISHED?
  4596. */
  4597. if startTagLevel == 0 {
  4598. return int32(_XML_ERROR_NO_ELEMENTS)
  4599. }
  4600. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel != startTagLevel {
  4601. return int32(_XML_ERROR_ASYNC_ENTITY)
  4602. }
  4603. *(*uintptr)(unsafe.Pointer(nextPtr)) = end
  4604. return int32(_XML_ERROR_NONE)
  4605. case -int32(4):
  4606. if haveMore != 0 {
  4607. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4608. return int32(_XML_ERROR_NONE)
  4609. }
  4610. if startTagLevel > 0 {
  4611. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel != startTagLevel {
  4612. return int32(_XML_ERROR_ASYNC_ENTITY)
  4613. }
  4614. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4615. return int32(_XML_ERROR_NONE)
  4616. }
  4617. return int32(_XML_ERROR_NO_ELEMENTS)
  4618. case m_XML_TOK_INVALID:
  4619. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp + 4))
  4620. return int32(_XML_ERROR_INVALID_TOKEN)
  4621. case -int32(1):
  4622. if haveMore != 0 {
  4623. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4624. return int32(_XML_ERROR_NONE)
  4625. }
  4626. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  4627. case -int32(2):
  4628. if haveMore != 0 {
  4629. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4630. return int32(_XML_ERROR_NONE)
  4631. }
  4632. return int32(_XML_ERROR_PARTIAL_CHAR)
  4633. case int32(m_XML_TOK_ENTITY_REF):
  4634. *(*TXML_Char)(unsafe.Pointer(bp + 9)) = libc.Uint8FromInt32((*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FpredefinedEntityName})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp + 4))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)))
  4635. if *(*TXML_Char)(unsafe.Pointer(bp + 9)) != 0 {
  4636. /* NOTE: We are replacing 4-6 characters original input for 1 character
  4637. * so there is no amplification and hence recording without
  4638. * protection. */
  4639. _accountingDiffTolerated(tls, parser, tok, bp+9, bp+9+uintptr(1), int32(2839), int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  4640. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4641. (*(*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+9, int32(1))
  4642. } else {
  4643. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4644. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))
  4645. }
  4646. }
  4647. break
  4648. }
  4649. name = _poolStoreString(tls, dtd+80, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp + 4))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  4650. if !(name != 0) {
  4651. return int32(_XML_ERROR_NO_MEMORY)
  4652. }
  4653. entity = _lookup(tls, parser, dtd, name, uint32(0))
  4654. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart
  4655. /* First, determine if a check for an existing declaration is needed;
  4656. if yes, check that the entity exists, and that it is internal,
  4657. otherwise call the skipped entity or default handler.
  4658. */
  4659. if !((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0) || (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0 {
  4660. if !(entity != 0) {
  4661. return int32(_XML_ERROR_UNDEFINED_ENTITY)
  4662. } else {
  4663. if !((*TENTITY)(unsafe.Pointer(entity)).Fis_internal != 0) {
  4664. return int32(_XML_ERROR_ENTITY_DECLARED_IN_PE)
  4665. }
  4666. }
  4667. } else {
  4668. if !(entity != 0) {
  4669. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler != 0 {
  4670. (*(*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)
  4671. } else {
  4672. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4673. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))
  4674. }
  4675. }
  4676. break
  4677. }
  4678. }
  4679. if (*TENTITY)(unsafe.Pointer(entity)).Fopen != 0 {
  4680. return int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  4681. }
  4682. if (*TENTITY)(unsafe.Pointer(entity)).Fnotation != 0 {
  4683. return int32(_XML_ERROR_BINARY_ENTITY_REF)
  4684. }
  4685. if (*TENTITY)(unsafe.Pointer(entity)).FtextPtr != 0 {
  4686. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities != 0) {
  4687. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler != 0 {
  4688. (*(*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)
  4689. } else {
  4690. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4691. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))
  4692. }
  4693. }
  4694. break
  4695. }
  4696. result = _processInternalEntity(tls, parser, entity, libc.Uint8FromInt32(0))
  4697. if result != int32(_XML_ERROR_NONE) {
  4698. return result
  4699. }
  4700. } else {
  4701. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  4702. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  4703. context = _getContext(tls, parser)
  4704. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  4705. if !(context != 0) {
  4706. return int32(_XML_ERROR_NO_MEMORY)
  4707. }
  4708. 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) {
  4709. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  4710. }
  4711. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart
  4712. } else {
  4713. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4714. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))
  4715. }
  4716. }
  4717. }
  4718. case int32(m_XML_TOK_START_TAG_NO_ATTS):
  4719. /* fall through */
  4720. fallthrough
  4721. case int32(m_XML_TOK_START_TAG_WITH_ATTS):
  4722. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList != 0 {
  4723. tag = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  4724. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = (*TTAG)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList)).Fparent
  4725. } else {
  4726. tag = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint32FromInt64(48))
  4727. if !(tag != 0) {
  4728. return int32(_XML_ERROR_NO_MEMORY)
  4729. }
  4730. (*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.Uint32FromInt32(libc.Int32FromInt32(m_INIT_TAG_BUF_SIZE)))
  4731. if !((*TTAG)(unsafe.Pointer(tag)).Fbuf != 0) {
  4732. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, tag)
  4733. return int32(_XML_ERROR_NO_MEMORY)
  4734. }
  4735. (*TTAG)(unsafe.Pointer(tag)).FbufEnd = (*TTAG)(unsafe.Pointer(tag)).Fbuf + uintptr(m_INIT_TAG_BUF_SIZE)
  4736. }
  4737. (*TTAG)(unsafe.Pointer(tag)).Fbindings = libc.UintptrFromInt32(0)
  4738. (*TTAG)(unsafe.Pointer(tag)).Fparent = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  4739. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack = tag
  4740. (*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart = libc.UintptrFromInt32(0)
  4741. (*TTAG)(unsafe.Pointer(tag)).Fname.Fprefix = libc.UintptrFromInt32(0)
  4742. (*TTAG)(unsafe.Pointer(tag)).FrawName = *(*uintptr)(unsafe.Pointer(bp)) + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  4743. (*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)
  4744. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel++
  4745. rawNameEnd = (*TTAG)(unsafe.Pointer(tag)).FrawName + uintptr((*TTAG)(unsafe.Pointer(tag)).FrawNameLength)
  4746. *(*uintptr)(unsafe.Pointer(bp + 16)) = (*TTAG)(unsafe.Pointer(tag)).FrawName
  4747. *(*uintptr)(unsafe.Pointer(bp + 12)) = (*TTAG)(unsafe.Pointer(tag)).Fbuf
  4748. for {
  4749. 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+16, rawNameEnd, bp+12, (*TTAG)(unsafe.Pointer(tag)).FbufEnd-uintptr(1))
  4750. convLen = int32(*(*uintptr)(unsafe.Pointer(bp + 12))) - int32((*TTAG)(unsafe.Pointer(tag)).Fbuf)
  4751. if *(*uintptr)(unsafe.Pointer(bp + 16)) >= rawNameEnd || convert_res == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  4752. (*TTAG)(unsafe.Pointer(tag)).Fname.FstrLen = convLen
  4753. break
  4754. }
  4755. bufSize = (int32((*TTAG)(unsafe.Pointer(tag)).FbufEnd) - int32((*TTAG)(unsafe.Pointer(tag)).Fbuf)) << int32(1)
  4756. 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.Uint32FromInt32(bufSize))
  4757. if temp == libc.UintptrFromInt32(0) {
  4758. return int32(_XML_ERROR_NO_MEMORY)
  4759. }
  4760. (*TTAG)(unsafe.Pointer(tag)).Fbuf = temp
  4761. (*TTAG)(unsafe.Pointer(tag)).FbufEnd = temp + uintptr(bufSize)
  4762. *(*uintptr)(unsafe.Pointer(bp + 12)) = temp + uintptr(convLen)
  4763. goto _4
  4764. _4:
  4765. }
  4766. (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr = (*TTAG)(unsafe.Pointer(tag)).Fbuf
  4767. *(*TXML_Char)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 12)))) = uint8('\000')
  4768. result1 = _storeAtts(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), tag+12, tag+44, account)
  4769. if result1 != 0 {
  4770. return result1
  4771. }
  4772. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler != 0 {
  4773. (*(*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)
  4774. } else {
  4775. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4776. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))
  4777. }
  4778. }
  4779. _poolClear(tls, parser+412)
  4780. case int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS):
  4781. /* fall through */
  4782. fallthrough
  4783. case int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS):
  4784. rawName = *(*uintptr)(unsafe.Pointer(bp)) + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  4785. *(*uintptr)(unsafe.Pointer(bp + 20)) = libc.UintptrFromInt32(0)
  4786. noElmHandlers = libc.Uint8FromInt32(1)
  4787. (*(*TTAG_NAME)(unsafe.Pointer(bp + 24))).Fstr = _poolStoreString(tls, parser+412, enc, rawName, rawName+uintptr((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameLength})))(tls, enc, rawName)))
  4788. if !((*(*TTAG_NAME)(unsafe.Pointer(bp + 24))).Fstr != 0) {
  4789. return int32(_XML_ERROR_NO_MEMORY)
  4790. }
  4791. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr
  4792. result2 = _storeAtts(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), bp+24, bp+20, int32(_XML_ACCOUNT_NONE))
  4793. if result2 != int32(_XML_ERROR_NONE) {
  4794. _freeBindings(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 20)))
  4795. return result2
  4796. }
  4797. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr
  4798. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler != 0 {
  4799. (*(*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 + 24))).Fstr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts)
  4800. noElmHandlers = libc.Uint8FromInt32(0)
  4801. }
  4802. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler != 0 {
  4803. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler != 0 {
  4804. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(eventEndPP))
  4805. }
  4806. (*(*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 + 24))).Fstr)
  4807. noElmHandlers = libc.Uint8FromInt32(0)
  4808. }
  4809. if noElmHandlers != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4810. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))
  4811. }
  4812. _poolClear(tls, parser+412)
  4813. _freeBindings(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 20)))
  4814. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel == 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing != int32(_XML_FINISHED) {
  4815. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  4816. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_epilogProcessor)
  4817. } else {
  4818. return _epilogProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 4)), end, nextPtr)
  4819. }
  4820. }
  4821. case int32(m_XML_TOK_END_TAG):
  4822. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel == startTagLevel {
  4823. return int32(_XML_ERROR_ASYNC_ENTITY)
  4824. } else {
  4825. tag1 = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  4826. rawName1 = *(*uintptr)(unsafe.Pointer(bp)) + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(2))
  4827. len1 = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameLength})))(tls, enc, rawName1)
  4828. if len1 != (*TTAG)(unsafe.Pointer(tag1)).FrawNameLength || libc.Xmemcmp(tls, (*TTAG)(unsafe.Pointer(tag1)).FrawName, rawName1, libc.Uint32FromInt32(len1)) != 0 {
  4829. *(*uintptr)(unsafe.Pointer(eventPP)) = rawName1
  4830. return int32(_XML_ERROR_TAG_MISMATCH)
  4831. }
  4832. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack = (*TTAG)(unsafe.Pointer(tag1)).Fparent
  4833. (*TTAG)(unsafe.Pointer(tag1)).Fparent = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  4834. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = tag1
  4835. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel--
  4836. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler != 0 {
  4837. localPart = (*TTAG)(unsafe.Pointer(tag1)).Fname.FlocalPart
  4838. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 && localPart != 0 {
  4839. /* localPart and prefix may have been overwritten in
  4840. tag->name.str, since this points to the binding->uri
  4841. buffer which gets re-used; so we have to add them again
  4842. */
  4843. uri = (*TTAG)(unsafe.Pointer(tag1)).Fname.Fstr + uintptr((*TTAG)(unsafe.Pointer(tag1)).Fname.FuriLen)
  4844. /* don't need to check for space - already done in storeAtts() */
  4845. for *(*TXML_Char)(unsafe.Pointer(localPart)) != 0 {
  4846. v5 = uri
  4847. uri++
  4848. v6 = localPart
  4849. localPart++
  4850. *(*TXML_Char)(unsafe.Pointer(v5)) = *(*TXML_Char)(unsafe.Pointer(v6))
  4851. }
  4852. prefix = (*TTAG)(unsafe.Pointer(tag1)).Fname.Fprefix
  4853. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets != 0 && prefix != 0 {
  4854. v7 = uri
  4855. uri++
  4856. *(*TXML_Char)(unsafe.Pointer(v7)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  4857. for *(*TXML_Char)(unsafe.Pointer(prefix)) != 0 {
  4858. v8 = uri
  4859. uri++
  4860. v9 = prefix
  4861. prefix++
  4862. *(*TXML_Char)(unsafe.Pointer(v8)) = *(*TXML_Char)(unsafe.Pointer(v9))
  4863. }
  4864. }
  4865. *(*TXML_Char)(unsafe.Pointer(uri)) = uint8('\000')
  4866. }
  4867. (*(*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)
  4868. } else {
  4869. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4870. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))
  4871. }
  4872. }
  4873. for (*TTAG)(unsafe.Pointer(tag1)).Fbindings != 0 {
  4874. b = (*TTAG)(unsafe.Pointer(tag1)).Fbindings
  4875. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler != 0 {
  4876. (*(*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)
  4877. }
  4878. (*TTAG)(unsafe.Pointer(tag1)).Fbindings = (*TBINDING)(unsafe.Pointer((*TTAG)(unsafe.Pointer(tag1)).Fbindings)).FnextTagBinding
  4879. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  4880. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = b
  4881. (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fbinding = (*TBINDING)(unsafe.Pointer(b)).FprevPrefixBinding
  4882. }
  4883. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel == 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing != int32(_XML_FINISHED) {
  4884. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  4885. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_epilogProcessor)
  4886. } else {
  4887. return _epilogProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 4)), end, nextPtr)
  4888. }
  4889. }
  4890. }
  4891. case int32(m_XML_TOK_CHAR_REF):
  4892. n = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FcharRefNumber})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp)))
  4893. if n < 0 {
  4894. return int32(_XML_ERROR_BAD_CHAR_REF)
  4895. }
  4896. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4897. (*(*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+48, XXmlUtf8Encode(tls, n, bp+48))
  4898. } else {
  4899. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4900. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))
  4901. }
  4902. }
  4903. case int32(m_XML_TOK_XML_DECL):
  4904. return int32(_XML_ERROR_MISPLACED_XML_PI)
  4905. case int32(m_XML_TOK_DATA_NEWLINE):
  4906. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4907. *(*TXML_Char)(unsafe.Pointer(bp + 52)) = uint8(0xA)
  4908. (*(*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+52, int32(1))
  4909. } else {
  4910. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4911. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))
  4912. }
  4913. }
  4914. case int32(m_XML_TOK_CDATA_SECT_OPEN):
  4915. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler != 0 {
  4916. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg)
  4917. } else {
  4918. if libc.Bool(0 != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4919. (*(*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)
  4920. } else {
  4921. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4922. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))
  4923. }
  4924. }
  4925. }
  4926. result3 = _doCdataSection(tls, parser, enc, bp+4, end, nextPtr, haveMore, account)
  4927. if result3 != int32(_XML_ERROR_NONE) {
  4928. return result3
  4929. } else {
  4930. if !(*(*uintptr)(unsafe.Pointer(bp + 4)) != 0) {
  4931. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_cdataSectionProcessor)
  4932. return result3
  4933. }
  4934. }
  4935. case -int32(5):
  4936. if haveMore != 0 {
  4937. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4938. return int32(_XML_ERROR_NONE)
  4939. }
  4940. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4941. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  4942. *(*uintptr)(unsafe.Pointer(bp + 56)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  4943. (*(*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+56, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd)
  4944. (*(*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(*(*uintptr)(unsafe.Pointer(bp + 56)))-int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf))
  4945. } else {
  4946. (*(*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(end)-int32(*(*uintptr)(unsafe.Pointer(bp))))
  4947. }
  4948. } else {
  4949. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4950. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), end)
  4951. }
  4952. }
  4953. /* We are at the end of the final buffer, should we check for
  4954. XML_SUSPENDED, XML_FINISHED?
  4955. */
  4956. if startTagLevel == 0 {
  4957. *(*uintptr)(unsafe.Pointer(eventPP)) = end
  4958. return int32(_XML_ERROR_NO_ELEMENTS)
  4959. }
  4960. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel != startTagLevel {
  4961. *(*uintptr)(unsafe.Pointer(eventPP)) = end
  4962. return int32(_XML_ERROR_ASYNC_ENTITY)
  4963. }
  4964. *(*uintptr)(unsafe.Pointer(nextPtr)) = end
  4965. return int32(_XML_ERROR_NONE)
  4966. case int32(m_XML_TOK_DATA_CHARS):
  4967. charDataHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler
  4968. if charDataHandler != 0 {
  4969. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  4970. for {
  4971. *(*uintptr)(unsafe.Pointer(bp + 60)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  4972. 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 + 4)), bp+60, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd)
  4973. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  4974. (*(*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(*(*uintptr)(unsafe.Pointer(bp + 60)))-int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf))
  4975. if convert_res1 == int32(_XML_CONVERT_COMPLETED) || convert_res1 == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  4976. break
  4977. }
  4978. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  4979. goto _10
  4980. _10:
  4981. }
  4982. } else {
  4983. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{charDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, *(*uintptr)(unsafe.Pointer(bp)), int32(*(*uintptr)(unsafe.Pointer(bp + 4)))-int32(*(*uintptr)(unsafe.Pointer(bp))))
  4984. }
  4985. } else {
  4986. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4987. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))
  4988. }
  4989. }
  4990. case int32(m_XML_TOK_PI):
  4991. if !(_reportProcessingInstruction(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4))) != 0) {
  4992. return int32(_XML_ERROR_NO_MEMORY)
  4993. }
  4994. case int32(m_XML_TOK_COMMENT):
  4995. if !(_reportComment(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4))) != 0) {
  4996. return int32(_XML_ERROR_NO_MEMORY)
  4997. }
  4998. default:
  4999. /* All of the tokens produced by XmlContentTok() have their own
  5000. * explicit cases, so this default is not strictly necessary.
  5001. * However it is a useful safety net, so we retain the code and
  5002. * simply exclude it from the coverage tests.
  5003. *
  5004. * LCOV_EXCL_START
  5005. */
  5006. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  5007. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))
  5008. }
  5009. break
  5010. /* LCOV_EXCL_STOP */
  5011. }
  5012. v11 = *(*uintptr)(unsafe.Pointer(bp + 4))
  5013. *(*uintptr)(unsafe.Pointer(bp)) = v11
  5014. *(*uintptr)(unsafe.Pointer(eventPP)) = v11
  5015. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  5016. case int32(_XML_SUSPENDED):
  5017. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp + 4))
  5018. return int32(_XML_ERROR_NONE)
  5019. case int32(_XML_FINISHED):
  5020. return int32(_XML_ERROR_ABORTED)
  5021. default:
  5022. }
  5023. goto _1
  5024. _1:
  5025. }
  5026. /* not reached */
  5027. return r
  5028. }
  5029. // C documentation
  5030. //
  5031. // /* This function does not call free() on the allocated memory, merely
  5032. // * moving it to the parser's m_freeBindingList where it can be freed or
  5033. // * reused as appropriate.
  5034. // */
  5035. func _freeBindings(tls *libc.TLS, parser TXML_Parser, bindings uintptr) {
  5036. var b uintptr
  5037. _ = b
  5038. for bindings != 0 {
  5039. b = bindings
  5040. /* m_startNamespaceDeclHandler will have been called for this
  5041. * binding in addBindings(), so call the end handler now.
  5042. */
  5043. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler != 0 {
  5044. (*(*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)
  5045. }
  5046. bindings = (*TBINDING)(unsafe.Pointer(bindings)).FnextTagBinding
  5047. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  5048. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = b
  5049. (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fbinding = (*TBINDING)(unsafe.Pointer(b)).FprevPrefixBinding
  5050. }
  5051. }
  5052. // C documentation
  5053. //
  5054. // /* Precondition: all arguments must be non-NULL;
  5055. // Purpose:
  5056. // - normalize attributes
  5057. // - check attributes for well-formedness
  5058. // - generate namespace aware attribute names (URI, prefix)
  5059. // - build list of attributes for startElementHandler
  5060. // - default attributes
  5061. // - process namespace declarations (check and report them)
  5062. // - generate namespace aware element name (URI, prefix)
  5063. // */
  5064. func _storeAtts(tls *libc.TLS, parser TXML_Parser, enc uintptr, attStr uintptr, tagNamePtr uintptr, bindingsPtr uintptr, account _XML_Account) (r _XML_Error) {
  5065. bp := tls.Alloc(80)
  5066. defer tls.Free(80)
  5067. 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
  5068. var attIndex, i, j, j1, n, nDefaultAtts, nPrefixes, oldAttsSize, prefixLen, v13, v17, v2, v23, v30, v33, v38, v40, v6, v7, v8, v9 int32
  5069. var c TXML_Char
  5070. var isCdata TXML_Bool
  5071. var mask, nsAttsSize, uriHash, version, v14 uint32
  5072. var oldNsAttsPower, step, v10 uint8
  5073. var result, result1, result2 _XML_Error
  5074. var _ /* sip_key at bp+56 */ Tsipkey
  5075. var _ /* sip_state at bp+0 */ Tsiphash
  5076. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  5077. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* the attribute list for the application */
  5078. attIndex = 0
  5079. nPrefixes = 0
  5080. /* lookup the element type name */
  5081. elementType = _lookup(tls, parser, dtd+20, (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr, uint32(0))
  5082. if !(elementType != 0) {
  5083. name = _poolCopyString(tls, dtd+80, (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr)
  5084. if !(name != 0) {
  5085. return int32(_XML_ERROR_NO_MEMORY)
  5086. }
  5087. elementType = _lookup(tls, parser, dtd+20, name, uint32(24))
  5088. if !(elementType != 0) {
  5089. return int32(_XML_ERROR_NO_MEMORY)
  5090. }
  5091. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 && !(_setElementTypePrefix(tls, parser, elementType) != 0) {
  5092. return int32(_XML_ERROR_NO_MEMORY)
  5093. }
  5094. }
  5095. nDefaultAtts = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FnDefaultAtts
  5096. /* get the attributes from the tokenizer */
  5097. 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)
  5098. /* Detect and prevent integer overflow */
  5099. if n > int32(m_INT_MAX)-nDefaultAtts {
  5100. return int32(_XML_ERROR_NO_MEMORY)
  5101. }
  5102. if n+nDefaultAtts > (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize {
  5103. oldAttsSize = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize
  5104. /* Detect and prevent integer overflow */
  5105. if nDefaultAtts > libc.Int32FromInt32(m_INT_MAX)-libc.Int32FromInt32(m_INIT_ATTS_SIZE) || n > int32(m_INT_MAX)-(nDefaultAtts+int32(m_INIT_ATTS_SIZE)) {
  5106. return int32(_XML_ERROR_NO_MEMORY)
  5107. }
  5108. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = n + nDefaultAtts + int32(m_INIT_ATTS_SIZE)
  5109. /* Detect and prevent integer overflow.
  5110. * The preprocessor guard addresses the "always false" warning
  5111. * from -Wtype-limits on platforms where
  5112. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5113. if libc.Uint32FromInt32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize) > libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromInt64(16) {
  5114. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = oldAttsSize
  5115. return int32(_XML_ERROR_NO_MEMORY)
  5116. }
  5117. 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.Uint32FromInt32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize)*libc.Uint32FromInt64(16))
  5118. if temp == libc.UintptrFromInt32(0) {
  5119. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = oldAttsSize
  5120. return int32(_XML_ERROR_NO_MEMORY)
  5121. }
  5122. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts = temp
  5123. if n > oldAttsSize {
  5124. (*(*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)
  5125. }
  5126. }
  5127. appAtts = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts
  5128. i = 0
  5129. for {
  5130. if !(i < n) {
  5131. break
  5132. }
  5133. currAtt = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*16
  5134. /* add the name and value to the attribute list */
  5135. 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)))
  5136. if !(attId != 0) {
  5137. return int32(_XML_ERROR_NO_MEMORY)
  5138. }
  5139. /* Detect duplicate attributes by their QNames. This does not work when
  5140. namespace processing is turned on and different prefixes for the same
  5141. namespace are used. For this case we have a check further down.
  5142. */
  5143. if *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname + uintptr(-libc.Int32FromInt32(1)))) != 0 {
  5144. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  5145. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*16))).Fname
  5146. }
  5147. return int32(_XML_ERROR_DUPLICATE_ATTRIBUTE)
  5148. }
  5149. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname + uintptr(-libc.Int32FromInt32(1)))) = uint8(1)
  5150. v2 = attIndex
  5151. attIndex++
  5152. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v2)*4)) = (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname
  5153. if !((*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*16))).Fnormalized != 0) {
  5154. isCdata = libc.Uint8FromInt32(1)
  5155. /* figure out whether declared as other than CDATA */
  5156. if (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).FmaybeTokenized != 0 {
  5157. j = 0
  5158. for {
  5159. if !(j < nDefaultAtts) {
  5160. break
  5161. }
  5162. if attId == (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FdefaultAtts + uintptr(j)*12))).Fid {
  5163. isCdata = (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FdefaultAtts + uintptr(j)*12))).FisCdata
  5164. break
  5165. }
  5166. goto _3
  5167. _3:
  5168. ;
  5169. j++
  5170. }
  5171. }
  5172. /* normalize the attribute value */
  5173. result = _storeAttributeValue(tls, parser, enc, isCdata, (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*16))).FvaluePtr, (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*16))).FvalueEnd, parser+412, account)
  5174. if result != 0 {
  5175. return result
  5176. }
  5177. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*4)) = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart
  5178. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr
  5179. } else {
  5180. /* the value did not need normalizing */
  5181. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*4)) = _poolStoreString(tls, parser+412, enc, (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*16))).FvaluePtr, (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*16))).FvalueEnd)
  5182. if *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*4)) == uintptr(0) {
  5183. return int32(_XML_ERROR_NO_MEMORY)
  5184. }
  5185. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr
  5186. }
  5187. /* handle prefixed attribute names */
  5188. if (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fprefix != 0 {
  5189. if (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fxmlns != 0 {
  5190. /* deal with namespace declarations here */
  5191. result1 = _addBinding(tls, parser, (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fprefix, attId, *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*4)), bindingsPtr)
  5192. if result1 != 0 {
  5193. return result1
  5194. }
  5195. attIndex--
  5196. } else {
  5197. /* deal with other prefixed names later */
  5198. attIndex++
  5199. nPrefixes++
  5200. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname + uintptr(-libc.Int32FromInt32(1)))) = uint8(2)
  5201. }
  5202. } else {
  5203. attIndex++
  5204. }
  5205. goto _1
  5206. _1:
  5207. ;
  5208. i++
  5209. }
  5210. /* set-up for XML_GetSpecifiedAttributeCount and XML_GetIdAttributeIndex */
  5211. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nSpecifiedAtts = attIndex
  5212. 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 {
  5213. i = 0
  5214. for {
  5215. if !(i < attIndex) {
  5216. break
  5217. }
  5218. if *(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*4)) == (*TATTRIBUTE_ID)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FidAtt)).Fname {
  5219. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_idAttIndex = i
  5220. break
  5221. }
  5222. goto _4
  5223. _4:
  5224. ;
  5225. i += int32(2)
  5226. }
  5227. } else {
  5228. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_idAttIndex = -int32(1)
  5229. }
  5230. /* do attribute defaulting */
  5231. i = 0
  5232. for {
  5233. if !(i < nDefaultAtts) {
  5234. break
  5235. }
  5236. da = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FdefaultAtts + uintptr(i)*12
  5237. 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 {
  5238. if (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fprefix != 0 {
  5239. if (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fxmlns != 0 {
  5240. 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)
  5241. if result2 != 0 {
  5242. return result2
  5243. }
  5244. } else {
  5245. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname + uintptr(-libc.Int32FromInt32(1)))) = uint8(2)
  5246. nPrefixes++
  5247. v6 = attIndex
  5248. attIndex++
  5249. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v6)*4)) = (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname
  5250. v7 = attIndex
  5251. attIndex++
  5252. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v7)*4)) = (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fvalue
  5253. }
  5254. } else {
  5255. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname + uintptr(-libc.Int32FromInt32(1)))) = uint8(1)
  5256. v8 = attIndex
  5257. attIndex++
  5258. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v8)*4)) = (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname
  5259. v9 = attIndex
  5260. attIndex++
  5261. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v9)*4)) = (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fvalue
  5262. }
  5263. }
  5264. goto _5
  5265. _5:
  5266. ;
  5267. i++
  5268. }
  5269. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*4)) = uintptr(0)
  5270. /* expand prefixed attribute names, check for duplicates,
  5271. and clear flags that say whether attributes were specified */
  5272. i = 0
  5273. if nPrefixes != 0 { /* hash table index */
  5274. version = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsVersion
  5275. /* Detect and prevent invalid shift */
  5276. if uint32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower) >= libc.Uint32FromInt64(4)*libc.Uint32FromInt32(8) {
  5277. return int32(_XML_ERROR_NO_MEMORY)
  5278. }
  5279. nsAttsSize = uint32(1) << (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower
  5280. oldNsAttsPower = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower
  5281. /* size of hash table must be at least 2 * (# of prefixed attributes) */
  5282. if nPrefixes<<int32(1)>>(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower != 0 {
  5283. /* hash table size must also be a power of 2 and >= 8 */
  5284. for {
  5285. v11 = parser + 400
  5286. v10 = *(*uint8)(unsafe.Pointer(v11))
  5287. *(*uint8)(unsafe.Pointer(v11))++
  5288. if !(nPrefixes>>v10 != 0) {
  5289. break
  5290. }
  5291. }
  5292. if libc.Int32FromUint8((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower) < int32(3) {
  5293. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = uint8(3)
  5294. }
  5295. /* Detect and prevent invalid shift */
  5296. if uint32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower) >= libc.Uint32FromInt64(4)*libc.Uint32FromInt32(8) {
  5297. /* Restore actual size of memory in m_nsAtts */
  5298. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = oldNsAttsPower
  5299. return int32(_XML_ERROR_NO_MEMORY)
  5300. }
  5301. nsAttsSize = uint32(1) << (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower
  5302. /* Detect and prevent integer overflow.
  5303. * The preprocessor guard addresses the "always false" warning
  5304. * from -Wtype-limits on platforms where
  5305. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5306. if nsAttsSize > libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromInt64(12) {
  5307. /* Restore actual size of memory in m_nsAtts */
  5308. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = oldNsAttsPower
  5309. return int32(_XML_ERROR_NO_MEMORY)
  5310. }
  5311. 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, nsAttsSize*libc.Uint32FromInt64(12))
  5312. if !(temp1 != 0) {
  5313. /* Restore actual size of memory in m_nsAtts */
  5314. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = oldNsAttsPower
  5315. return int32(_XML_ERROR_NO_MEMORY)
  5316. }
  5317. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts = temp1
  5318. version = uint32(0) /* force re-initialization of m_nsAtts hash table */
  5319. }
  5320. /* using a version flag saves us from initializing m_nsAtts every time */
  5321. if !(version != 0) { /* initialize version flags when version wraps around */
  5322. version = uint32(m_INIT_ATTS_VERSION)
  5323. j1 = libc.Int32FromUint32(nsAttsSize)
  5324. for {
  5325. if !(j1 != 0) {
  5326. break
  5327. }
  5328. j1--
  5329. v13 = j1
  5330. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(v13)*12))).Fversion = version
  5331. goto _12
  5332. _12:
  5333. }
  5334. }
  5335. version--
  5336. v14 = version
  5337. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsVersion = v14
  5338. /* expand prefixed names and check for duplicates */
  5339. for {
  5340. if !(i < attIndex) {
  5341. break
  5342. }
  5343. s = *(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*4))
  5344. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s + uintptr(-libc.Int32FromInt32(1))))) == int32(2) {
  5345. _copy_salt_to_sipkey(tls, parser, bp+56)
  5346. _sip24_init(tls, bp, bp+56)
  5347. *(*TXML_Char)(unsafe.Pointer(s + uintptr(-libc.Int32FromInt32(1)))) = uint8(0) /* clear flag */
  5348. id = _lookup(tls, parser, dtd+40, s, uint32(0))
  5349. if !(id != 0) || !((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix != 0) {
  5350. /* This code is walking through the appAtts array, dealing
  5351. * with (in this case) a prefixed attribute name. To be in
  5352. * the array, the attribute must have already been bound, so
  5353. * has to have passed through the hash table lookup once
  5354. * already. That implies that an entry for it already
  5355. * exists, so the lookup above will return a pointer to
  5356. * already allocated memory. There is no opportunaity for
  5357. * the allocator to fail, so the condition above cannot be
  5358. * fulfilled.
  5359. *
  5360. * Since it is difficult to be certain that the above
  5361. * analysis is complete, we retain the test and merely
  5362. * remove the code from coverage tests.
  5363. */
  5364. return int32(_XML_ERROR_NO_MEMORY) /* LCOV_EXCL_LINE */
  5365. }
  5366. b = (*TPREFIX)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix)).Fbinding
  5367. if !(b != 0) {
  5368. return int32(_XML_ERROR_UNBOUND_PREFIX)
  5369. }
  5370. j1 = 0
  5371. for {
  5372. if !(j1 < (*TBINDING)(unsafe.Pointer(b)).FuriLen) {
  5373. break
  5374. }
  5375. c = *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Furi + uintptr(j1)))
  5376. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  5377. v17 = 0
  5378. } else {
  5379. v19 = parser + 412 + 12
  5380. v18 = *(*uintptr)(unsafe.Pointer(v19))
  5381. *(*uintptr)(unsafe.Pointer(v19))++
  5382. *(*TXML_Char)(unsafe.Pointer(v18)) = c
  5383. v17 = libc.Int32FromInt32(1)
  5384. }
  5385. if !(v17 != 0) {
  5386. return int32(_XML_ERROR_NO_MEMORY)
  5387. }
  5388. goto _16
  5389. _16:
  5390. ;
  5391. j1++
  5392. }
  5393. _sip24_update(tls, bp, (*TBINDING)(unsafe.Pointer(b)).Furi, libc.Uint32FromInt32((*TBINDING)(unsafe.Pointer(b)).FuriLen)*uint32(1))
  5394. for {
  5395. v20 = s
  5396. s++
  5397. if !(libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(v20))) != int32(m_ASCII_COLON)) {
  5398. break
  5399. }
  5400. }
  5401. _sip24_update(tls, bp, s, _keylen(tls, s)*uint32(1))
  5402. for { /* copies null terminator */
  5403. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  5404. v23 = 0
  5405. } else {
  5406. v25 = parser + 412 + 12
  5407. v24 = *(*uintptr)(unsafe.Pointer(v25))
  5408. *(*uintptr)(unsafe.Pointer(v25))++
  5409. *(*TXML_Char)(unsafe.Pointer(v24)) = *(*TXML_Char)(unsafe.Pointer(s))
  5410. v23 = libc.Int32FromInt32(1)
  5411. }
  5412. if !(v23 != 0) {
  5413. return int32(_XML_ERROR_NO_MEMORY)
  5414. }
  5415. goto _22
  5416. _22:
  5417. ;
  5418. v21 = s
  5419. s++
  5420. if !(*(*TXML_Char)(unsafe.Pointer(v21)) != 0) {
  5421. break
  5422. }
  5423. }
  5424. uriHash = uint32(_sip24_final(tls, bp))
  5425. /* Check hash table for duplicate of expanded name (uriName).
  5426. Derived from code in lookup(parser, HASH_TABLE *table, ...).
  5427. */
  5428. step = uint8(0)
  5429. mask = nsAttsSize - uint32(1)
  5430. j1 = libc.Int32FromUint32(uriHash & mask) /* index into hash table */
  5431. for (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*12))).Fversion == version {
  5432. /* for speed we compare stored hash values first */
  5433. if uriHash == (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*12))).Fhash {
  5434. s1 = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart
  5435. s2 = (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*12))).FuriName
  5436. /* s1 is null terminated, but not s2 */
  5437. for {
  5438. if !(libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s1))) == libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s2))) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s1))) != 0) {
  5439. break
  5440. }
  5441. goto _26
  5442. _26:
  5443. ;
  5444. s1++
  5445. s2++
  5446. }
  5447. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s1))) == 0 {
  5448. return int32(_XML_ERROR_DUPLICATE_ATTRIBUTE)
  5449. }
  5450. }
  5451. if !(step != 0) {
  5452. step = uint8(uriHash & ^mask >> (libc.Int32FromUint8((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower)-libc.Int32FromInt32(1)) & (mask>>libc.Int32FromInt32(2)) | libc.Uint32FromInt32(1))
  5453. }
  5454. if j1 < libc.Int32FromUint8(step) {
  5455. j1 = int32(uint32(j1) + (nsAttsSize - uint32(step)))
  5456. } else {
  5457. j1 -= libc.Int32FromUint8(step)
  5458. }
  5459. }
  5460. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets != 0 { /* append namespace separator and prefix */
  5461. *(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fptr + uintptr(-libc.Int32FromInt32(1)))) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  5462. s = (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fname
  5463. for {
  5464. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  5465. v30 = 0
  5466. } else {
  5467. v32 = parser + 412 + 12
  5468. v31 = *(*uintptr)(unsafe.Pointer(v32))
  5469. *(*uintptr)(unsafe.Pointer(v32))++
  5470. *(*TXML_Char)(unsafe.Pointer(v31)) = *(*TXML_Char)(unsafe.Pointer(s))
  5471. v30 = libc.Int32FromInt32(1)
  5472. }
  5473. if !(v30 != 0) {
  5474. return int32(_XML_ERROR_NO_MEMORY)
  5475. }
  5476. goto _29
  5477. _29:
  5478. ;
  5479. v28 = s
  5480. s++
  5481. if !(*(*TXML_Char)(unsafe.Pointer(v28)) != 0) {
  5482. break
  5483. }
  5484. }
  5485. }
  5486. /* store expanded name in attribute list */
  5487. s = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart
  5488. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr
  5489. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*4)) = s
  5490. /* fill empty slot with new version, uriName and hash value */
  5491. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*12))).Fversion = version
  5492. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*12))).Fhash = uriHash
  5493. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*12))).FuriName = s
  5494. nPrefixes--
  5495. v33 = nPrefixes
  5496. if !(v33 != 0) {
  5497. i += int32(2)
  5498. break
  5499. }
  5500. } else { /* not prefixed */
  5501. *(*TXML_Char)(unsafe.Pointer(s + uintptr(-libc.Int32FromInt32(1)))) = uint8(0)
  5502. } /* clear flag */
  5503. goto _15
  5504. _15:
  5505. ;
  5506. i += int32(2)
  5507. }
  5508. }
  5509. /* clear flags for the remaining attributes */
  5510. for {
  5511. if !(i < attIndex) {
  5512. break
  5513. }
  5514. *(*TXML_Char)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*4)) + uintptr(-libc.Int32FromInt32(1)))) = uint8(0)
  5515. goto _34
  5516. _34:
  5517. ;
  5518. i += int32(2)
  5519. }
  5520. binding = *(*uintptr)(unsafe.Pointer(bindingsPtr))
  5521. for {
  5522. if !(binding != 0) {
  5523. break
  5524. }
  5525. *(*TXML_Char)(unsafe.Pointer((*Tattribute_id)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).FattId)).Fname + uintptr(-libc.Int32FromInt32(1)))) = uint8(0)
  5526. goto _35
  5527. _35:
  5528. ;
  5529. binding = (*TBINDING)(unsafe.Pointer(binding)).FnextTagBinding
  5530. }
  5531. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0) {
  5532. return int32(_XML_ERROR_NONE)
  5533. }
  5534. /* expand the element type name */
  5535. if (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fprefix != 0 {
  5536. binding = (*TPREFIX)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fprefix)).Fbinding
  5537. if !(binding != 0) {
  5538. return int32(_XML_ERROR_UNBOUND_PREFIX)
  5539. }
  5540. localPart = (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr
  5541. for {
  5542. v36 = localPart
  5543. localPart++
  5544. if !(libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(v36))) != int32(m_ASCII_COLON)) {
  5545. break
  5546. }
  5547. }
  5548. } else {
  5549. if (*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding != 0 {
  5550. binding = (*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding
  5551. localPart = (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr
  5552. } else {
  5553. return int32(_XML_ERROR_NONE)
  5554. }
  5555. }
  5556. prefixLen = 0
  5557. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets != 0 && (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname != 0 {
  5558. for {
  5559. v38 = prefixLen
  5560. prefixLen++
  5561. if !(*(*TXML_Char)(unsafe.Pointer((*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname + uintptr(v38))) != 0) {
  5562. break
  5563. }
  5564. goto _37
  5565. _37:
  5566. } /* prefixLen includes null terminator */
  5567. }
  5568. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).FlocalPart = localPart
  5569. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).FuriLen = (*TBINDING)(unsafe.Pointer(binding)).FuriLen
  5570. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fprefix = (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname
  5571. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).FprefixLen = prefixLen
  5572. i = 0
  5573. for {
  5574. v40 = i
  5575. i++
  5576. if !(*(*TXML_Char)(unsafe.Pointer(localPart + uintptr(v40))) != 0) {
  5577. break
  5578. }
  5579. goto _39
  5580. _39:
  5581. } /* i includes null terminator */
  5582. /* Detect and prevent integer overflow */
  5583. if (*TBINDING)(unsafe.Pointer(binding)).FuriLen > int32(m_INT_MAX)-prefixLen || i > int32(m_INT_MAX)-((*TBINDING)(unsafe.Pointer(binding)).FuriLen+prefixLen) {
  5584. return int32(_XML_ERROR_NO_MEMORY)
  5585. }
  5586. n = i + (*TBINDING)(unsafe.Pointer(binding)).FuriLen + prefixLen
  5587. if n > (*TBINDING)(unsafe.Pointer(binding)).FuriAlloc {
  5588. /* Detect and prevent integer overflow */
  5589. if n > libc.Int32FromInt32(m_INT_MAX)-libc.Int32FromInt32(m_EXPAND_SPARE) {
  5590. return int32(_XML_ERROR_NO_MEMORY)
  5591. }
  5592. /* Detect and prevent integer overflow.
  5593. * The preprocessor guard addresses the "always false" warning
  5594. * from -Wtype-limits on platforms where
  5595. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5596. if libc.Uint32FromInt32(n+libc.Int32FromInt32(m_EXPAND_SPARE)) > libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromInt64(1) {
  5597. return int32(_XML_ERROR_NO_MEMORY)
  5598. }
  5599. uri = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint32FromInt32(n+libc.Int32FromInt32(m_EXPAND_SPARE))*libc.Uint32FromInt64(1))
  5600. if !(uri != 0) {
  5601. return int32(_XML_ERROR_NO_MEMORY)
  5602. }
  5603. (*TBINDING)(unsafe.Pointer(binding)).FuriAlloc = n + int32(m_EXPAND_SPARE)
  5604. libc.Xmemcpy(tls, uri, (*TBINDING)(unsafe.Pointer(binding)).Furi, libc.Uint32FromInt32((*TBINDING)(unsafe.Pointer(binding)).FuriLen)*uint32(1))
  5605. p = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  5606. for {
  5607. if !(p != 0) {
  5608. break
  5609. }
  5610. if (*TTAG)(unsafe.Pointer(p)).Fname.Fstr == (*TBINDING)(unsafe.Pointer(binding)).Furi {
  5611. (*TTAG)(unsafe.Pointer(p)).Fname.Fstr = uri
  5612. }
  5613. goto _41
  5614. _41:
  5615. ;
  5616. p = (*TTAG)(unsafe.Pointer(p)).Fparent
  5617. }
  5618. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TBINDING)(unsafe.Pointer(binding)).Furi)
  5619. (*TBINDING)(unsafe.Pointer(binding)).Furi = uri
  5620. }
  5621. /* if m_namespaceSeparator != '\0' then uri includes it already */
  5622. uri = (*TBINDING)(unsafe.Pointer(binding)).Furi + uintptr((*TBINDING)(unsafe.Pointer(binding)).FuriLen)
  5623. libc.Xmemcpy(tls, uri, localPart, libc.Uint32FromInt32(i)*uint32(1))
  5624. /* we always have a namespace separator between localPart and prefix */
  5625. if prefixLen != 0 {
  5626. uri += uintptr(i - int32(1))
  5627. *(*TXML_Char)(unsafe.Pointer(uri)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator /* replace null terminator */
  5628. libc.Xmemcpy(tls, uri+uintptr(1), (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname, libc.Uint32FromInt32(prefixLen)*uint32(1))
  5629. }
  5630. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr = (*TBINDING)(unsafe.Pointer(binding)).Furi
  5631. return int32(_XML_ERROR_NONE)
  5632. }
  5633. func _is_rfc3986_uri_char(tls *libc.TLS, candidate TXML_Char) (r TXML_Bool) {
  5634. // For the RFC 3986 ANBF grammar see
  5635. // https://datatracker.ietf.org/doc/html/rfc3986#appendix-A
  5636. switch libc.Int32FromUint8(candidate) {
  5637. // From rule "ALPHA" (uppercase half)
  5638. case int32('A'):
  5639. fallthrough
  5640. case int32('B'):
  5641. fallthrough
  5642. case int32('C'):
  5643. fallthrough
  5644. case int32('D'):
  5645. fallthrough
  5646. case int32('E'):
  5647. fallthrough
  5648. case int32('F'):
  5649. fallthrough
  5650. case int32('G'):
  5651. fallthrough
  5652. case int32('H'):
  5653. fallthrough
  5654. case int32('I'):
  5655. fallthrough
  5656. case int32('J'):
  5657. fallthrough
  5658. case int32('K'):
  5659. fallthrough
  5660. case int32('L'):
  5661. fallthrough
  5662. case int32('M'):
  5663. fallthrough
  5664. case int32('N'):
  5665. fallthrough
  5666. case int32('O'):
  5667. fallthrough
  5668. case int32('P'):
  5669. fallthrough
  5670. case int32('Q'):
  5671. fallthrough
  5672. case int32('R'):
  5673. fallthrough
  5674. case int32('S'):
  5675. fallthrough
  5676. case int32('T'):
  5677. fallthrough
  5678. case int32('U'):
  5679. fallthrough
  5680. case int32('V'):
  5681. fallthrough
  5682. case int32('W'):
  5683. fallthrough
  5684. case int32('X'):
  5685. fallthrough
  5686. case int32('Y'):
  5687. fallthrough
  5688. case int32('Z'):
  5689. // From rule "ALPHA" (lowercase half)
  5690. fallthrough
  5691. case int32('a'):
  5692. fallthrough
  5693. case int32('b'):
  5694. fallthrough
  5695. case int32('c'):
  5696. fallthrough
  5697. case int32('d'):
  5698. fallthrough
  5699. case int32('e'):
  5700. fallthrough
  5701. case int32('f'):
  5702. fallthrough
  5703. case int32('g'):
  5704. fallthrough
  5705. case int32('h'):
  5706. fallthrough
  5707. case int32('i'):
  5708. fallthrough
  5709. case int32('j'):
  5710. fallthrough
  5711. case int32('k'):
  5712. fallthrough
  5713. case int32('l'):
  5714. fallthrough
  5715. case int32('m'):
  5716. fallthrough
  5717. case int32('n'):
  5718. fallthrough
  5719. case int32('o'):
  5720. fallthrough
  5721. case int32('p'):
  5722. fallthrough
  5723. case int32('q'):
  5724. fallthrough
  5725. case int32('r'):
  5726. fallthrough
  5727. case int32('s'):
  5728. fallthrough
  5729. case int32('t'):
  5730. fallthrough
  5731. case int32('u'):
  5732. fallthrough
  5733. case int32('v'):
  5734. fallthrough
  5735. case int32('w'):
  5736. fallthrough
  5737. case int32('x'):
  5738. fallthrough
  5739. case int32('y'):
  5740. fallthrough
  5741. case int32('z'):
  5742. // From rule "DIGIT"
  5743. fallthrough
  5744. case int32('0'):
  5745. fallthrough
  5746. case int32('1'):
  5747. fallthrough
  5748. case int32('2'):
  5749. fallthrough
  5750. case int32('3'):
  5751. fallthrough
  5752. case int32('4'):
  5753. fallthrough
  5754. case int32('5'):
  5755. fallthrough
  5756. case int32('6'):
  5757. fallthrough
  5758. case int32('7'):
  5759. fallthrough
  5760. case int32('8'):
  5761. fallthrough
  5762. case int32('9'):
  5763. // From rule "pct-encoded"
  5764. fallthrough
  5765. case int32('%'):
  5766. // From rule "unreserved"
  5767. fallthrough
  5768. case int32('-'):
  5769. fallthrough
  5770. case int32('.'):
  5771. fallthrough
  5772. case int32('_'):
  5773. fallthrough
  5774. case int32('~'):
  5775. // From rule "gen-delims"
  5776. fallthrough
  5777. case int32(':'):
  5778. fallthrough
  5779. case int32('/'):
  5780. fallthrough
  5781. case int32('?'):
  5782. fallthrough
  5783. case int32('#'):
  5784. fallthrough
  5785. case int32('['):
  5786. fallthrough
  5787. case int32(']'):
  5788. fallthrough
  5789. case int32('@'):
  5790. // From rule "sub-delims"
  5791. fallthrough
  5792. case int32('!'):
  5793. fallthrough
  5794. case int32('$'):
  5795. fallthrough
  5796. case int32('&'):
  5797. fallthrough
  5798. case int32('\''):
  5799. fallthrough
  5800. case int32('('):
  5801. fallthrough
  5802. case int32(')'):
  5803. fallthrough
  5804. case int32('*'):
  5805. fallthrough
  5806. case int32('+'):
  5807. fallthrough
  5808. case int32(','):
  5809. fallthrough
  5810. case int32(';'):
  5811. fallthrough
  5812. case int32('='):
  5813. return libc.Uint8FromInt32(1)
  5814. default:
  5815. return libc.Uint8FromInt32(0)
  5816. }
  5817. return r
  5818. }
  5819. // C documentation
  5820. //
  5821. // /* addBinding() overwrites the value of prefix->binding without checking.
  5822. // Therefore one must keep track of the old value outside of addBinding().
  5823. // */
  5824. func _addBinding(tls *libc.TLS, parser TXML_Parser, prefix uintptr, attId uintptr, uri uintptr, bindingsPtr uintptr) (r _XML_Error) {
  5825. var b, temp, v3 uintptr
  5826. var isXML, isXMLNS, mustBeXML TXML_Bool
  5827. var len1, v2 int32
  5828. _, _, _, _, _, _, _, _ = b, isXML, isXMLNS, len1, mustBeXML, temp, v2, v3
  5829. mustBeXML = libc.Uint8FromInt32(0)
  5830. isXML = libc.Uint8FromInt32(1)
  5831. isXMLNS = libc.Uint8FromInt32(1)
  5832. /* empty URI is only valid for default namespace per XML NS 1.0 (not 1.1) */
  5833. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(uri))) == int32('\000') && (*TPREFIX)(unsafe.Pointer(prefix)).Fname != 0 {
  5834. return int32(_XML_ERROR_UNDECLARING_PREFIX)
  5835. }
  5836. if (*TPREFIX)(unsafe.Pointer(prefix)).Fname != 0 && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname))) == int32(m_ASCII_x) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 1))) == int32(m_ASCII_m) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 2))) == int32(m_ASCII_l) {
  5837. /* Not allowed to bind xmlns */
  5838. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 3))) == int32(m_ASCII_n) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 4))) == int32(m_ASCII_s) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 5))) == int32('\000') {
  5839. return int32(_XML_ERROR_RESERVED_PREFIX_XMLNS)
  5840. }
  5841. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 3))) == int32('\000') {
  5842. mustBeXML = libc.Uint8FromInt32(1)
  5843. }
  5844. }
  5845. len1 = 0
  5846. for {
  5847. if !(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1))) != 0) {
  5848. break
  5849. }
  5850. if isXML != 0 && (len1 > _xmlLen || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) != libc.Int32FromUint8(_xmlNamespace[len1])) {
  5851. isXML = libc.Uint8FromInt32(0)
  5852. }
  5853. if !(mustBeXML != 0) && isXMLNS != 0 && (len1 > _xmlnsLen || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) != libc.Int32FromUint8(_xmlnsNamespace[len1])) {
  5854. isXMLNS = libc.Uint8FromInt32(0)
  5855. }
  5856. // NOTE: While Expat does not validate namespace URIs against RFC 3986
  5857. // today (and is not REQUIRED to do so with regard to the XML 1.0
  5858. // namespaces specification) we have to at least make sure, that
  5859. // the application on top of Expat (that is likely splitting expanded
  5860. // element names ("qualified names") of form
  5861. // "[uri sep] local [sep prefix] '\0'" back into 1, 2 or 3 pieces
  5862. // in its element handler code) cannot be confused by an attacker
  5863. // putting additional namespace separator characters into namespace
  5864. // declarations. That would be ambiguous and not to be expected.
  5865. //
  5866. // While the HTML API docs of function XML_ParserCreateNS have been
  5867. // advising against use of a namespace separator character that can
  5868. // appear in a URI for >20 years now, some widespread applications
  5869. // are using URI characters (':' (colon) in particular) for a
  5870. // namespace separator, in practice. To keep these applications
  5871. // functional, we only reject namespaces URIs containing the
  5872. // application-chosen namespace separator if the chosen separator
  5873. // is a non-URI character with regard to RFC 3986.
  5874. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) == libc.Int32FromUint8((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator) && !(_is_rfc3986_uri_char(tls, *(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) != 0) {
  5875. return int32(_XML_ERROR_SYNTAX)
  5876. }
  5877. goto _1
  5878. _1:
  5879. ;
  5880. len1++
  5881. }
  5882. isXML = libc.BoolUint8(isXML != 0 && len1 == _xmlLen)
  5883. isXMLNS = libc.BoolUint8(isXMLNS != 0 && len1 == _xmlnsLen)
  5884. if libc.Int32FromUint8(mustBeXML) != libc.Int32FromUint8(isXML) {
  5885. if mustBeXML != 0 {
  5886. v2 = int32(_XML_ERROR_RESERVED_PREFIX_XML)
  5887. } else {
  5888. v2 = int32(_XML_ERROR_RESERVED_NAMESPACE_URI)
  5889. }
  5890. return v2
  5891. }
  5892. if isXMLNS != 0 {
  5893. return int32(_XML_ERROR_RESERVED_NAMESPACE_URI)
  5894. }
  5895. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  5896. len1++
  5897. }
  5898. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList != 0 {
  5899. b = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  5900. if len1 > (*TBINDING)(unsafe.Pointer(b)).FuriAlloc {
  5901. /* Detect and prevent integer overflow */
  5902. if len1 > libc.Int32FromInt32(m_INT_MAX)-libc.Int32FromInt32(m_EXPAND_SPARE) {
  5903. return int32(_XML_ERROR_NO_MEMORY)
  5904. }
  5905. /* Detect and prevent integer overflow.
  5906. * The preprocessor guard addresses the "always false" warning
  5907. * from -Wtype-limits on platforms where
  5908. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5909. if libc.Uint32FromInt32(len1+libc.Int32FromInt32(m_EXPAND_SPARE)) > libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromInt64(1) {
  5910. return int32(_XML_ERROR_NO_MEMORY)
  5911. }
  5912. 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.Uint32FromInt64(1)*libc.Uint32FromInt32(len1+libc.Int32FromInt32(m_EXPAND_SPARE)))
  5913. if temp == libc.UintptrFromInt32(0) {
  5914. return int32(_XML_ERROR_NO_MEMORY)
  5915. }
  5916. (*TBINDING)(unsafe.Pointer(b)).Furi = temp
  5917. (*TBINDING)(unsafe.Pointer(b)).FuriAlloc = len1 + int32(m_EXPAND_SPARE)
  5918. }
  5919. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding
  5920. } else {
  5921. b = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint32FromInt64(28))
  5922. if !(b != 0) {
  5923. return int32(_XML_ERROR_NO_MEMORY)
  5924. }
  5925. /* Detect and prevent integer overflow */
  5926. if len1 > libc.Int32FromInt32(m_INT_MAX)-libc.Int32FromInt32(m_EXPAND_SPARE) {
  5927. return int32(_XML_ERROR_NO_MEMORY)
  5928. }
  5929. /* Detect and prevent integer overflow.
  5930. * The preprocessor guard addresses the "always false" warning
  5931. * from -Wtype-limits on platforms where
  5932. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5933. if libc.Uint32FromInt32(len1+libc.Int32FromInt32(m_EXPAND_SPARE)) > libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromInt64(1) {
  5934. return int32(_XML_ERROR_NO_MEMORY)
  5935. }
  5936. (*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.Uint32FromInt64(1)*libc.Uint32FromInt32(len1+libc.Int32FromInt32(m_EXPAND_SPARE)))
  5937. if !((*TBINDING)(unsafe.Pointer(b)).Furi != 0) {
  5938. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, b)
  5939. return int32(_XML_ERROR_NO_MEMORY)
  5940. }
  5941. (*TBINDING)(unsafe.Pointer(b)).FuriAlloc = len1 + int32(m_EXPAND_SPARE)
  5942. }
  5943. (*TBINDING)(unsafe.Pointer(b)).FuriLen = len1
  5944. libc.Xmemcpy(tls, (*TBINDING)(unsafe.Pointer(b)).Furi, uri, libc.Uint32FromInt32(len1)*uint32(1))
  5945. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  5946. *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Furi + uintptr(len1-int32(1)))) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  5947. }
  5948. (*TBINDING)(unsafe.Pointer(b)).Fprefix = prefix
  5949. (*TBINDING)(unsafe.Pointer(b)).FattId = attId
  5950. (*TBINDING)(unsafe.Pointer(b)).FprevPrefixBinding = (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding
  5951. /* NULL binding when default namespace undeclared */
  5952. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(uri))) == int32('\000') && prefix == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd+152 {
  5953. (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding = libc.UintptrFromInt32(0)
  5954. } else {
  5955. (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding = b
  5956. }
  5957. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = *(*uintptr)(unsafe.Pointer(bindingsPtr))
  5958. *(*uintptr)(unsafe.Pointer(bindingsPtr)) = b
  5959. /* if attId == NULL then we are not starting a namespace scope */
  5960. if attId != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler != 0 {
  5961. if (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding != 0 {
  5962. v3 = uri
  5963. } else {
  5964. v3 = uintptr(0)
  5965. }
  5966. (*(*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)
  5967. }
  5968. return int32(_XML_ERROR_NONE)
  5969. }
  5970. // "http://www.w3.org/XML/1998/namespace"
  5971. var _xmlNamespace = [37]TXML_Char{
  5972. 0: uint8(m_ASCII_h),
  5973. 1: uint8(m_ASCII_t),
  5974. 2: uint8(m_ASCII_t),
  5975. 3: uint8(m_ASCII_p),
  5976. 4: uint8(m_ASCII_COLON),
  5977. 5: uint8(m_ASCII_SLASH),
  5978. 6: uint8(m_ASCII_SLASH),
  5979. 7: uint8(m_ASCII_w),
  5980. 8: uint8(m_ASCII_w),
  5981. 9: uint8(m_ASCII_w),
  5982. 10: uint8(m_ASCII_PERIOD),
  5983. 11: uint8(m_ASCII_w),
  5984. 12: uint8(m_ASCII_3),
  5985. 13: uint8(m_ASCII_PERIOD),
  5986. 14: uint8(m_ASCII_o),
  5987. 15: uint8(m_ASCII_r),
  5988. 16: uint8(m_ASCII_g),
  5989. 17: uint8(m_ASCII_SLASH),
  5990. 18: uint8(m_ASCII_X),
  5991. 19: uint8(m_ASCII_M),
  5992. 20: uint8(m_ASCII_L),
  5993. 21: uint8(m_ASCII_SLASH),
  5994. 22: uint8(m_ASCII_1),
  5995. 23: uint8(m_ASCII_9),
  5996. 24: uint8(m_ASCII_9),
  5997. 25: uint8(m_ASCII_8),
  5998. 26: uint8(m_ASCII_SLASH),
  5999. 27: uint8(m_ASCII_n),
  6000. 28: uint8(m_ASCII_a),
  6001. 29: uint8(m_ASCII_m),
  6002. 30: uint8(m_ASCII_e),
  6003. 31: uint8(m_ASCII_s),
  6004. 32: uint8(m_ASCII_p),
  6005. 33: uint8(m_ASCII_a),
  6006. 34: uint8(m_ASCII_c),
  6007. 35: uint8(m_ASCII_e),
  6008. }
  6009. var _xmlLen = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt64(37))/libc.Uint32FromInt64(1) - libc.Uint32FromInt32(1))
  6010. // "http://www.w3.org/2000/xmlns/"
  6011. var _xmlnsNamespace = [30]TXML_Char{
  6012. 0: uint8(m_ASCII_h),
  6013. 1: uint8(m_ASCII_t),
  6014. 2: uint8(m_ASCII_t),
  6015. 3: uint8(m_ASCII_p),
  6016. 4: uint8(m_ASCII_COLON),
  6017. 5: uint8(m_ASCII_SLASH),
  6018. 6: uint8(m_ASCII_SLASH),
  6019. 7: uint8(m_ASCII_w),
  6020. 8: uint8(m_ASCII_w),
  6021. 9: uint8(m_ASCII_w),
  6022. 10: uint8(m_ASCII_PERIOD),
  6023. 11: uint8(m_ASCII_w),
  6024. 12: uint8(m_ASCII_3),
  6025. 13: uint8(m_ASCII_PERIOD),
  6026. 14: uint8(m_ASCII_o),
  6027. 15: uint8(m_ASCII_r),
  6028. 16: uint8(m_ASCII_g),
  6029. 17: uint8(m_ASCII_SLASH),
  6030. 18: uint8(m_ASCII_2),
  6031. 19: uint8(m_ASCII_0),
  6032. 20: uint8(m_ASCII_0),
  6033. 21: uint8(m_ASCII_0),
  6034. 22: uint8(m_ASCII_SLASH),
  6035. 23: uint8(m_ASCII_x),
  6036. 24: uint8(m_ASCII_m),
  6037. 25: uint8(m_ASCII_l),
  6038. 26: uint8(m_ASCII_n),
  6039. 27: uint8(m_ASCII_s),
  6040. 28: uint8(m_ASCII_SLASH),
  6041. }
  6042. var _xmlnsLen = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt64(30))/libc.Uint32FromInt64(1) - libc.Uint32FromInt32(1))
  6043. // C documentation
  6044. //
  6045. // /* The idea here is to avoid using stack for each CDATA section when
  6046. // the whole file is parsed with one call.
  6047. // */
  6048. func _cdataSectionProcessor(tls *libc.TLS, parser TXML_Parser, _start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  6049. bp := tls.Alloc(16)
  6050. defer tls.Free(16)
  6051. *(*uintptr)(unsafe.Pointer(bp)) = _start
  6052. var result _XML_Error
  6053. _ = result
  6054. 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))
  6055. if result != int32(_XML_ERROR_NONE) {
  6056. return result
  6057. }
  6058. if *(*uintptr)(unsafe.Pointer(bp)) != 0 {
  6059. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 { /* we are parsing an external entity */
  6060. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityContentProcessor)
  6061. return _externalEntityContentProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, endPtr)
  6062. } else {
  6063. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_contentProcessor)
  6064. return _contentProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, endPtr)
  6065. }
  6066. }
  6067. return result
  6068. }
  6069. // C documentation
  6070. //
  6071. // /* startPtr gets set to non-null if the section is closed, and to null if
  6072. // the section is not yet closed.
  6073. // */
  6074. 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) {
  6075. bp := tls.Alloc(16)
  6076. defer tls.Free(16)
  6077. var charDataHandler TXML_CharacterDataHandler
  6078. var convert_res _XML_Convert_Result
  6079. var eventEndPP, eventPP, v3 uintptr
  6080. var tok int32
  6081. var _ /* c at bp+8 */ TXML_Char
  6082. var _ /* dataPtr at bp+12 */ uintptr
  6083. var _ /* next at bp+4 */ uintptr
  6084. var _ /* s at bp+0 */ uintptr
  6085. _, _, _, _, _, _ = charDataHandler, convert_res, eventEndPP, eventPP, tok, v3
  6086. *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(startPtr))
  6087. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6088. eventPP = parser + 284
  6089. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6090. eventEndPP = parser + 288
  6091. } else {
  6092. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  6093. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 4
  6094. }
  6095. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6096. *(*uintptr)(unsafe.Pointer(startPtr)) = libc.UintptrFromInt32(0)
  6097. for {
  6098. *(*uintptr)(unsafe.Pointer(bp + 4)) = *(*uintptr)(unsafe.Pointer(bp)) /* in case of XML_TOK_NONE or XML_TOK_PARTIAL */
  6099. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 2*4))})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+4)
  6100. if !(_accountingDiffTolerated(tls, parser, tok, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)), int32(4044), account) != 0) {
  6101. _accountingOnAbort(tls, parser)
  6102. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6103. }
  6104. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp + 4))
  6105. switch tok {
  6106. case int32(m_XML_TOK_CDATA_SECT_CLOSE):
  6107. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler != 0 {
  6108. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg)
  6109. } else {
  6110. if libc.Bool(0 != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  6111. (*(*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)
  6112. } else {
  6113. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6114. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))
  6115. }
  6116. }
  6117. }
  6118. *(*uintptr)(unsafe.Pointer(startPtr)) = *(*uintptr)(unsafe.Pointer(bp + 4))
  6119. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp + 4))
  6120. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  6121. return int32(_XML_ERROR_ABORTED)
  6122. } else {
  6123. return int32(_XML_ERROR_NONE)
  6124. }
  6125. fallthrough
  6126. case int32(m_XML_TOK_DATA_NEWLINE):
  6127. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  6128. *(*TXML_Char)(unsafe.Pointer(bp + 8)) = uint8(0xA)
  6129. (*(*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+8, int32(1))
  6130. } else {
  6131. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6132. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))
  6133. }
  6134. }
  6135. case int32(m_XML_TOK_DATA_CHARS):
  6136. charDataHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler
  6137. if charDataHandler != 0 {
  6138. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  6139. for {
  6140. *(*uintptr)(unsafe.Pointer(bp + 12)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  6141. 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 + 4)), bp+12, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd)
  6142. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp + 4))
  6143. (*(*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(*(*uintptr)(unsafe.Pointer(bp + 12)))-int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf))
  6144. if convert_res == int32(_XML_CONVERT_COMPLETED) || convert_res == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  6145. break
  6146. }
  6147. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6148. goto _2
  6149. _2:
  6150. }
  6151. } else {
  6152. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{charDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, *(*uintptr)(unsafe.Pointer(bp)), int32(*(*uintptr)(unsafe.Pointer(bp + 4)))-int32(*(*uintptr)(unsafe.Pointer(bp))))
  6153. }
  6154. } else {
  6155. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6156. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))
  6157. }
  6158. }
  6159. case m_XML_TOK_INVALID:
  6160. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp + 4))
  6161. return int32(_XML_ERROR_INVALID_TOKEN)
  6162. case -int32(2):
  6163. if haveMore != 0 {
  6164. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6165. return int32(_XML_ERROR_NONE)
  6166. }
  6167. return int32(_XML_ERROR_PARTIAL_CHAR)
  6168. case -int32(1):
  6169. fallthrough
  6170. case -int32(4):
  6171. if haveMore != 0 {
  6172. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6173. return int32(_XML_ERROR_NONE)
  6174. }
  6175. return int32(_XML_ERROR_UNCLOSED_CDATA_SECTION)
  6176. default:
  6177. /* Every token returned by XmlCdataSectionTok() has its own
  6178. * explicit case, so this default case will never be executed.
  6179. * We retain it as a safety net and exclude it from the coverage
  6180. * statistics.
  6181. *
  6182. * LCOV_EXCL_START
  6183. */
  6184. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp + 4))
  6185. return int32(_XML_ERROR_UNEXPECTED_STATE)
  6186. /* LCOV_EXCL_STOP */
  6187. }
  6188. v3 = *(*uintptr)(unsafe.Pointer(bp + 4))
  6189. *(*uintptr)(unsafe.Pointer(bp)) = v3
  6190. *(*uintptr)(unsafe.Pointer(eventPP)) = v3
  6191. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  6192. case int32(_XML_SUSPENDED):
  6193. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp + 4))
  6194. return int32(_XML_ERROR_NONE)
  6195. case int32(_XML_FINISHED):
  6196. return int32(_XML_ERROR_ABORTED)
  6197. default:
  6198. }
  6199. goto _1
  6200. _1:
  6201. }
  6202. /* not reached */
  6203. return r
  6204. }
  6205. // C documentation
  6206. //
  6207. // /* The idea here is to avoid using stack for each IGNORE section when
  6208. // the whole file is parsed with one call.
  6209. // */
  6210. func _ignoreSectionProcessor(tls *libc.TLS, parser TXML_Parser, _start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  6211. bp := tls.Alloc(16)
  6212. defer tls.Free(16)
  6213. *(*uintptr)(unsafe.Pointer(bp)) = _start
  6214. var result _XML_Error
  6215. _ = result
  6216. 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)))
  6217. if result != int32(_XML_ERROR_NONE) {
  6218. return result
  6219. }
  6220. if *(*uintptr)(unsafe.Pointer(bp)) != 0 {
  6221. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  6222. return _prologProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, endPtr)
  6223. }
  6224. return result
  6225. }
  6226. // C documentation
  6227. //
  6228. // /* startPtr gets set to non-null is the section is closed, and to null
  6229. // if the section is not yet closed.
  6230. // */
  6231. func _doIgnoreSection(tls *libc.TLS, parser TXML_Parser, enc uintptr, startPtr uintptr, end uintptr, nextPtr uintptr, haveMore TXML_Bool) (r _XML_Error) {
  6232. bp := tls.Alloc(16)
  6233. defer tls.Free(16)
  6234. var eventEndPP, eventPP, s uintptr
  6235. var tok int32
  6236. var _ /* next at bp+0 */ uintptr
  6237. _, _, _, _ = eventEndPP, eventPP, s, tok
  6238. *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(startPtr))
  6239. s = *(*uintptr)(unsafe.Pointer(startPtr))
  6240. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6241. eventPP = parser + 284
  6242. *(*uintptr)(unsafe.Pointer(eventPP)) = s
  6243. eventEndPP = parser + 288
  6244. } else {
  6245. /* It's not entirely clear, but it seems the following two lines
  6246. * of code cannot be executed. The only occasions on which 'enc'
  6247. * is not 'encoding' are when this function is called
  6248. * from the internal entity processing, and IGNORE sections are an
  6249. * error in internal entities.
  6250. *
  6251. * Since it really isn't clear that this is true, we keep the code
  6252. * and just remove it from our coverage tests.
  6253. *
  6254. * LCOV_EXCL_START
  6255. */
  6256. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  6257. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 4
  6258. /* LCOV_EXCL_STOP */
  6259. }
  6260. *(*uintptr)(unsafe.Pointer(eventPP)) = s
  6261. *(*uintptr)(unsafe.Pointer(startPtr)) = libc.UintptrFromInt32(0)
  6262. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 3*4))})))(tls, enc, s, end, bp)
  6263. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4196), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  6264. _accountingOnAbort(tls, parser)
  6265. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6266. }
  6267. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6268. switch tok {
  6269. case int32(m_XML_TOK_IGNORE_SECT):
  6270. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6271. _reportDefault(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6272. }
  6273. *(*uintptr)(unsafe.Pointer(startPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6274. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6275. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  6276. return int32(_XML_ERROR_ABORTED)
  6277. } else {
  6278. return int32(_XML_ERROR_NONE)
  6279. }
  6280. fallthrough
  6281. case m_XML_TOK_INVALID:
  6282. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6283. return int32(_XML_ERROR_INVALID_TOKEN)
  6284. case -int32(2):
  6285. if haveMore != 0 {
  6286. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6287. return int32(_XML_ERROR_NONE)
  6288. }
  6289. return int32(_XML_ERROR_PARTIAL_CHAR)
  6290. case -int32(1):
  6291. fallthrough
  6292. case -int32(4):
  6293. if haveMore != 0 {
  6294. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6295. return int32(_XML_ERROR_NONE)
  6296. }
  6297. return int32(_XML_ERROR_SYNTAX) /* XML_ERROR_UNCLOSED_IGNORE_SECTION */
  6298. default:
  6299. /* All of the tokens that XmlIgnoreSectionTok() returns have
  6300. * explicit cases to handle them, so this default case is never
  6301. * executed. We keep it as a safety net anyway, and remove it
  6302. * from our test coverage statistics.
  6303. *
  6304. * LCOV_EXCL_START
  6305. */
  6306. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6307. return int32(_XML_ERROR_UNEXPECTED_STATE)
  6308. /* LCOV_EXCL_STOP */
  6309. }
  6310. /* not reached */
  6311. return r
  6312. }
  6313. func _initializeEncoding(tls *libc.TLS, parser TXML_Parser) (r _XML_Error) {
  6314. var s uintptr
  6315. var v1 func(*libc.TLS, uintptr, uintptr, uintptr) int32
  6316. _, _ = s, v1
  6317. s = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName
  6318. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  6319. v1 = XXmlInitEncodingNS
  6320. } else {
  6321. v1 = XXmlInitEncoding
  6322. }
  6323. if v1(tls, parser+148, parser+144, s) != 0 {
  6324. return int32(_XML_ERROR_NONE)
  6325. }
  6326. return _handleUnknownEncoding(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName)
  6327. }
  6328. func _processXmlDecl(tls *libc.TLS, parser TXML_Parser, isGeneralTextEntity int32, s uintptr, next uintptr) (r _XML_Error) {
  6329. bp := tls.Alloc(32)
  6330. defer tls.Free(32)
  6331. var result _XML_Error
  6332. var storedEncName, storedversion uintptr
  6333. var v1 func(*libc.TLS, int32, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr) int32
  6334. var _ /* encodingName at bp+0 */ uintptr
  6335. var _ /* newEncoding at bp+4 */ uintptr
  6336. var _ /* standalone at bp+16 */ int32
  6337. var _ /* version at bp+8 */ uintptr
  6338. var _ /* versionend at bp+12 */ uintptr
  6339. _, _, _, _ = result, storedEncName, storedversion, v1
  6340. *(*uintptr)(unsafe.Pointer(bp)) = libc.UintptrFromInt32(0)
  6341. storedEncName = libc.UintptrFromInt32(0)
  6342. *(*uintptr)(unsafe.Pointer(bp + 4)) = libc.UintptrFromInt32(0)
  6343. *(*uintptr)(unsafe.Pointer(bp + 8)) = libc.UintptrFromInt32(0)
  6344. *(*uintptr)(unsafe.Pointer(bp + 12)) = libc.UintptrFromInt32(0)
  6345. storedversion = libc.UintptrFromInt32(0)
  6346. *(*int32)(unsafe.Pointer(bp + 16)) = -int32(1)
  6347. if !(_accountingDiffTolerated(tls, parser, int32(m_XML_TOK_XML_DECL), s, next, int32(4288), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  6348. _accountingOnAbort(tls, parser)
  6349. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6350. }
  6351. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  6352. v1 = XXmlParseXmlDeclNS
  6353. } else {
  6354. v1 = XXmlParseXmlDecl
  6355. }
  6356. if !(v1(tls, isGeneralTextEntity, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, next, parser+284, bp+8, bp+12, bp, bp+4, bp+16) != 0) {
  6357. if isGeneralTextEntity != 0 {
  6358. return int32(_XML_ERROR_TEXT_DECL)
  6359. } else {
  6360. return int32(_XML_ERROR_XML_DECL)
  6361. }
  6362. }
  6363. if !(isGeneralTextEntity != 0) && *(*int32)(unsafe.Pointer(bp + 16)) == int32(1) {
  6364. (*TDTD)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd)).Fstandalone = libc.Uint8FromInt32(1)
  6365. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing == int32(_XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE) {
  6366. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = int32(_XML_PARAM_ENTITY_PARSING_NEVER)
  6367. }
  6368. }
  6369. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler != 0 {
  6370. if *(*uintptr)(unsafe.Pointer(bp)) != libc.UintptrFromInt32(0) {
  6371. storedEncName = _poolStoreString(tls, parser+436, (*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)))))
  6372. if !(storedEncName != 0) {
  6373. return int32(_XML_ERROR_NO_MEMORY)
  6374. }
  6375. (*TSTRING_POOL)(unsafe.Pointer(parser + 436)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 436)).Fptr
  6376. }
  6377. if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 {
  6378. storedversion = _poolStoreString(tls, parser+436, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, *(*uintptr)(unsafe.Pointer(bp + 8)), *(*uintptr)(unsafe.Pointer(bp + 12))-uintptr((*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FminBytesPerChar))
  6379. if !(storedversion != 0) {
  6380. return int32(_XML_ERROR_NO_MEMORY)
  6381. }
  6382. }
  6383. (*(*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 + 16)))
  6384. } else {
  6385. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6386. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, next)
  6387. }
  6388. }
  6389. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName == libc.UintptrFromInt32(0) {
  6390. if *(*uintptr)(unsafe.Pointer(bp + 4)) != 0 {
  6391. /* Check that the specified encoding does not conflict with what
  6392. * the parser has already deduced. Do we have the same number
  6393. * of bytes in the smallest representation of a character? If
  6394. * this is UTF-16, is it the same endianness?
  6395. */
  6396. if (*TENCODING)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4)))).FminBytesPerChar != (*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FminBytesPerChar || (*TENCODING)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4)))).FminBytesPerChar == int32(2) && *(*uintptr)(unsafe.Pointer(bp + 4)) != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6397. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  6398. return int32(_XML_ERROR_INCORRECT_ENCODING)
  6399. }
  6400. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding = *(*uintptr)(unsafe.Pointer(bp + 4))
  6401. } else {
  6402. if *(*uintptr)(unsafe.Pointer(bp)) != 0 {
  6403. if !(storedEncName != 0) {
  6404. storedEncName = _poolStoreString(tls, parser+436, (*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)))))
  6405. if !(storedEncName != 0) {
  6406. return int32(_XML_ERROR_NO_MEMORY)
  6407. }
  6408. }
  6409. result = _handleUnknownEncoding(tls, parser, storedEncName)
  6410. _poolClear(tls, parser+436)
  6411. if result == int32(_XML_ERROR_UNKNOWN_ENCODING) {
  6412. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  6413. }
  6414. return result
  6415. }
  6416. }
  6417. }
  6418. if storedEncName != 0 || storedversion != 0 {
  6419. _poolClear(tls, parser+436)
  6420. }
  6421. return int32(_XML_ERROR_NONE)
  6422. }
  6423. func _handleUnknownEncoding(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) (r _XML_Error) {
  6424. bp := tls.Alloc(1040)
  6425. defer tls.Free(1040)
  6426. var enc uintptr
  6427. var i int32
  6428. var v2 func(*libc.TLS, uintptr, uintptr, TCONVERTER, uintptr) uintptr
  6429. var _ /* info at bp+0 */ TXML_Encoding
  6430. _, _, _ = enc, i, v2
  6431. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler != 0 {
  6432. i = 0
  6433. for {
  6434. if !(i < int32(256)) {
  6435. break
  6436. }
  6437. *(*int32)(unsafe.Pointer(bp + uintptr(i)*4)) = -int32(1)
  6438. goto _1
  6439. _1:
  6440. ;
  6441. i++
  6442. }
  6443. (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fconvert = libc.UintptrFromInt32(0)
  6444. (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata = libc.UintptrFromInt32(0)
  6445. (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease = libc.UintptrFromInt32(0)
  6446. 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 {
  6447. (*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.Uint32FromInt32(XXmlSizeOfUnknownEncoding(tls)))
  6448. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem != 0) {
  6449. if (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease != 0 {
  6450. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease})))(tls, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata)
  6451. }
  6452. return int32(_XML_ERROR_NO_MEMORY)
  6453. }
  6454. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  6455. v2 = XXmlInitUnknownEncodingNS
  6456. } else {
  6457. v2 = XXmlInitUnknownEncoding
  6458. }
  6459. enc = v2(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem, bp, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fconvert, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata)
  6460. if enc != 0 {
  6461. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData = (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata
  6462. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease = (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease
  6463. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding = enc
  6464. return int32(_XML_ERROR_NONE)
  6465. }
  6466. }
  6467. if (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease != libc.UintptrFromInt32(0) {
  6468. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease})))(tls, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata)
  6469. }
  6470. }
  6471. return int32(_XML_ERROR_UNKNOWN_ENCODING)
  6472. }
  6473. func _prologInitProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6474. var result _XML_Error
  6475. _ = result
  6476. result = _initializeEncoding(tls, parser)
  6477. if result != int32(_XML_ERROR_NONE) {
  6478. return result
  6479. }
  6480. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  6481. return _prologProcessor(tls, parser, s, end, nextPtr)
  6482. }
  6483. func _externalParEntInitProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6484. var result _XML_Error
  6485. _ = result
  6486. result = _initializeEncoding(tls, parser)
  6487. if result != int32(_XML_ERROR_NONE) {
  6488. return result
  6489. }
  6490. /* we know now that XML_Parse(Buffer) has been called,
  6491. so we consider the external parameter entity read */
  6492. (*TDTD)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd)).FparamEntityRead = libc.Uint8FromInt32(1)
  6493. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue != 0 {
  6494. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_entityValueInitProcessor)
  6495. return _entityValueInitProcessor(tls, parser, s, end, nextPtr)
  6496. } else {
  6497. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalParEntProcessor)
  6498. return _externalParEntProcessor(tls, parser, s, end, nextPtr)
  6499. }
  6500. return r
  6501. }
  6502. func _entityValueInitProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6503. bp := tls.Alloc(16)
  6504. defer tls.Free(16)
  6505. var result _XML_Error
  6506. var start uintptr
  6507. var tok int32
  6508. var _ /* next at bp+0 */ uintptr
  6509. _, _, _ = result, start, tok
  6510. start = s
  6511. *(*uintptr)(unsafe.Pointer(bp)) = start
  6512. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  6513. for {
  6514. 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)
  6515. /* Note: Except for XML_TOK_BOM below, these bytes are accounted later in:
  6516. - storeEntityValue
  6517. - processXmlDecl
  6518. */
  6519. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = *(*uintptr)(unsafe.Pointer(bp))
  6520. if tok <= 0 {
  6521. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) && tok != m_XML_TOK_INVALID {
  6522. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6523. return int32(_XML_ERROR_NONE)
  6524. }
  6525. switch tok {
  6526. case m_XML_TOK_INVALID:
  6527. return int32(_XML_ERROR_INVALID_TOKEN)
  6528. case -int32(1):
  6529. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6530. case -int32(2):
  6531. return int32(_XML_ERROR_PARTIAL_CHAR)
  6532. case -int32(4): /* start == end */
  6533. fallthrough
  6534. default:
  6535. break
  6536. }
  6537. /* found end of entity value - can store it now */
  6538. return _storeEntityValue(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, end, int32(_XML_ACCOUNT_DIRECT))
  6539. } else {
  6540. if tok == int32(m_XML_TOK_XML_DECL) {
  6541. result = _processXmlDecl(tls, parser, 0, start, *(*uintptr)(unsafe.Pointer(bp)))
  6542. if result != int32(_XML_ERROR_NONE) {
  6543. return result
  6544. }
  6545. /* At this point, m_parsingStatus.parsing cannot be XML_SUSPENDED. For
  6546. * that to happen, a parameter entity parsing handler must have attempted
  6547. * to suspend the parser, which fails and raises an error. The parser can
  6548. * be aborted, but can't be suspended.
  6549. */
  6550. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  6551. return int32(_XML_ERROR_ABORTED)
  6552. }
  6553. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6554. /* stop scanning for text declaration - we found one */
  6555. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_entityValueProcessor)
  6556. return _entityValueProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, nextPtr)
  6557. } else {
  6558. if tok == int32(m_XML_TOK_BOM) && *(*uintptr)(unsafe.Pointer(bp)) == end && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  6559. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4495), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  6560. _accountingOnAbort(tls, parser)
  6561. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6562. }
  6563. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6564. return int32(_XML_ERROR_NONE)
  6565. } else {
  6566. if tok == int32(m_XML_TOK_INSTANCE_START) {
  6567. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6568. return int32(_XML_ERROR_SYNTAX)
  6569. }
  6570. }
  6571. }
  6572. }
  6573. start = *(*uintptr)(unsafe.Pointer(bp))
  6574. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  6575. goto _1
  6576. _1:
  6577. }
  6578. return r
  6579. }
  6580. func _externalParEntProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6581. bp := tls.Alloc(16)
  6582. defer tls.Free(16)
  6583. var tok int32
  6584. var _ /* next at bp+0 */ uintptr
  6585. _ = tok
  6586. *(*uintptr)(unsafe.Pointer(bp)) = s
  6587. 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)
  6588. if tok <= 0 {
  6589. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) && tok != m_XML_TOK_INVALID {
  6590. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6591. return int32(_XML_ERROR_NONE)
  6592. }
  6593. switch tok {
  6594. case m_XML_TOK_INVALID:
  6595. return int32(_XML_ERROR_INVALID_TOKEN)
  6596. case -int32(1):
  6597. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6598. case -int32(2):
  6599. return int32(_XML_ERROR_PARTIAL_CHAR)
  6600. case -int32(4): /* start == end */
  6601. fallthrough
  6602. default:
  6603. break
  6604. }
  6605. } else {
  6606. if tok == int32(m_XML_TOK_BOM) {
  6607. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4548), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  6608. _accountingOnAbort(tls, parser)
  6609. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6610. }
  6611. s = *(*uintptr)(unsafe.Pointer(bp))
  6612. 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)
  6613. }
  6614. }
  6615. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  6616. 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))
  6617. }
  6618. func _entityValueProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6619. bp := tls.Alloc(16)
  6620. defer tls.Free(16)
  6621. var enc, start uintptr
  6622. var tok int32
  6623. var _ /* next at bp+0 */ uintptr
  6624. _, _, _ = enc, start, tok
  6625. start = s
  6626. *(*uintptr)(unsafe.Pointer(bp)) = s
  6627. enc = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding
  6628. for {
  6629. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc))})))(tls, enc, start, end, bp)
  6630. /* Note: These bytes are accounted later in:
  6631. - storeEntityValue
  6632. */
  6633. if tok <= 0 {
  6634. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) && tok != m_XML_TOK_INVALID {
  6635. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6636. return int32(_XML_ERROR_NONE)
  6637. }
  6638. switch tok {
  6639. case m_XML_TOK_INVALID:
  6640. return int32(_XML_ERROR_INVALID_TOKEN)
  6641. case -int32(1):
  6642. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6643. case -int32(2):
  6644. return int32(_XML_ERROR_PARTIAL_CHAR)
  6645. case -int32(4): /* start == end */
  6646. fallthrough
  6647. default:
  6648. break
  6649. }
  6650. /* found end of entity value - can store it now */
  6651. return _storeEntityValue(tls, parser, enc, s, end, int32(_XML_ACCOUNT_DIRECT))
  6652. }
  6653. start = *(*uintptr)(unsafe.Pointer(bp))
  6654. goto _1
  6655. _1:
  6656. }
  6657. return r
  6658. }
  6659. func _prologProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6660. bp := tls.Alloc(16)
  6661. defer tls.Free(16)
  6662. var tok int32
  6663. var _ /* next at bp+0 */ uintptr
  6664. _ = tok
  6665. *(*uintptr)(unsafe.Pointer(bp)) = s
  6666. 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)
  6667. 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))
  6668. }
  6669. 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) {
  6670. bp := tls.Alloc(16)
  6671. defer tls.Free(16)
  6672. *(*uintptr)(unsafe.Pointer(bp)) = _next
  6673. 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
  6674. var betweenDecl, hadParamEntityRefs, hadParamEntityRefs1, handleDefault TXML_Bool
  6675. var myindex, myindex1, role, v66, v69, v73, v76, v82, v84, v85 int32
  6676. var nameLen, v88 Tsize_t
  6677. var quant _XML_Content_Quant
  6678. var result, result1, result2, result3, result4, result5 _XML_Error
  6679. var v72, v79, v83 bool
  6680. var v81 uint32
  6681. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  6682. /* save one level of indirection */
  6683. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  6684. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6685. eventPP = parser + 284
  6686. eventEndPP = parser + 288
  6687. } else {
  6688. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  6689. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 4
  6690. }
  6691. for {
  6692. handleDefault = libc.Uint8FromInt32(1)
  6693. *(*uintptr)(unsafe.Pointer(eventPP)) = s
  6694. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6695. if tok <= 0 {
  6696. if haveMore != 0 && tok != m_XML_TOK_INVALID {
  6697. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6698. return int32(_XML_ERROR_NONE)
  6699. }
  6700. switch tok {
  6701. case m_XML_TOK_INVALID:
  6702. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6703. return int32(_XML_ERROR_INVALID_TOKEN)
  6704. case -int32(1):
  6705. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6706. case -int32(2):
  6707. return int32(_XML_ERROR_PARTIAL_CHAR)
  6708. case -int32(m_XML_TOK_PROLOG_S):
  6709. tok = -tok
  6710. case -int32(4):
  6711. /* for internal PE NOT referenced between declarations */
  6712. if enc != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding && !((*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities)).FbetweenDecl != 0) {
  6713. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6714. return int32(_XML_ERROR_NONE)
  6715. }
  6716. /* WFC: PE Between Declarations - must check that PE contains
  6717. complete markup, not only for external PEs, but also for
  6718. internal PEs if the reference occurs between declarations.
  6719. */
  6720. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0 || enc != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6721. if (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPROLOG_STATE)(unsafe.Pointer(parser + 252)).Fhandler})))(tls, parser+252, -int32(4), end, end, enc) == int32(_XML_ROLE_ERROR) {
  6722. return int32(_XML_ERROR_INCOMPLETE_PE)
  6723. }
  6724. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6725. return int32(_XML_ERROR_NONE)
  6726. }
  6727. return int32(_XML_ERROR_NO_ELEMENTS)
  6728. default:
  6729. tok = -tok
  6730. *(*uintptr)(unsafe.Pointer(bp)) = end
  6731. break
  6732. }
  6733. }
  6734. role = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPROLOG_STATE)(unsafe.Pointer(parser + 252)).Fhandler})))(tls, parser+252, tok, s, *(*uintptr)(unsafe.Pointer(bp)), enc)
  6735. switch role {
  6736. case int32(_XML_ROLE_INSTANCE_START): // bytes accounted in contentProcessor
  6737. fallthrough
  6738. case int32(_XML_ROLE_XML_DECL): // bytes accounted in processXmlDecl
  6739. fallthrough
  6740. case int32(_XML_ROLE_TEXT_DECL): // bytes accounted in processXmlDecl
  6741. default:
  6742. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4717), account) != 0) {
  6743. _accountingOnAbort(tls, parser)
  6744. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6745. }
  6746. }
  6747. switch role {
  6748. case int32(_XML_ROLE_XML_DECL):
  6749. goto _2
  6750. case int32(_XML_ROLE_DOCTYPE_NAME):
  6751. goto _3
  6752. case int32(_XML_ROLE_DOCTYPE_INTERNAL_SUBSET):
  6753. goto _4
  6754. case int32(_XML_ROLE_TEXT_DECL):
  6755. goto _5
  6756. case int32(_XML_ROLE_DOCTYPE_PUBLIC_ID):
  6757. goto _6
  6758. case int32(_XML_ROLE_ENTITY_PUBLIC_ID):
  6759. goto _7
  6760. case int32(_XML_ROLE_DOCTYPE_CLOSE):
  6761. goto _8
  6762. case int32(_XML_ROLE_INSTANCE_START):
  6763. goto _9
  6764. case int32(_XML_ROLE_ATTLIST_ELEMENT_NAME):
  6765. goto _10
  6766. case int32(_XML_ROLE_ATTRIBUTE_NAME):
  6767. goto _11
  6768. case int32(_XML_ROLE_ATTRIBUTE_TYPE_CDATA):
  6769. goto _12
  6770. case int32(_XML_ROLE_ATTRIBUTE_TYPE_ID):
  6771. goto _13
  6772. case int32(_XML_ROLE_ATTRIBUTE_TYPE_IDREF):
  6773. goto _14
  6774. case int32(_XML_ROLE_ATTRIBUTE_TYPE_IDREFS):
  6775. goto _15
  6776. case int32(_XML_ROLE_ATTRIBUTE_TYPE_ENTITY):
  6777. goto _16
  6778. case int32(_XML_ROLE_ATTRIBUTE_TYPE_ENTITIES):
  6779. goto _17
  6780. case int32(_XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN):
  6781. goto _18
  6782. case int32(_XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS):
  6783. goto _19
  6784. case int32(_XML_ROLE_ATTRIBUTE_NOTATION_VALUE):
  6785. goto _20
  6786. case int32(_XML_ROLE_ATTRIBUTE_ENUM_VALUE):
  6787. goto _21
  6788. case int32(_XML_ROLE_REQUIRED_ATTRIBUTE_VALUE):
  6789. goto _22
  6790. case int32(_XML_ROLE_IMPLIED_ATTRIBUTE_VALUE):
  6791. goto _23
  6792. case int32(_XML_ROLE_FIXED_ATTRIBUTE_VALUE):
  6793. goto _24
  6794. case int32(_XML_ROLE_DEFAULT_ATTRIBUTE_VALUE):
  6795. goto _25
  6796. case int32(_XML_ROLE_ENTITY_VALUE):
  6797. goto _26
  6798. case int32(_XML_ROLE_DOCTYPE_SYSTEM_ID):
  6799. goto _27
  6800. case int32(_XML_ROLE_ENTITY_SYSTEM_ID):
  6801. goto _28
  6802. case int32(_XML_ROLE_ENTITY_COMPLETE):
  6803. goto _29
  6804. case int32(_XML_ROLE_ENTITY_NOTATION_NAME):
  6805. goto _30
  6806. case int32(_XML_ROLE_GENERAL_ENTITY_NAME):
  6807. goto _31
  6808. case int32(_XML_ROLE_PARAM_ENTITY_NAME):
  6809. goto _32
  6810. case int32(_XML_ROLE_NOTATION_NAME):
  6811. goto _33
  6812. case int32(_XML_ROLE_NOTATION_PUBLIC_ID):
  6813. goto _34
  6814. case int32(_XML_ROLE_NOTATION_SYSTEM_ID):
  6815. goto _35
  6816. case int32(_XML_ROLE_NOTATION_NO_SYSTEM_ID):
  6817. goto _36
  6818. case int32(_XML_ROLE_ERROR):
  6819. goto _37
  6820. case int32(_XML_ROLE_IGNORE_SECT):
  6821. goto _38
  6822. case int32(_XML_ROLE_GROUP_OPEN):
  6823. goto _39
  6824. case int32(_XML_ROLE_GROUP_SEQUENCE):
  6825. goto _40
  6826. case int32(_XML_ROLE_GROUP_CHOICE):
  6827. goto _41
  6828. case int32(_XML_ROLE_INNER_PARAM_ENTITY_REF):
  6829. goto _42
  6830. case int32(_XML_ROLE_PARAM_ENTITY_REF):
  6831. goto _43
  6832. case int32(_XML_ROLE_ELEMENT_NAME):
  6833. goto _44
  6834. case int32(_XML_ROLE_CONTENT_EMPTY):
  6835. goto _45
  6836. case int32(_XML_ROLE_CONTENT_ANY):
  6837. goto _46
  6838. case int32(_XML_ROLE_CONTENT_PCDATA):
  6839. goto _47
  6840. case int32(_XML_ROLE_CONTENT_ELEMENT):
  6841. goto _48
  6842. case int32(_XML_ROLE_CONTENT_ELEMENT_OPT):
  6843. goto _49
  6844. case int32(_XML_ROLE_CONTENT_ELEMENT_REP):
  6845. goto _50
  6846. case int32(_XML_ROLE_CONTENT_ELEMENT_PLUS):
  6847. goto _51
  6848. case int32(_XML_ROLE_GROUP_CLOSE):
  6849. goto _52
  6850. case int32(_XML_ROLE_GROUP_CLOSE_OPT):
  6851. goto _53
  6852. case int32(_XML_ROLE_GROUP_CLOSE_REP):
  6853. goto _54
  6854. case int32(_XML_ROLE_GROUP_CLOSE_PLUS):
  6855. goto _55
  6856. case int32(_XML_ROLE_PI):
  6857. goto _56
  6858. case int32(_XML_ROLE_COMMENT):
  6859. goto _57
  6860. case int32(_XML_ROLE_NONE):
  6861. goto _58
  6862. case int32(_XML_ROLE_DOCTYPE_NONE):
  6863. goto _59
  6864. case int32(_XML_ROLE_ENTITY_NONE):
  6865. goto _60
  6866. case int32(_XML_ROLE_NOTATION_NONE):
  6867. goto _61
  6868. case int32(_XML_ROLE_ATTLIST_NONE):
  6869. goto _62
  6870. case int32(_XML_ROLE_ELEMENT_NONE):
  6871. goto _63
  6872. }
  6873. goto _64
  6874. _2:
  6875. ;
  6876. result = _processXmlDecl(tls, parser, 0, s, *(*uintptr)(unsafe.Pointer(bp)))
  6877. if result != int32(_XML_ERROR_NONE) {
  6878. return result
  6879. }
  6880. enc = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding
  6881. handleDefault = libc.Uint8FromInt32(0)
  6882. goto _64
  6883. _3:
  6884. ;
  6885. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  6886. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName = _poolStoreString(tls, parser+412, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6887. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName != 0) {
  6888. return int32(_XML_ERROR_NO_MEMORY)
  6889. }
  6890. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr
  6891. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid = libc.UintptrFromInt32(0)
  6892. handleDefault = libc.Uint8FromInt32(0)
  6893. }
  6894. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = libc.UintptrFromInt32(0) /* always initialize to NULL */
  6895. goto _64
  6896. _4:
  6897. ;
  6898. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  6899. (*(*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))
  6900. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName = libc.UintptrFromInt32(0)
  6901. _poolClear(tls, parser+412)
  6902. handleDefault = libc.Uint8FromInt32(0)
  6903. }
  6904. goto _64
  6905. _5:
  6906. ;
  6907. result1 = _processXmlDecl(tls, parser, int32(1), s, *(*uintptr)(unsafe.Pointer(bp)))
  6908. if result1 != int32(_XML_ERROR_NONE) {
  6909. return result1
  6910. }
  6911. enc = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding
  6912. handleDefault = libc.Uint8FromInt32(0)
  6913. goto _64
  6914. _6:
  6915. ;
  6916. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  6917. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd+132, uintptr(unsafe.Pointer(&_externalSubsetName)), uint32(36))
  6918. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  6919. return int32(_XML_ERROR_NO_MEMORY)
  6920. }
  6921. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  6922. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  6923. 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) {
  6924. return int32(_XML_ERROR_PUBLICID)
  6925. }
  6926. pubId = _poolStoreString(tls, parser+412, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  6927. if !(pubId != 0) {
  6928. return int32(_XML_ERROR_NO_MEMORY)
  6929. }
  6930. _normalizePublicId(tls, pubId)
  6931. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr
  6932. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid = pubId
  6933. handleDefault = libc.Uint8FromInt32(0)
  6934. goto alreadyChecked
  6935. }
  6936. /* fall through */
  6937. _7:
  6938. ;
  6939. 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) {
  6940. return int32(_XML_ERROR_PUBLICID)
  6941. }
  6942. goto alreadyChecked
  6943. alreadyChecked:
  6944. ;
  6945. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  6946. tem = _poolStoreString(tls, dtd+80, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  6947. if !(tem != 0) {
  6948. return int32(_XML_ERROR_NO_MEMORY)
  6949. }
  6950. _normalizePublicId(tls, tem)
  6951. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = tem
  6952. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr
  6953. /* Don't suppress the default handler if we fell through from
  6954. * the XML_ROLE_DOCTYPE_PUBLIC_ID case.
  6955. */
  6956. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 && role == int32(_XML_ROLE_ENTITY_PUBLIC_ID) {
  6957. handleDefault = libc.Uint8FromInt32(0)
  6958. }
  6959. }
  6960. goto _64
  6961. _8:
  6962. ;
  6963. if libc.Int32FromUint8(allowClosingDoctype) != libc.Int32FromUint8(libc.Uint8FromInt32(1)) {
  6964. /* Must not close doctype from within expanded parameter entities */
  6965. return int32(_XML_ERROR_INVALID_TOKEN)
  6966. }
  6967. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName != 0 {
  6968. (*(*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)
  6969. _poolClear(tls, parser+412)
  6970. handleDefault = libc.Uint8FromInt32(0)
  6971. }
  6972. /* parser->m_doctypeSysid will be non-NULL in the case of a previous
  6973. XML_ROLE_DOCTYPE_SYSTEM_ID, even if parser->m_startDoctypeDeclHandler
  6974. was not set, indicating an external subset
  6975. */
  6976. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid != 0 || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD != 0 {
  6977. hadParamEntityRefs = (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs
  6978. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  6979. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  6980. entity = _lookup(tls, parser, dtd+132, uintptr(unsafe.Pointer(&_externalSubsetName)), uint32(36))
  6981. if !(entity != 0) {
  6982. /* The external subset name "#" will have already been
  6983. * inserted into the hash table at the start of the
  6984. * external entity parsing, so no allocation will happen
  6985. * and lookup() cannot fail.
  6986. */
  6987. return int32(_XML_ERROR_NO_MEMORY) /* LCOV_EXCL_LINE */
  6988. }
  6989. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD != 0 {
  6990. (*TENTITY)(unsafe.Pointer(entity)).Fbase = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  6991. }
  6992. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  6993. 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) {
  6994. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  6995. }
  6996. if (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0 {
  6997. 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) {
  6998. return int32(_XML_ERROR_NOT_STANDALONE)
  6999. }
  7000. } else {
  7001. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid != 0) {
  7002. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = hadParamEntityRefs
  7003. }
  7004. }
  7005. /* end of DTD - no need to update dtd->keepProcessing */
  7006. }
  7007. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  7008. }
  7009. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler != 0 {
  7010. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg)
  7011. handleDefault = libc.Uint8FromInt32(0)
  7012. }
  7013. goto _64
  7014. _9:
  7015. ;
  7016. /* if there is no DOCTYPE declaration then now is the
  7017. last chance to read the foreign DTD
  7018. */
  7019. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD != 0 {
  7020. hadParamEntityRefs1 = (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs
  7021. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  7022. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  7023. entity1 = _lookup(tls, parser, dtd+132, uintptr(unsafe.Pointer(&_externalSubsetName)), uint32(36))
  7024. if !(entity1 != 0) {
  7025. return int32(_XML_ERROR_NO_MEMORY)
  7026. }
  7027. (*TENTITY)(unsafe.Pointer(entity1)).Fbase = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  7028. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  7029. 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) {
  7030. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  7031. }
  7032. if (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0 {
  7033. 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) {
  7034. return int32(_XML_ERROR_NOT_STANDALONE)
  7035. }
  7036. } else {
  7037. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = hadParamEntityRefs1
  7038. }
  7039. /* end of DTD - no need to update dtd->keepProcessing */
  7040. }
  7041. }
  7042. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_contentProcessor)
  7043. return _contentProcessor(tls, parser, s, end, nextPtr)
  7044. _10:
  7045. ;
  7046. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = _getElementType(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7047. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType != 0) {
  7048. return int32(_XML_ERROR_NO_MEMORY)
  7049. }
  7050. goto checkAttListDeclHandler
  7051. _11:
  7052. ;
  7053. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId = _getAttributeId(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7054. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId != 0) {
  7055. return int32(_XML_ERROR_NO_MEMORY)
  7056. }
  7057. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata = libc.Uint8FromInt32(0)
  7058. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = libc.UintptrFromInt32(0)
  7059. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId = libc.Uint8FromInt32(0)
  7060. goto checkAttListDeclHandler
  7061. _12:
  7062. ;
  7063. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata = libc.Uint8FromInt32(1)
  7064. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeCDATA))
  7065. goto checkAttListDeclHandler
  7066. _13:
  7067. ;
  7068. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId = libc.Uint8FromInt32(1)
  7069. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeID))
  7070. goto checkAttListDeclHandler
  7071. _14:
  7072. ;
  7073. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeIDREF))
  7074. goto checkAttListDeclHandler
  7075. _15:
  7076. ;
  7077. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeIDREFS))
  7078. goto checkAttListDeclHandler
  7079. _16:
  7080. ;
  7081. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeENTITY))
  7082. goto checkAttListDeclHandler
  7083. _17:
  7084. ;
  7085. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeENTITIES))
  7086. goto checkAttListDeclHandler
  7087. _18:
  7088. ;
  7089. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeNMTOKEN))
  7090. goto checkAttListDeclHandler
  7091. _19:
  7092. ;
  7093. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeNMTOKENS))
  7094. goto checkAttListDeclHandler
  7095. checkAttListDeclHandler:
  7096. ;
  7097. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 {
  7098. handleDefault = libc.Uint8FromInt32(0)
  7099. }
  7100. goto _64
  7101. _21:
  7102. ;
  7103. _20:
  7104. ;
  7105. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 {
  7106. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType != 0 {
  7107. prefix = uintptr(unsafe.Pointer(&_enumValueSep))
  7108. } else {
  7109. if role == int32(_XML_ROLE_ATTRIBUTE_NOTATION_VALUE) {
  7110. v65 = uintptr(unsafe.Pointer(&_notationPrefix))
  7111. } else {
  7112. v65 = uintptr(unsafe.Pointer(&_enumValueStart))
  7113. }
  7114. prefix = v65
  7115. }
  7116. if !(_poolAppendString(tls, parser+412, prefix) != 0) {
  7117. return int32(_XML_ERROR_NO_MEMORY)
  7118. }
  7119. if !(_poolAppend(tls, parser+412, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7120. return int32(_XML_ERROR_NO_MEMORY)
  7121. }
  7122. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  7123. handleDefault = libc.Uint8FromInt32(0)
  7124. }
  7125. goto _64
  7126. _23:
  7127. ;
  7128. _22:
  7129. ;
  7130. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7131. 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) {
  7132. return int32(_XML_ERROR_NO_MEMORY)
  7133. }
  7134. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType != 0 {
  7135. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_LPAREN) || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_N) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType + 1))) == int32(m_ASCII_O) {
  7136. /* Enumerated or Notation type */
  7137. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  7138. v66 = 0
  7139. } else {
  7140. v68 = parser + 412 + 12
  7141. v67 = *(*uintptr)(unsafe.Pointer(v68))
  7142. *(*uintptr)(unsafe.Pointer(v68))++
  7143. *(*TXML_Char)(unsafe.Pointer(v67)) = uint8(m_ASCII_RPAREN)
  7144. v66 = libc.Int32FromInt32(1)
  7145. }
  7146. if v72 = !(v66 != 0); !v72 {
  7147. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  7148. v69 = 0
  7149. } else {
  7150. v71 = parser + 412 + 12
  7151. v70 = *(*uintptr)(unsafe.Pointer(v71))
  7152. *(*uintptr)(unsafe.Pointer(v71))++
  7153. *(*TXML_Char)(unsafe.Pointer(v70)) = uint8('\000')
  7154. v69 = libc.Int32FromInt32(1)
  7155. }
  7156. }
  7157. if v72 || !(v69 != 0) {
  7158. return int32(_XML_ERROR_NO_MEMORY)
  7159. }
  7160. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  7161. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr
  7162. }
  7163. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7164. (*(*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)))
  7165. handleDefault = libc.Uint8FromInt32(0)
  7166. }
  7167. }
  7168. _poolClear(tls, parser+412)
  7169. goto _64
  7170. _25:
  7171. ;
  7172. _24:
  7173. ;
  7174. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7175. 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+80, int32(_XML_ACCOUNT_NONE))
  7176. if result2 != 0 {
  7177. return result2
  7178. }
  7179. attVal = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart
  7180. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr
  7181. /* ID attributes aren't allowed to have a default */
  7182. 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) {
  7183. return int32(_XML_ERROR_NO_MEMORY)
  7184. }
  7185. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType != 0 {
  7186. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_LPAREN) || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_N) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType + 1))) == int32(m_ASCII_O) {
  7187. /* Enumerated or Notation type */
  7188. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  7189. v73 = 0
  7190. } else {
  7191. v75 = parser + 412 + 12
  7192. v74 = *(*uintptr)(unsafe.Pointer(v75))
  7193. *(*uintptr)(unsafe.Pointer(v75))++
  7194. *(*TXML_Char)(unsafe.Pointer(v74)) = uint8(m_ASCII_RPAREN)
  7195. v73 = libc.Int32FromInt32(1)
  7196. }
  7197. if v79 = !(v73 != 0); !v79 {
  7198. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  7199. v76 = 0
  7200. } else {
  7201. v78 = parser + 412 + 12
  7202. v77 = *(*uintptr)(unsafe.Pointer(v78))
  7203. *(*uintptr)(unsafe.Pointer(v78))++
  7204. *(*TXML_Char)(unsafe.Pointer(v77)) = uint8('\000')
  7205. v76 = libc.Int32FromInt32(1)
  7206. }
  7207. }
  7208. if v79 || !(v76 != 0) {
  7209. return int32(_XML_ERROR_NO_MEMORY)
  7210. }
  7211. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  7212. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr
  7213. }
  7214. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7215. (*(*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)))
  7216. _poolClear(tls, parser+412)
  7217. handleDefault = libc.Uint8FromInt32(0)
  7218. }
  7219. }
  7220. goto _64
  7221. _26:
  7222. ;
  7223. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7224. 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))
  7225. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  7226. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FtextPtr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 104)).Fstart
  7227. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FtextLen = int32((*TSTRING_POOL)(unsafe.Pointer(dtd+104)).Fptr) - int32((*TSTRING_POOL)(unsafe.Pointer(dtd+104)).Fstart)
  7228. (*TSTRING_POOL)(unsafe.Pointer(dtd + 104)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 104)).Fptr
  7229. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7230. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7231. (*(*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))
  7232. handleDefault = libc.Uint8FromInt32(0)
  7233. }
  7234. } else {
  7235. (*TSTRING_POOL)(unsafe.Pointer(dtd + 104)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 104)).Fstart
  7236. }
  7237. if result3 != int32(_XML_ERROR_NONE) {
  7238. return result3
  7239. }
  7240. }
  7241. goto _64
  7242. _27:
  7243. ;
  7244. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  7245. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  7246. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  7247. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = _poolStoreString(tls, parser+412, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7248. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid == libc.UintptrFromInt32(0) {
  7249. return int32(_XML_ERROR_NO_MEMORY)
  7250. }
  7251. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr
  7252. handleDefault = libc.Uint8FromInt32(0)
  7253. } else {
  7254. /* use externalSubsetName to make parser->m_doctypeSysid non-NULL
  7255. for the case where no parser->m_startDoctypeDeclHandler is set */
  7256. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = uintptr(unsafe.Pointer(&_externalSubsetName))
  7257. }
  7258. 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) {
  7259. return int32(_XML_ERROR_NOT_STANDALONE)
  7260. }
  7261. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  7262. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd+132, uintptr(unsafe.Pointer(&_externalSubsetName)), uint32(36))
  7263. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  7264. return int32(_XML_ERROR_NO_MEMORY)
  7265. }
  7266. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = libc.UintptrFromInt32(0)
  7267. }
  7268. /* fall through */
  7269. _28:
  7270. ;
  7271. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  7272. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FsystemId = _poolStoreString(tls, dtd+80, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7273. if !((*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FsystemId != 0) {
  7274. return int32(_XML_ERROR_NO_MEMORY)
  7275. }
  7276. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fbase = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  7277. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr
  7278. /* Don't suppress the default handler if we fell through from
  7279. * the XML_ROLE_DOCTYPE_SYSTEM_ID case.
  7280. */
  7281. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 && role == int32(_XML_ROLE_ENTITY_SYSTEM_ID) {
  7282. handleDefault = libc.Uint8FromInt32(0)
  7283. }
  7284. }
  7285. goto _64
  7286. _29:
  7287. ;
  7288. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7289. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7290. (*(*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))
  7291. handleDefault = libc.Uint8FromInt32(0)
  7292. }
  7293. goto _64
  7294. _30:
  7295. ;
  7296. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  7297. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fnotation = _poolStoreString(tls, dtd+80, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7298. if !((*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fnotation != 0) {
  7299. return int32(_XML_ERROR_NO_MEMORY)
  7300. }
  7301. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr
  7302. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler != 0 {
  7303. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7304. (*(*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)
  7305. handleDefault = libc.Uint8FromInt32(0)
  7306. } else {
  7307. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7308. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7309. (*(*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)
  7310. handleDefault = libc.Uint8FromInt32(0)
  7311. }
  7312. }
  7313. }
  7314. goto _64
  7315. _31:
  7316. ;
  7317. 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 {
  7318. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7319. goto _64
  7320. }
  7321. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7322. name = _poolStoreString(tls, dtd+80, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7323. if !(name != 0) {
  7324. return int32(_XML_ERROR_NO_MEMORY)
  7325. }
  7326. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd, name, uint32(36))
  7327. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  7328. return int32(_XML_ERROR_NO_MEMORY)
  7329. }
  7330. if (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fname != name {
  7331. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart
  7332. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7333. } else {
  7334. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr
  7335. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = libc.UintptrFromInt32(0)
  7336. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fis_param = libc.Uint8FromInt32(0)
  7337. /* if we have a parent parser or are reading an internal parameter
  7338. entity, then the entity declaration is not considered "internal"
  7339. */
  7340. (*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))
  7341. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7342. handleDefault = libc.Uint8FromInt32(0)
  7343. }
  7344. }
  7345. } else {
  7346. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart
  7347. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7348. }
  7349. goto _64
  7350. _32:
  7351. ;
  7352. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7353. name1 = _poolStoreString(tls, dtd+80, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7354. if !(name1 != 0) {
  7355. return int32(_XML_ERROR_NO_MEMORY)
  7356. }
  7357. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd+132, name1, uint32(36))
  7358. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  7359. return int32(_XML_ERROR_NO_MEMORY)
  7360. }
  7361. if (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fname != name1 {
  7362. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart
  7363. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7364. } else {
  7365. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr
  7366. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = libc.UintptrFromInt32(0)
  7367. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fis_param = libc.Uint8FromInt32(1)
  7368. /* if we have a parent parser or are reading an internal parameter
  7369. entity, then the entity declaration is not considered "internal"
  7370. */
  7371. (*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))
  7372. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7373. handleDefault = libc.Uint8FromInt32(0)
  7374. }
  7375. }
  7376. } else {
  7377. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart
  7378. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7379. }
  7380. goto _64
  7381. _33:
  7382. ;
  7383. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId = libc.UintptrFromInt32(0)
  7384. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName = libc.UintptrFromInt32(0)
  7385. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  7386. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName = _poolStoreString(tls, parser+412, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7387. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName != 0) {
  7388. return int32(_XML_ERROR_NO_MEMORY)
  7389. }
  7390. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr
  7391. handleDefault = libc.Uint8FromInt32(0)
  7392. }
  7393. goto _64
  7394. _34:
  7395. ;
  7396. 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) {
  7397. return int32(_XML_ERROR_PUBLICID)
  7398. }
  7399. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName != 0 { /* means m_notationDeclHandler != NULL */
  7400. tem1 = _poolStoreString(tls, parser+412, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7401. if !(tem1 != 0) {
  7402. return int32(_XML_ERROR_NO_MEMORY)
  7403. }
  7404. _normalizePublicId(tls, tem1)
  7405. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId = tem1
  7406. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr
  7407. handleDefault = libc.Uint8FromInt32(0)
  7408. }
  7409. goto _64
  7410. _35:
  7411. ;
  7412. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  7413. systemId = _poolStoreString(tls, parser+412, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7414. if !(systemId != 0) {
  7415. return int32(_XML_ERROR_NO_MEMORY)
  7416. }
  7417. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7418. (*(*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)
  7419. handleDefault = libc.Uint8FromInt32(0)
  7420. }
  7421. _poolClear(tls, parser+412)
  7422. goto _64
  7423. _36:
  7424. ;
  7425. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  7426. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7427. (*(*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)
  7428. handleDefault = libc.Uint8FromInt32(0)
  7429. }
  7430. _poolClear(tls, parser+412)
  7431. goto _64
  7432. _37:
  7433. ;
  7434. switch tok {
  7435. case int32(m_XML_TOK_PARAM_ENTITY_REF):
  7436. /* PE references in internal subset are
  7437. not allowed within declarations. */
  7438. return int32(_XML_ERROR_PARAM_ENTITY_REF)
  7439. case int32(m_XML_TOK_XML_DECL):
  7440. return int32(_XML_ERROR_MISPLACED_XML_PI)
  7441. default:
  7442. return int32(_XML_ERROR_SYNTAX)
  7443. }
  7444. _38:
  7445. ;
  7446. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7447. _reportDefault(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7448. }
  7449. handleDefault = libc.Uint8FromInt32(0)
  7450. result4 = _doIgnoreSection(tls, parser, enc, bp, end, nextPtr, haveMore)
  7451. if result4 != int32(_XML_ERROR_NONE) {
  7452. return result4
  7453. } else {
  7454. if !(*(*uintptr)(unsafe.Pointer(bp)) != 0) {
  7455. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_ignoreSectionProcessor)
  7456. return result4
  7457. }
  7458. }
  7459. goto _64
  7460. _39:
  7461. ;
  7462. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel >= (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize {
  7463. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize != 0 {
  7464. /* Detect and prevent integer overflow */
  7465. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize > libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromUint32(2) {
  7466. return int32(_XML_ERROR_NO_MEMORY)
  7467. }
  7468. p80 = parser + 464
  7469. *(*uint32)(unsafe.Pointer(p80)) *= uint32(2)
  7470. 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, *(*uint32)(unsafe.Pointer(p80)))
  7471. if new_connector == libc.UintptrFromInt32(0) {
  7472. *(*uint32)(unsafe.Pointer(parser + 464)) /= uint32(2)
  7473. return int32(_XML_ERROR_NO_MEMORY)
  7474. }
  7475. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector = new_connector
  7476. if (*TDTD)(unsafe.Pointer(dtd)).FscaffIndex != 0 {
  7477. /* Detect and prevent integer overflow.
  7478. * The preprocessor guard addresses the "always false" warning
  7479. * from -Wtype-limits on platforms where
  7480. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  7481. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize > libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromInt64(4) {
  7482. return int32(_XML_ERROR_NO_MEMORY)
  7483. }
  7484. 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, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize*libc.Uint32FromInt64(4))
  7485. if new_scaff_index == libc.UintptrFromInt32(0) {
  7486. return int32(_XML_ERROR_NO_MEMORY)
  7487. }
  7488. (*TDTD)(unsafe.Pointer(dtd)).FscaffIndex = new_scaff_index
  7489. }
  7490. } else {
  7491. v81 = libc.Uint32FromInt32(32)
  7492. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize = v81
  7493. (*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, v81)
  7494. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector != 0) {
  7495. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize = uint32(0)
  7496. return int32(_XML_ERROR_NO_MEMORY)
  7497. }
  7498. }
  7499. }
  7500. *(*uint8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) = uint8(0)
  7501. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7502. myindex = _nextScaffoldPart(tls, parser)
  7503. if myindex < 0 {
  7504. return int32(_XML_ERROR_NO_MEMORY)
  7505. }
  7506. *(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel)*4)) = myindex
  7507. (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel++
  7508. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex)*28))).Ftype1 = int32(_XML_CTYPE_SEQ)
  7509. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7510. handleDefault = libc.Uint8FromInt32(0)
  7511. }
  7512. }
  7513. goto _64
  7514. _40:
  7515. ;
  7516. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel)))) == int32(m_ASCII_PIPE) {
  7517. return int32(_XML_ERROR_SYNTAX)
  7518. }
  7519. *(*uint8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) = uint8(m_ASCII_COMMA)
  7520. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7521. handleDefault = libc.Uint8FromInt32(0)
  7522. }
  7523. goto _64
  7524. _41:
  7525. ;
  7526. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel)))) == int32(m_ASCII_COMMA) {
  7527. return int32(_XML_ERROR_SYNTAX)
  7528. }
  7529. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 && !(*(*uint8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) != 0) && (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(*(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel-int32(1))*4)))*28))).Ftype1 != int32(_XML_CTYPE_MIXED) {
  7530. (*(*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)))*28))).Ftype1 = int32(_XML_CTYPE_CHOICE)
  7531. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7532. handleDefault = libc.Uint8FromInt32(0)
  7533. }
  7534. }
  7535. *(*uint8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) = uint8(m_ASCII_PIPE)
  7536. goto _64
  7537. _43:
  7538. ;
  7539. _42:
  7540. ;
  7541. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  7542. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0) {
  7543. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7544. } else {
  7545. name2 = _poolStoreString(tls, dtd+80, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7546. if !(name2 != 0) {
  7547. return int32(_XML_ERROR_NO_MEMORY)
  7548. }
  7549. entity2 = _lookup(tls, parser, dtd+132, name2, uint32(0))
  7550. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart
  7551. /* first, determine if a check for an existing declaration is needed;
  7552. if yes, check that the entity exists, and that it is internal,
  7553. otherwise call the skipped entity handler
  7554. */
  7555. if v83 = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FdocumentEntity != 0; v83 {
  7556. if (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0 {
  7557. v82 = libc.BoolInt32(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0))
  7558. } else {
  7559. v82 = libc.BoolInt32(!((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0))
  7560. }
  7561. }
  7562. if v83 && v82 != 0 {
  7563. if !(entity2 != 0) {
  7564. return int32(_XML_ERROR_UNDEFINED_ENTITY)
  7565. } else {
  7566. if !((*TENTITY)(unsafe.Pointer(entity2)).Fis_internal != 0) {
  7567. /* It's hard to exhaustively search the code to be sure,
  7568. * but there doesn't seem to be a way of executing the
  7569. * following line. There are two cases:
  7570. *
  7571. * If 'standalone' is false, the DTD must have no
  7572. * parameter entities or we wouldn't have passed the outer
  7573. * 'if' statement. That means the only entity in the hash
  7574. * table is the external subset name "#" which cannot be
  7575. * given as a parameter entity name in XML syntax, so the
  7576. * lookup must have returned NULL and we don't even reach
  7577. * the test for an internal entity.
  7578. *
  7579. * If 'standalone' is true, it does not seem to be
  7580. * possible to create entities taking this code path that
  7581. * are not internal entities, so fail the test above.
  7582. *
  7583. * Because this analysis is very uncertain, the code is
  7584. * being left in place and merely removed from the
  7585. * coverage test statistics.
  7586. */
  7587. return int32(_XML_ERROR_ENTITY_DECLARED_IN_PE) /* LCOV_EXCL_LINE */
  7588. }
  7589. }
  7590. } else {
  7591. if !(entity2 != 0) {
  7592. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7593. /* cannot report skipped entities in declarations */
  7594. if role == int32(_XML_ROLE_PARAM_ENTITY_REF) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler != 0 {
  7595. (*(*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))
  7596. handleDefault = libc.Uint8FromInt32(0)
  7597. }
  7598. goto _64
  7599. }
  7600. }
  7601. if (*TENTITY)(unsafe.Pointer(entity2)).Fopen != 0 {
  7602. return int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  7603. }
  7604. if (*TENTITY)(unsafe.Pointer(entity2)).FtextPtr != 0 {
  7605. if role == int32(_XML_ROLE_PARAM_ENTITY_REF) {
  7606. v84 = libc.Int32FromUint8(libc.Uint8FromInt32(1))
  7607. } else {
  7608. v84 = libc.Int32FromUint8(libc.Uint8FromInt32(0))
  7609. }
  7610. betweenDecl = libc.Uint8FromInt32(v84)
  7611. result5 = _processInternalEntity(tls, parser, entity2, betweenDecl)
  7612. if result5 != int32(_XML_ERROR_NONE) {
  7613. return result5
  7614. }
  7615. handleDefault = libc.Uint8FromInt32(0)
  7616. goto _64
  7617. }
  7618. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  7619. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  7620. (*TENTITY)(unsafe.Pointer(entity2)).Fopen = libc.Uint8FromInt32(1)
  7621. _entityTrackingOnOpen(tls, parser, entity2, int32(5439))
  7622. 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) {
  7623. _entityTrackingOnClose(tls, parser, entity2, int32(5443))
  7624. (*TENTITY)(unsafe.Pointer(entity2)).Fopen = libc.Uint8FromInt32(0)
  7625. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  7626. }
  7627. _entityTrackingOnClose(tls, parser, entity2, int32(5447))
  7628. (*TENTITY)(unsafe.Pointer(entity2)).Fopen = libc.Uint8FromInt32(0)
  7629. handleDefault = libc.Uint8FromInt32(0)
  7630. if !((*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0) {
  7631. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7632. goto _64
  7633. }
  7634. } else {
  7635. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7636. goto _64
  7637. }
  7638. }
  7639. 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) {
  7640. return int32(_XML_ERROR_NOT_STANDALONE)
  7641. }
  7642. goto _64
  7643. /* Element declaration stuff */
  7644. _44:
  7645. ;
  7646. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7647. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = _getElementType(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7648. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType != 0) {
  7649. return int32(_XML_ERROR_NO_MEMORY)
  7650. }
  7651. (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel = 0
  7652. (*TDTD)(unsafe.Pointer(dtd)).FscaffCount = uint32(0)
  7653. (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl = libc.Uint8FromInt32(1)
  7654. handleDefault = libc.Uint8FromInt32(0)
  7655. }
  7656. goto _64
  7657. _46:
  7658. ;
  7659. _45:
  7660. ;
  7661. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7662. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7663. content = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint32FromInt64(20))
  7664. if !(content != 0) {
  7665. return int32(_XML_ERROR_NO_MEMORY)
  7666. }
  7667. (*TXML_Content)(unsafe.Pointer(content)).Fquant = int32(_XML_CQUANT_NONE)
  7668. (*TXML_Content)(unsafe.Pointer(content)).Fname = libc.UintptrFromInt32(0)
  7669. (*TXML_Content)(unsafe.Pointer(content)).Fnumchildren = uint32(0)
  7670. (*TXML_Content)(unsafe.Pointer(content)).Fchildren = libc.UintptrFromInt32(0)
  7671. if role == int32(_XML_ROLE_CONTENT_ANY) {
  7672. v85 = int32(_XML_CTYPE_ANY)
  7673. } else {
  7674. v85 = int32(_XML_CTYPE_EMPTY)
  7675. }
  7676. (*TXML_Content)(unsafe.Pointer(content)).Ftype1 = v85
  7677. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7678. (*(*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)
  7679. handleDefault = libc.Uint8FromInt32(0)
  7680. }
  7681. (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl = libc.Uint8FromInt32(0)
  7682. }
  7683. goto _64
  7684. _47:
  7685. ;
  7686. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7687. (*(*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)))*28))).Ftype1 = int32(_XML_CTYPE_MIXED)
  7688. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7689. handleDefault = libc.Uint8FromInt32(0)
  7690. }
  7691. }
  7692. goto _64
  7693. _48:
  7694. ;
  7695. quant = int32(_XML_CQUANT_NONE)
  7696. goto elementContent
  7697. _49:
  7698. ;
  7699. quant = int32(_XML_CQUANT_OPT)
  7700. goto elementContent
  7701. _50:
  7702. ;
  7703. quant = int32(_XML_CQUANT_REP)
  7704. goto elementContent
  7705. _51:
  7706. ;
  7707. quant = int32(_XML_CQUANT_PLUS)
  7708. goto elementContent
  7709. elementContent:
  7710. ;
  7711. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7712. if quant == int32(_XML_CQUANT_NONE) {
  7713. v86 = *(*uintptr)(unsafe.Pointer(bp))
  7714. } else {
  7715. v86 = *(*uintptr)(unsafe.Pointer(bp)) - uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  7716. }
  7717. nxt = v86
  7718. myindex1 = _nextScaffoldPart(tls, parser)
  7719. if myindex1 < 0 {
  7720. return int32(_XML_ERROR_NO_MEMORY)
  7721. }
  7722. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex1)*28))).Ftype1 = int32(_XML_CTYPE_NAME)
  7723. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex1)*28))).Fquant = quant
  7724. el = _getElementType(tls, parser, enc, s, nxt)
  7725. if !(el != 0) {
  7726. return int32(_XML_ERROR_NO_MEMORY)
  7727. }
  7728. name3 = (*TELEMENT_TYPE)(unsafe.Pointer(el)).Fname
  7729. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex1)*28))).Fname = name3
  7730. nameLen = uint32(0)
  7731. for {
  7732. v88 = nameLen
  7733. nameLen++
  7734. if !(*(*TXML_Char)(unsafe.Pointer(name3 + uintptr(v88))) != 0) {
  7735. break
  7736. }
  7737. goto _87
  7738. _87:
  7739. }
  7740. /* Detect and prevent integer overflow */
  7741. if nameLen > uint32(0xffffffff)-(*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen {
  7742. return int32(_XML_ERROR_NO_MEMORY)
  7743. }
  7744. *(*uint32)(unsafe.Pointer(dtd + 168)) += nameLen
  7745. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7746. handleDefault = libc.Uint8FromInt32(0)
  7747. }
  7748. }
  7749. goto _64
  7750. _52:
  7751. ;
  7752. quant = int32(_XML_CQUANT_NONE)
  7753. goto closeGroup
  7754. _53:
  7755. ;
  7756. quant = int32(_XML_CQUANT_OPT)
  7757. goto closeGroup
  7758. _54:
  7759. ;
  7760. quant = int32(_XML_CQUANT_REP)
  7761. goto closeGroup
  7762. _55:
  7763. ;
  7764. quant = int32(_XML_CQUANT_PLUS)
  7765. goto closeGroup
  7766. closeGroup:
  7767. ;
  7768. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7769. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7770. handleDefault = libc.Uint8FromInt32(0)
  7771. }
  7772. (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel--
  7773. (*(*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)))*28))).Fquant = quant
  7774. if (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel == 0 {
  7775. if !(handleDefault != 0) {
  7776. model = _build_model(tls, parser)
  7777. if !(model != 0) {
  7778. return int32(_XML_ERROR_NO_MEMORY)
  7779. }
  7780. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7781. (*(*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)
  7782. }
  7783. (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl = libc.Uint8FromInt32(0)
  7784. (*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen = uint32(0)
  7785. }
  7786. }
  7787. goto _64
  7788. /* End element declaration stuff */
  7789. _56:
  7790. ;
  7791. if !(_reportProcessingInstruction(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7792. return int32(_XML_ERROR_NO_MEMORY)
  7793. }
  7794. handleDefault = libc.Uint8FromInt32(0)
  7795. goto _64
  7796. _57:
  7797. ;
  7798. if !(_reportComment(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7799. return int32(_XML_ERROR_NO_MEMORY)
  7800. }
  7801. handleDefault = libc.Uint8FromInt32(0)
  7802. goto _64
  7803. _58:
  7804. ;
  7805. switch tok {
  7806. case int32(m_XML_TOK_BOM):
  7807. handleDefault = libc.Uint8FromInt32(0)
  7808. break
  7809. }
  7810. goto _64
  7811. _59:
  7812. ;
  7813. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  7814. handleDefault = libc.Uint8FromInt32(0)
  7815. }
  7816. goto _64
  7817. _60:
  7818. ;
  7819. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7820. handleDefault = libc.Uint8FromInt32(0)
  7821. }
  7822. goto _64
  7823. _61:
  7824. ;
  7825. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  7826. handleDefault = libc.Uint8FromInt32(0)
  7827. }
  7828. goto _64
  7829. _62:
  7830. ;
  7831. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 {
  7832. handleDefault = libc.Uint8FromInt32(0)
  7833. }
  7834. goto _64
  7835. _63:
  7836. ;
  7837. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7838. handleDefault = libc.Uint8FromInt32(0)
  7839. }
  7840. goto _64
  7841. _64:
  7842. ; /* end of big switch */
  7843. if handleDefault != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7844. _reportDefault(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7845. }
  7846. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  7847. case int32(_XML_SUSPENDED):
  7848. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  7849. return int32(_XML_ERROR_NONE)
  7850. case int32(_XML_FINISHED):
  7851. return int32(_XML_ERROR_ABORTED)
  7852. default:
  7853. s = *(*uintptr)(unsafe.Pointer(bp))
  7854. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc))})))(tls, enc, s, end, bp)
  7855. }
  7856. goto _1
  7857. _1:
  7858. }
  7859. /* not reached */
  7860. return r
  7861. }
  7862. var _externalSubsetName = [2]TXML_Char{
  7863. 0: uint8(m_ASCII_HASH),
  7864. }
  7865. var _atypeCDATA = [6]TXML_Char{
  7866. 0: uint8(m_ASCII_C),
  7867. 1: uint8(m_ASCII_D),
  7868. 2: uint8(m_ASCII_A),
  7869. 3: uint8(m_ASCII_T),
  7870. 4: uint8(m_ASCII_A),
  7871. }
  7872. var _atypeID = [3]TXML_Char{
  7873. 0: uint8(m_ASCII_I),
  7874. 1: uint8(m_ASCII_D),
  7875. }
  7876. var _atypeIDREF = [6]TXML_Char{
  7877. 0: uint8(m_ASCII_I),
  7878. 1: uint8(m_ASCII_D),
  7879. 2: uint8(m_ASCII_R),
  7880. 3: uint8(m_ASCII_E),
  7881. 4: uint8(m_ASCII_F),
  7882. }
  7883. var _atypeIDREFS = [7]TXML_Char{
  7884. 0: uint8(m_ASCII_I),
  7885. 1: uint8(m_ASCII_D),
  7886. 2: uint8(m_ASCII_R),
  7887. 3: uint8(m_ASCII_E),
  7888. 4: uint8(m_ASCII_F),
  7889. 5: uint8(m_ASCII_S),
  7890. }
  7891. var _atypeENTITY = [7]TXML_Char{
  7892. 0: uint8(m_ASCII_E),
  7893. 1: uint8(m_ASCII_N),
  7894. 2: uint8(m_ASCII_T),
  7895. 3: uint8(m_ASCII_I),
  7896. 4: uint8(m_ASCII_T),
  7897. 5: uint8(m_ASCII_Y),
  7898. }
  7899. var _atypeENTITIES = [9]TXML_Char{
  7900. 0: uint8(m_ASCII_E),
  7901. 1: uint8(m_ASCII_N),
  7902. 2: uint8(m_ASCII_T),
  7903. 3: uint8(m_ASCII_I),
  7904. 4: uint8(m_ASCII_T),
  7905. 5: uint8(m_ASCII_I),
  7906. 6: uint8(m_ASCII_E),
  7907. 7: uint8(m_ASCII_S),
  7908. }
  7909. var _atypeNMTOKEN = [8]TXML_Char{
  7910. 0: uint8(m_ASCII_N),
  7911. 1: uint8(m_ASCII_M),
  7912. 2: uint8(m_ASCII_T),
  7913. 3: uint8(m_ASCII_O),
  7914. 4: uint8(m_ASCII_K),
  7915. 5: uint8(m_ASCII_E),
  7916. 6: uint8(m_ASCII_N),
  7917. }
  7918. var _atypeNMTOKENS = [9]TXML_Char{
  7919. 0: uint8(m_ASCII_N),
  7920. 1: uint8(m_ASCII_M),
  7921. 2: uint8(m_ASCII_T),
  7922. 3: uint8(m_ASCII_O),
  7923. 4: uint8(m_ASCII_K),
  7924. 5: uint8(m_ASCII_E),
  7925. 6: uint8(m_ASCII_N),
  7926. 7: uint8(m_ASCII_S),
  7927. }
  7928. var _notationPrefix = [10]TXML_Char{
  7929. 0: uint8(m_ASCII_N),
  7930. 1: uint8(m_ASCII_O),
  7931. 2: uint8(m_ASCII_T),
  7932. 3: uint8(m_ASCII_A),
  7933. 4: uint8(m_ASCII_T),
  7934. 5: uint8(m_ASCII_I),
  7935. 6: uint8(m_ASCII_O),
  7936. 7: uint8(m_ASCII_N),
  7937. 8: uint8(m_ASCII_LPAREN),
  7938. }
  7939. var _enumValueSep = [2]TXML_Char{
  7940. 0: uint8(m_ASCII_PIPE),
  7941. }
  7942. var _enumValueStart = [2]TXML_Char{
  7943. 0: uint8(m_ASCII_LPAREN),
  7944. }
  7945. func _epilogProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  7946. bp := tls.Alloc(16)
  7947. defer tls.Free(16)
  7948. var tok int32
  7949. var v2 uintptr
  7950. var _ /* next at bp+0 */ uintptr
  7951. _, _ = tok, v2
  7952. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_epilogProcessor)
  7953. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = s
  7954. for {
  7955. *(*uintptr)(unsafe.Pointer(bp)) = libc.UintptrFromInt32(0)
  7956. 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)
  7957. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(5652), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  7958. _accountingOnAbort(tls, parser)
  7959. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  7960. }
  7961. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = *(*uintptr)(unsafe.Pointer(bp))
  7962. switch tok {
  7963. /* report partial linebreak - it might be the last token */
  7964. case -int32(m_XML_TOK_PROLOG_S):
  7965. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7966. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp)))
  7967. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  7968. return int32(_XML_ERROR_ABORTED)
  7969. }
  7970. }
  7971. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  7972. return int32(_XML_ERROR_NONE)
  7973. case -int32(4):
  7974. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  7975. return int32(_XML_ERROR_NONE)
  7976. case int32(m_XML_TOK_PROLOG_S):
  7977. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7978. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp)))
  7979. }
  7980. case int32(m_XML_TOK_PI):
  7981. if !(_reportProcessingInstruction(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7982. return int32(_XML_ERROR_NO_MEMORY)
  7983. }
  7984. case int32(m_XML_TOK_COMMENT):
  7985. if !(_reportComment(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7986. return int32(_XML_ERROR_NO_MEMORY)
  7987. }
  7988. case m_XML_TOK_INVALID:
  7989. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  7990. return int32(_XML_ERROR_INVALID_TOKEN)
  7991. case -int32(1):
  7992. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  7993. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  7994. return int32(_XML_ERROR_NONE)
  7995. }
  7996. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  7997. case -int32(2):
  7998. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  7999. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  8000. return int32(_XML_ERROR_NONE)
  8001. }
  8002. return int32(_XML_ERROR_PARTIAL_CHAR)
  8003. default:
  8004. return int32(_XML_ERROR_JUNK_AFTER_DOC_ELEMENT)
  8005. }
  8006. v2 = *(*uintptr)(unsafe.Pointer(bp))
  8007. s = v2
  8008. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = v2
  8009. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  8010. case int32(_XML_SUSPENDED):
  8011. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  8012. return int32(_XML_ERROR_NONE)
  8013. case int32(_XML_FINISHED):
  8014. return int32(_XML_ERROR_ABORTED)
  8015. default:
  8016. }
  8017. goto _1
  8018. _1:
  8019. }
  8020. return r
  8021. }
  8022. func _processInternalEntity(tls *libc.TLS, parser TXML_Parser, entity uintptr, betweenDecl TXML_Bool) (r _XML_Error) {
  8023. bp := tls.Alloc(16)
  8024. defer tls.Free(16)
  8025. var openEntity, textEnd, textStart uintptr
  8026. var result _XML_Error
  8027. var tok int32
  8028. var _ /* next at bp+0 */ uintptr
  8029. _, _, _, _, _ = openEntity, result, textEnd, textStart, tok
  8030. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities != 0 {
  8031. openEntity = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  8032. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  8033. } else {
  8034. openEntity = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint32FromInt64(24))
  8035. if !(openEntity != 0) {
  8036. return int32(_XML_ERROR_NO_MEMORY)
  8037. }
  8038. }
  8039. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  8040. _entityTrackingOnOpen(tls, parser, entity, int32(5732))
  8041. (*TENTITY)(unsafe.Pointer(entity)).Fprocessed = 0
  8042. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  8043. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = openEntity
  8044. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fentity = entity
  8045. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FstartTagLevel = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel
  8046. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FbetweenDecl = betweenDecl
  8047. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FinternalEventPtr = libc.UintptrFromInt32(0)
  8048. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FinternalEventEndPtr = libc.UintptrFromInt32(0)
  8049. textStart = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr
  8050. textEnd = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen)
  8051. /* Set a safe default value in case 'next' does not get set */
  8052. *(*uintptr)(unsafe.Pointer(bp)) = textStart
  8053. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  8054. 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)
  8055. 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))
  8056. } else {
  8057. 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))
  8058. }
  8059. if result == int32(_XML_ERROR_NONE) {
  8060. if textEnd != *(*uintptr)(unsafe.Pointer(bp)) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  8061. (*TENTITY)(unsafe.Pointer(entity)).Fprocessed = int32(*(*uintptr)(unsafe.Pointer(bp))) - int32(textStart)
  8062. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_internalEntityProcessor)
  8063. } else {
  8064. _entityTrackingOnClose(tls, parser, entity, int32(5766))
  8065. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8066. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  8067. /* put openEntity back in list of free instances */
  8068. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  8069. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = openEntity
  8070. }
  8071. }
  8072. return result
  8073. }
  8074. func _internalEntityProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  8075. bp := tls.Alloc(16)
  8076. defer tls.Free(16)
  8077. var entity, openEntity, textEnd, textStart uintptr
  8078. var result _XML_Error
  8079. var tok, tok1, v1 int32
  8080. var _ /* next at bp+0 */ uintptr
  8081. _, _, _, _, _, _, _, _ = entity, openEntity, result, textEnd, textStart, tok, tok1, v1
  8082. openEntity = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  8083. if !(openEntity != 0) {
  8084. return int32(_XML_ERROR_UNEXPECTED_STATE)
  8085. }
  8086. entity = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fentity
  8087. textStart = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).Fprocessed)
  8088. textEnd = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen)
  8089. /* Set a safe default value in case 'next' does not get set */
  8090. *(*uintptr)(unsafe.Pointer(bp)) = textStart
  8091. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  8092. 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)
  8093. 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))
  8094. } else {
  8095. 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))
  8096. }
  8097. if result != int32(_XML_ERROR_NONE) {
  8098. return result
  8099. }
  8100. if textEnd != *(*uintptr)(unsafe.Pointer(bp)) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  8101. (*TENTITY)(unsafe.Pointer(entity)).Fprocessed = int32(*(*uintptr)(unsafe.Pointer(bp))) - int32((*TENTITY)(unsafe.Pointer(entity)).FtextPtr)
  8102. return result
  8103. }
  8104. _entityTrackingOnClose(tls, parser, entity, int32(5817))
  8105. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8106. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  8107. /* put openEntity back in list of free instances */
  8108. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  8109. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = openEntity
  8110. // If there are more open entities we want to stop right here and have the
  8111. // upcoming call to XML_ResumeParser continue with entity content, or it would
  8112. // be ignored altogether.
  8113. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != libc.UintptrFromInt32(0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  8114. return int32(_XML_ERROR_NONE)
  8115. }
  8116. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  8117. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  8118. 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)
  8119. 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))
  8120. } else {
  8121. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_contentProcessor)
  8122. /* see externalEntityContentProcessor vs contentProcessor */
  8123. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 {
  8124. v1 = int32(1)
  8125. } else {
  8126. v1 = 0
  8127. }
  8128. 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))
  8129. if result == int32(_XML_ERROR_NONE) {
  8130. if !(_storeRawNames(tls, parser) != 0) {
  8131. return int32(_XML_ERROR_NO_MEMORY)
  8132. }
  8133. }
  8134. return result
  8135. }
  8136. return r
  8137. }
  8138. func _errorProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  8139. _ = s
  8140. _ = end
  8141. _ = nextPtr
  8142. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode
  8143. }
  8144. 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) {
  8145. var result _XML_Error
  8146. var v1 int32
  8147. var v2, v3 uintptr
  8148. _, _, _, _ = result, v1, v2, v3
  8149. result = _appendAttributeValue(tls, parser, enc, isCdata, ptr, end, pool, account)
  8150. if result != 0 {
  8151. return result
  8152. }
  8153. if !(isCdata != 0) && int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart) != 0 && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20) {
  8154. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr--
  8155. }
  8156. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  8157. v1 = 0
  8158. } else {
  8159. v3 = pool + 12
  8160. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8161. *(*uintptr)(unsafe.Pointer(v3))++
  8162. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8('\000')
  8163. v1 = libc.Int32FromInt32(1)
  8164. }
  8165. if !(v1 != 0) {
  8166. return int32(_XML_ERROR_NO_MEMORY)
  8167. }
  8168. return int32(_XML_ERROR_NONE)
  8169. }
  8170. 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) {
  8171. bp := tls.Alloc(16)
  8172. defer tls.Free(16)
  8173. var checkEntityDecl uint8
  8174. var dtd, entity, name, textEnd, v10, v11, v4, v5, v7, v8 uintptr
  8175. var i, n, tok, v12, v3, v6, v9 int32
  8176. var result _XML_Error
  8177. var v13 bool
  8178. var _ /* buf at bp+4 */ [4]TXML_Char
  8179. var _ /* ch at bp+8 */ TXML_Char
  8180. var _ /* next at bp+0 */ uintptr
  8181. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = checkEntityDecl, dtd, entity, i, n, name, result, textEnd, tok, v10, v11, v12, v13, v3, v4, v5, v6, v7, v8, v9
  8182. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  8183. for {
  8184. *(*uintptr)(unsafe.Pointer(bp)) = ptr /* XmlAttributeValueTok doesn't always set the last arg */
  8185. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 16))})))(tls, enc, ptr, end, bp)
  8186. if !(_accountingDiffTolerated(tls, parser, tok, ptr, *(*uintptr)(unsafe.Pointer(bp)), int32(5896), account) != 0) {
  8187. _accountingOnAbort(tls, parser)
  8188. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  8189. }
  8190. switch tok {
  8191. case -int32(4):
  8192. return int32(_XML_ERROR_NONE)
  8193. case m_XML_TOK_INVALID:
  8194. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8195. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  8196. }
  8197. return int32(_XML_ERROR_INVALID_TOKEN)
  8198. case -int32(1):
  8199. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8200. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8201. }
  8202. return int32(_XML_ERROR_INVALID_TOKEN)
  8203. case int32(m_XML_TOK_CHAR_REF):
  8204. n = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FcharRefNumber})))(tls, enc, ptr)
  8205. if n < 0 {
  8206. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8207. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8208. }
  8209. return int32(_XML_ERROR_BAD_CHAR_REF)
  8210. }
  8211. if !(isCdata != 0) && n == int32(0x20) && (int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart) == 0 || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20)) {
  8212. break
  8213. }
  8214. n = XXmlUtf8Encode(tls, n, bp+4)
  8215. /* The XmlEncode() functions can never return 0 here. That
  8216. * error return happens if the code point passed in is either
  8217. * negative or greater than or equal to 0x110000. The
  8218. * XmlCharRefNumber() functions will all return a number
  8219. * strictly less than 0x110000 or a negative value if an error
  8220. * occurred. The negative value is intercepted above, so
  8221. * XmlEncode() is never passed a value it might return an
  8222. * error for.
  8223. */
  8224. i = 0
  8225. for {
  8226. if !(i < n) {
  8227. break
  8228. }
  8229. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  8230. v3 = 0
  8231. } else {
  8232. v5 = pool + 12
  8233. v4 = *(*uintptr)(unsafe.Pointer(v5))
  8234. *(*uintptr)(unsafe.Pointer(v5))++
  8235. *(*TXML_Char)(unsafe.Pointer(v4)) = (*(*[4]TXML_Char)(unsafe.Pointer(bp + 4)))[i]
  8236. v3 = libc.Int32FromInt32(1)
  8237. }
  8238. if !(v3 != 0) {
  8239. return int32(_XML_ERROR_NO_MEMORY)
  8240. }
  8241. goto _2
  8242. _2:
  8243. ;
  8244. i++
  8245. }
  8246. case int32(m_XML_TOK_DATA_CHARS):
  8247. if !(_poolAppend(tls, pool, enc, ptr, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  8248. return int32(_XML_ERROR_NO_MEMORY)
  8249. }
  8250. case -int32(3):
  8251. *(*uintptr)(unsafe.Pointer(bp)) = ptr + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  8252. /* fall through */
  8253. fallthrough
  8254. case int32(m_XML_TOK_ATTRIBUTE_VALUE_S):
  8255. fallthrough
  8256. case int32(m_XML_TOK_DATA_NEWLINE):
  8257. if !(isCdata != 0) && (int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart) == 0 || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20)) {
  8258. break
  8259. }
  8260. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  8261. v6 = 0
  8262. } else {
  8263. v8 = pool + 12
  8264. v7 = *(*uintptr)(unsafe.Pointer(v8))
  8265. *(*uintptr)(unsafe.Pointer(v8))++
  8266. *(*TXML_Char)(unsafe.Pointer(v7)) = uint8(0x20)
  8267. v6 = libc.Int32FromInt32(1)
  8268. }
  8269. if !(v6 != 0) {
  8270. return int32(_XML_ERROR_NO_MEMORY)
  8271. }
  8272. case int32(m_XML_TOK_ENTITY_REF):
  8273. *(*TXML_Char)(unsafe.Pointer(bp + 8)) = libc.Uint8FromInt32((*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FpredefinedEntityName})))(tls, enc, ptr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)))
  8274. if *(*TXML_Char)(unsafe.Pointer(bp + 8)) != 0 {
  8275. /* NOTE: We are replacing 4-6 characters original input for 1 character
  8276. * so there is no amplification and hence recording without
  8277. * protection. */
  8278. _accountingDiffTolerated(tls, parser, tok, bp+8, bp+8+uintptr(1), int32(5965), int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  8279. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  8280. v9 = 0
  8281. } else {
  8282. v11 = pool + 12
  8283. v10 = *(*uintptr)(unsafe.Pointer(v11))
  8284. *(*uintptr)(unsafe.Pointer(v11))++
  8285. *(*TXML_Char)(unsafe.Pointer(v10)) = *(*TXML_Char)(unsafe.Pointer(bp + 8))
  8286. v9 = libc.Int32FromInt32(1)
  8287. }
  8288. if !(v9 != 0) {
  8289. return int32(_XML_ERROR_NO_MEMORY)
  8290. }
  8291. break
  8292. }
  8293. name = _poolStoreString(tls, parser+436, enc, ptr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  8294. if !(name != 0) {
  8295. return int32(_XML_ERROR_NO_MEMORY)
  8296. }
  8297. entity = _lookup(tls, parser, dtd, name, uint32(0))
  8298. (*TSTRING_POOL)(unsafe.Pointer(parser + 436)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 436)).Fstart
  8299. /* First, determine if a check for an existing declaration is needed;
  8300. if yes, check that the entity exists, and that it is internal.
  8301. */
  8302. if pool == dtd+80 { /* are we called from prolog? */
  8303. if v13 = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FdocumentEntity != 0; v13 {
  8304. if (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0 {
  8305. v12 = libc.BoolInt32(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0))
  8306. } else {
  8307. v12 = libc.BoolInt32(!((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0))
  8308. }
  8309. }
  8310. checkEntityDecl = libc.BoolUint8(v13 && v12 != 0)
  8311. } else { /* if (pool == &parser->m_tempPool): we are called from content */
  8312. checkEntityDecl = libc.BoolUint8(!((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0) || (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0)
  8313. }
  8314. if checkEntityDecl != 0 {
  8315. if !(entity != 0) {
  8316. return int32(_XML_ERROR_UNDEFINED_ENTITY)
  8317. } else {
  8318. if !((*TENTITY)(unsafe.Pointer(entity)).Fis_internal != 0) {
  8319. return int32(_XML_ERROR_ENTITY_DECLARED_IN_PE)
  8320. }
  8321. }
  8322. } else {
  8323. if !(entity != 0) {
  8324. /* Cannot report skipped entity here - see comments on
  8325. parser->m_skippedEntityHandler.
  8326. if (parser->m_skippedEntityHandler)
  8327. parser->m_skippedEntityHandler(parser->m_handlerArg, name, 0);
  8328. */
  8329. /* Cannot call the default handler because this would be
  8330. out of sync with the call to the startElementHandler.
  8331. if ((pool == &parser->m_tempPool) && parser->m_defaultHandler)
  8332. reportDefault(parser, enc, ptr, next);
  8333. */
  8334. break
  8335. }
  8336. }
  8337. if (*TENTITY)(unsafe.Pointer(entity)).Fopen != 0 {
  8338. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8339. /* It does not appear that this line can be executed.
  8340. *
  8341. * The "if (entity->open)" check catches recursive entity
  8342. * definitions. In order to be called with an open
  8343. * entity, it must have gone through this code before and
  8344. * been through the recursive call to
  8345. * appendAttributeValue() some lines below. That call
  8346. * sets the local encoding ("enc") to the parser's
  8347. * internal encoding (internal_utf8 or internal_utf16),
  8348. * which can never be the same as the principle encoding.
  8349. * It doesn't appear there is another code path that gets
  8350. * here with entity->open being TRUE.
  8351. *
  8352. * Since it is not certain that this logic is watertight,
  8353. * we keep the line and merely exclude it from coverage
  8354. * tests.
  8355. */
  8356. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr /* LCOV_EXCL_LINE */
  8357. }
  8358. return int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  8359. }
  8360. if (*TENTITY)(unsafe.Pointer(entity)).Fnotation != 0 {
  8361. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8362. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8363. }
  8364. return int32(_XML_ERROR_BINARY_ENTITY_REF)
  8365. }
  8366. if !((*TENTITY)(unsafe.Pointer(entity)).FtextPtr != 0) {
  8367. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8368. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8369. }
  8370. return int32(_XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF)
  8371. } else {
  8372. textEnd = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen)
  8373. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  8374. _entityTrackingOnOpen(tls, parser, entity, int32(6046))
  8375. result = _appendAttributeValue(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding, isCdata, (*TENTITY)(unsafe.Pointer(entity)).FtextPtr, textEnd, pool, int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  8376. _entityTrackingOnClose(tls, parser, entity, int32(6053))
  8377. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8378. if result != 0 {
  8379. return result
  8380. }
  8381. }
  8382. default:
  8383. /* The only token returned by XmlAttributeValueTok() that does
  8384. * not have an explicit case here is XML_TOK_PARTIAL_CHAR.
  8385. * Getting that would require an entity name to contain an
  8386. * incomplete XML character (e.g. \xE2\x82); however previous
  8387. * tokenisers will have already recognised and rejected such
  8388. * names before XmlAttributeValueTok() gets a look-in. This
  8389. * default case should be retained as a safety net, but the code
  8390. * excluded from coverage tests.
  8391. *
  8392. * LCOV_EXCL_START
  8393. */
  8394. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8395. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8396. }
  8397. return int32(_XML_ERROR_UNEXPECTED_STATE)
  8398. /* LCOV_EXCL_STOP */
  8399. }
  8400. ptr = *(*uintptr)(unsafe.Pointer(bp))
  8401. goto _1
  8402. _1:
  8403. }
  8404. /* not reached */
  8405. return r
  8406. }
  8407. func _storeEntityValue(tls *libc.TLS, parser TXML_Parser, enc uintptr, entityTextPtr uintptr, entityTextEnd uintptr, account _XML_Account) (r _XML_Error) {
  8408. bp := tls.Alloc(16)
  8409. defer tls.Free(16)
  8410. var dtd, entity, name, pool, v2, v3, v5, v6 uintptr
  8411. var i, n, oldInEntityValue, tok int32
  8412. var result _XML_Error
  8413. var _ /* buf at bp+4 */ [4]TXML_Char
  8414. var _ /* next at bp+0 */ uintptr
  8415. _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, entity, i, n, name, oldInEntityValue, pool, result, tok, v2, v3, v5, v6
  8416. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  8417. pool = dtd + 104
  8418. result = int32(_XML_ERROR_NONE)
  8419. oldInEntityValue = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue
  8420. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue = int32(1)
  8421. /* never return Null for the value argument in EntityDeclHandler,
  8422. since this would indicate an external entity; therefore we
  8423. have to make sure that entityValuePool.start is not null */
  8424. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks != 0) {
  8425. if !(_poolGrow(tls, pool) != 0) {
  8426. return int32(_XML_ERROR_NO_MEMORY)
  8427. }
  8428. }
  8429. for {
  8430. *(*uintptr)(unsafe.Pointer(bp)) = entityTextPtr /* XmlEntityValueTok doesn't always set the last arg */
  8431. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 16 + 1*4))})))(tls, enc, entityTextPtr, entityTextEnd, bp)
  8432. if !(_accountingDiffTolerated(tls, parser, tok, entityTextPtr, *(*uintptr)(unsafe.Pointer(bp)), int32(6109), account) != 0) {
  8433. _accountingOnAbort(tls, parser)
  8434. result = int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  8435. goto endEntityValue
  8436. }
  8437. switch tok {
  8438. case int32(m_XML_TOK_PARAM_ENTITY_REF):
  8439. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0 || enc != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8440. name = _poolStoreString(tls, parser+412, enc, entityTextPtr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  8441. if !(name != 0) {
  8442. result = int32(_XML_ERROR_NO_MEMORY)
  8443. goto endEntityValue
  8444. }
  8445. entity = _lookup(tls, parser, dtd+132, name, uint32(0))
  8446. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart
  8447. if !(entity != 0) {
  8448. /* not a well-formedness error - see XML 1.0: WFC Entity Declared */
  8449. /* cannot report skipped entity here - see comments on
  8450. parser->m_skippedEntityHandler
  8451. if (parser->m_skippedEntityHandler)
  8452. parser->m_skippedEntityHandler(parser->m_handlerArg, name, 0);
  8453. */
  8454. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  8455. goto endEntityValue
  8456. }
  8457. if (*TENTITY)(unsafe.Pointer(entity)).Fopen != 0 {
  8458. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8459. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8460. }
  8461. result = int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  8462. goto endEntityValue
  8463. }
  8464. if (*TENTITY)(unsafe.Pointer(entity)).FsystemId != 0 {
  8465. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  8466. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  8467. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  8468. _entityTrackingOnOpen(tls, parser, entity, int32(6152))
  8469. 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) {
  8470. _entityTrackingOnClose(tls, parser, entity, int32(6156))
  8471. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8472. result = int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  8473. goto endEntityValue
  8474. }
  8475. _entityTrackingOnClose(tls, parser, entity, int32(6161))
  8476. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8477. if !((*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0) {
  8478. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  8479. }
  8480. } else {
  8481. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  8482. }
  8483. } else {
  8484. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  8485. _entityTrackingOnOpen(tls, parser, entity, int32(6169))
  8486. 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))
  8487. _entityTrackingOnClose(tls, parser, entity, int32(6174))
  8488. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8489. if result != 0 {
  8490. goto endEntityValue
  8491. }
  8492. }
  8493. break
  8494. }
  8495. /* In the internal subset, PE references are not legal
  8496. within markup declarations, e.g entity values in this case. */
  8497. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8498. result = int32(_XML_ERROR_PARAM_ENTITY_REF)
  8499. goto endEntityValue
  8500. case -int32(4):
  8501. result = int32(_XML_ERROR_NONE)
  8502. goto endEntityValue
  8503. case int32(m_XML_TOK_ENTITY_REF):
  8504. fallthrough
  8505. case int32(m_XML_TOK_DATA_CHARS):
  8506. if !(_poolAppend(tls, pool, enc, entityTextPtr, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  8507. result = int32(_XML_ERROR_NO_MEMORY)
  8508. goto endEntityValue
  8509. }
  8510. case -int32(3):
  8511. *(*uintptr)(unsafe.Pointer(bp)) = entityTextPtr + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  8512. /* fall through */
  8513. fallthrough
  8514. case int32(m_XML_TOK_DATA_NEWLINE):
  8515. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr && !(_poolGrow(tls, pool) != 0) {
  8516. result = int32(_XML_ERROR_NO_MEMORY)
  8517. goto endEntityValue
  8518. }
  8519. v3 = pool + 12
  8520. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8521. *(*uintptr)(unsafe.Pointer(v3))++
  8522. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8(0xA)
  8523. case int32(m_XML_TOK_CHAR_REF):
  8524. n = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FcharRefNumber})))(tls, enc, entityTextPtr)
  8525. if n < 0 {
  8526. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8527. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8528. }
  8529. result = int32(_XML_ERROR_BAD_CHAR_REF)
  8530. goto endEntityValue
  8531. }
  8532. n = XXmlUtf8Encode(tls, n, bp+4)
  8533. /* The XmlEncode() functions can never return 0 here. That
  8534. * error return happens if the code point passed in is either
  8535. * negative or greater than or equal to 0x110000. The
  8536. * XmlCharRefNumber() functions will all return a number
  8537. * strictly less than 0x110000 or a negative value if an error
  8538. * occurred. The negative value is intercepted above, so
  8539. * XmlEncode() is never passed a value it might return an
  8540. * error for.
  8541. */
  8542. i = 0
  8543. for {
  8544. if !(i < n) {
  8545. break
  8546. }
  8547. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr && !(_poolGrow(tls, pool) != 0) {
  8548. result = int32(_XML_ERROR_NO_MEMORY)
  8549. goto endEntityValue
  8550. }
  8551. v6 = pool + 12
  8552. v5 = *(*uintptr)(unsafe.Pointer(v6))
  8553. *(*uintptr)(unsafe.Pointer(v6))++
  8554. *(*TXML_Char)(unsafe.Pointer(v5)) = (*(*[4]TXML_Char)(unsafe.Pointer(bp + 4)))[i]
  8555. goto _4
  8556. _4:
  8557. ;
  8558. i++
  8559. }
  8560. case -int32(1):
  8561. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8562. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8563. }
  8564. result = int32(_XML_ERROR_INVALID_TOKEN)
  8565. goto endEntityValue
  8566. case m_XML_TOK_INVALID:
  8567. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8568. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  8569. }
  8570. result = int32(_XML_ERROR_INVALID_TOKEN)
  8571. goto endEntityValue
  8572. default:
  8573. /* This default case should be unnecessary -- all the tokens
  8574. * that XmlEntityValueTok() can return have their own explicit
  8575. * cases -- but should be retained for safety. We do however
  8576. * exclude it from the coverage statistics.
  8577. *
  8578. * LCOV_EXCL_START
  8579. */
  8580. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8581. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8582. }
  8583. result = int32(_XML_ERROR_UNEXPECTED_STATE)
  8584. goto endEntityValue
  8585. /* LCOV_EXCL_STOP */
  8586. }
  8587. entityTextPtr = *(*uintptr)(unsafe.Pointer(bp))
  8588. goto _1
  8589. _1:
  8590. }
  8591. goto endEntityValue
  8592. endEntityValue:
  8593. ;
  8594. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue = oldInEntityValue
  8595. return result
  8596. }
  8597. func _normalizeLines(tls *libc.TLS, s uintptr) {
  8598. var p, v2, v3, v4, v5 uintptr
  8599. _, _, _, _, _ = p, v2, v3, v4, v5
  8600. for {
  8601. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) == int32('\000') {
  8602. return
  8603. }
  8604. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) == int32(0xD) {
  8605. break
  8606. }
  8607. goto _1
  8608. _1:
  8609. ;
  8610. s++
  8611. }
  8612. p = s
  8613. for cond := true; cond; cond = *(*TXML_Char)(unsafe.Pointer(s)) != 0 {
  8614. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) == int32(0xD) {
  8615. v2 = p
  8616. p++
  8617. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8(0xA)
  8618. s++
  8619. v3 = s
  8620. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(v3))) == int32(0xA) {
  8621. s++
  8622. }
  8623. } else {
  8624. v4 = p
  8625. p++
  8626. v5 = s
  8627. s++
  8628. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(v5))
  8629. }
  8630. }
  8631. *(*TXML_Char)(unsafe.Pointer(p)) = uint8('\000')
  8632. }
  8633. func _reportProcessingInstruction(tls *libc.TLS, parser TXML_Parser, enc uintptr, start uintptr, end uintptr) (r int32) {
  8634. var data, target, tem uintptr
  8635. _, _, _ = data, target, tem
  8636. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler != 0) {
  8637. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  8638. _reportDefault(tls, parser, enc, start, end)
  8639. }
  8640. return int32(1)
  8641. }
  8642. start += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar * int32(2))
  8643. tem = start + uintptr((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameLength})))(tls, enc, start))
  8644. target = _poolStoreString(tls, parser+412, enc, start, tem)
  8645. if !(target != 0) {
  8646. return 0
  8647. }
  8648. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr
  8649. data = _poolStoreString(tls, parser+412, 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)))
  8650. if !(data != 0) {
  8651. return 0
  8652. }
  8653. _normalizeLines(tls, data)
  8654. (*(*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)
  8655. _poolClear(tls, parser+412)
  8656. return int32(1)
  8657. }
  8658. func _reportComment(tls *libc.TLS, parser TXML_Parser, enc uintptr, start uintptr, end uintptr) (r int32) {
  8659. var data uintptr
  8660. _ = data
  8661. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler != 0) {
  8662. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  8663. _reportDefault(tls, parser, enc, start, end)
  8664. }
  8665. return int32(1)
  8666. }
  8667. data = _poolStoreString(tls, parser+412, enc, start+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(4)), end-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(3)))
  8668. if !(data != 0) {
  8669. return 0
  8670. }
  8671. _normalizeLines(tls, data)
  8672. (*(*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)
  8673. _poolClear(tls, parser+412)
  8674. return int32(1)
  8675. }
  8676. func _reportDefault(tls *libc.TLS, parser TXML_Parser, enc uintptr, _s uintptr, end uintptr) {
  8677. bp := tls.Alloc(16)
  8678. defer tls.Free(16)
  8679. *(*uintptr)(unsafe.Pointer(bp)) = _s
  8680. var convert_res _XML_Convert_Result
  8681. var eventEndPP, eventPP uintptr
  8682. var _ /* dataPtr at bp+4 */ uintptr
  8683. _, _, _ = convert_res, eventEndPP, eventPP
  8684. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  8685. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8686. eventPP = parser + 284
  8687. eventEndPP = parser + 288
  8688. } else {
  8689. /* To get here, two things must be true; the parser must be
  8690. * using a character encoding that is not the same as the
  8691. * encoding passed in, and the encoding passed in must need
  8692. * conversion to the internal format (UTF-8 unless XML_UNICODE
  8693. * is defined). The only occasions on which the encoding passed
  8694. * in is not the same as the parser's encoding are when it is
  8695. * the internal encoding (e.g. a previously defined parameter
  8696. * entity, already converted to internal format). This by
  8697. * definition doesn't need conversion, so the whole branch never
  8698. * gets executed.
  8699. *
  8700. * For safety's sake we don't delete these lines and merely
  8701. * exclude them from coverage statistics.
  8702. *
  8703. * LCOV_EXCL_START
  8704. */
  8705. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  8706. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 4
  8707. /* LCOV_EXCL_STOP */
  8708. }
  8709. for cond := true; cond; cond = convert_res != int32(_XML_CONVERT_COMPLETED) && convert_res != int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  8710. *(*uintptr)(unsafe.Pointer(bp + 4)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  8711. 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+4, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd)
  8712. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  8713. (*(*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(*(*uintptr)(unsafe.Pointer(bp + 4)))-int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf))
  8714. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  8715. }
  8716. } else {
  8717. (*(*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(end)-int32(*(*uintptr)(unsafe.Pointer(bp))))
  8718. }
  8719. }
  8720. func _defineAttribute(tls *libc.TLS, type1 uintptr, attId uintptr, isCdata TXML_Bool, isId TXML_Bool, value uintptr, parser TXML_Parser) (r int32) {
  8721. var att, temp uintptr
  8722. var count, i int32
  8723. _, _, _, _ = att, count, i, temp
  8724. if value != 0 || isId != 0 {
  8725. i = 0
  8726. for {
  8727. if !(i < (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FnDefaultAtts) {
  8728. break
  8729. }
  8730. if attId == (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts + uintptr(i)*12))).Fid {
  8731. return int32(1)
  8732. }
  8733. goto _1
  8734. _1:
  8735. ;
  8736. i++
  8737. }
  8738. if isId != 0 && !((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FidAtt != 0) && !((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fxmlns != 0) {
  8739. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FidAtt = attId
  8740. }
  8741. }
  8742. if (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FnDefaultAtts == (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts {
  8743. if (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts == 0 {
  8744. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts = int32(8)
  8745. (*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.Uint32FromInt32((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts)*libc.Uint32FromInt64(12))
  8746. if !((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts != 0) {
  8747. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts = 0
  8748. return 0
  8749. }
  8750. } else {
  8751. /* Detect and prevent integer overflow */
  8752. if (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts > libc.Int32FromInt32(m_INT_MAX)/libc.Int32FromInt32(2) {
  8753. return 0
  8754. }
  8755. count = (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts * int32(2)
  8756. /* Detect and prevent integer overflow.
  8757. * The preprocessor guard addresses the "always false" warning
  8758. * from -Wtype-limits on platforms where
  8759. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  8760. if libc.Uint32FromInt32(count) > libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromInt64(12) {
  8761. return 0
  8762. }
  8763. 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.Uint32FromInt32(count)*libc.Uint32FromInt64(12))
  8764. if temp == libc.UintptrFromInt32(0) {
  8765. return 0
  8766. }
  8767. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts = count
  8768. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts = temp
  8769. }
  8770. }
  8771. att = (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts + uintptr((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FnDefaultAtts)*12
  8772. (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(att)).Fid = attId
  8773. (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(att)).Fvalue = value
  8774. (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(att)).FisCdata = isCdata
  8775. if !(isCdata != 0) {
  8776. (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).FmaybeTokenized = libc.Uint8FromInt32(1)
  8777. }
  8778. *(*int32)(unsafe.Pointer(type1 + 12)) += int32(1)
  8779. return int32(1)
  8780. }
  8781. func _setElementTypePrefix(tls *libc.TLS, parser TXML_Parser, elementType uintptr) (r int32) {
  8782. var dtd, name, prefix, s, v4, v5, v7, v8 uintptr
  8783. var v3, v6 int32
  8784. _, _, _, _, _, _, _, _, _, _ = dtd, name, prefix, s, v3, v4, v5, v6, v7, v8
  8785. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  8786. name = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fname
  8787. for {
  8788. if !(*(*TXML_Char)(unsafe.Pointer(name)) != 0) {
  8789. break
  8790. }
  8791. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name))) == int32(m_ASCII_COLON) {
  8792. s = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fname
  8793. for {
  8794. if !(s != name) {
  8795. break
  8796. }
  8797. if (*TSTRING_POOL)(unsafe.Pointer(dtd+80)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+80)).Fend && !(_poolGrow(tls, dtd+80) != 0) {
  8798. v3 = 0
  8799. } else {
  8800. v5 = dtd + 80 + 12
  8801. v4 = *(*uintptr)(unsafe.Pointer(v5))
  8802. *(*uintptr)(unsafe.Pointer(v5))++
  8803. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(s))
  8804. v3 = libc.Int32FromInt32(1)
  8805. }
  8806. if !(v3 != 0) {
  8807. return 0
  8808. }
  8809. goto _2
  8810. _2:
  8811. ;
  8812. s++
  8813. }
  8814. if (*TSTRING_POOL)(unsafe.Pointer(dtd+80)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+80)).Fend && !(_poolGrow(tls, dtd+80) != 0) {
  8815. v6 = 0
  8816. } else {
  8817. v8 = dtd + 80 + 12
  8818. v7 = *(*uintptr)(unsafe.Pointer(v8))
  8819. *(*uintptr)(unsafe.Pointer(v8))++
  8820. *(*TXML_Char)(unsafe.Pointer(v7)) = uint8('\000')
  8821. v6 = libc.Int32FromInt32(1)
  8822. }
  8823. if !(v6 != 0) {
  8824. return 0
  8825. }
  8826. prefix = _lookup(tls, parser, dtd+60, (*TSTRING_POOL)(unsafe.Pointer(dtd+80)).Fstart, uint32(8))
  8827. if !(prefix != 0) {
  8828. return 0
  8829. }
  8830. if (*TPREFIX)(unsafe.Pointer(prefix)).Fname == (*TSTRING_POOL)(unsafe.Pointer(dtd+80)).Fstart {
  8831. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr
  8832. } else {
  8833. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart
  8834. }
  8835. (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fprefix = prefix
  8836. break
  8837. }
  8838. goto _1
  8839. _1:
  8840. ;
  8841. name++
  8842. }
  8843. return int32(1)
  8844. }
  8845. func _getAttributeId(tls *libc.TLS, parser TXML_Parser, enc uintptr, start uintptr, end uintptr) (r uintptr) {
  8846. var dtd, id, name, v10, v11, v2, v3, v7, v8 uintptr
  8847. var i, j, v1, v6, v9 int32
  8848. _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, i, id, j, name, v1, v10, v11, v2, v3, v6, v7, v8, v9
  8849. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  8850. if (*TSTRING_POOL)(unsafe.Pointer(dtd+80)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+80)).Fend && !(_poolGrow(tls, dtd+80) != 0) {
  8851. v1 = 0
  8852. } else {
  8853. v3 = dtd + 80 + 12
  8854. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8855. *(*uintptr)(unsafe.Pointer(v3))++
  8856. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8('\000')
  8857. v1 = libc.Int32FromInt32(1)
  8858. }
  8859. if !(v1 != 0) {
  8860. return libc.UintptrFromInt32(0)
  8861. }
  8862. name = _poolStoreString(tls, dtd+80, enc, start, end)
  8863. if !(name != 0) {
  8864. return libc.UintptrFromInt32(0)
  8865. }
  8866. /* skip quotation mark - its storage will be re-used (like in name[-1]) */
  8867. name++
  8868. id = _lookup(tls, parser, dtd+40, name, uint32(12))
  8869. if !(id != 0) {
  8870. return libc.UintptrFromInt32(0)
  8871. }
  8872. if (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fname != name {
  8873. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart
  8874. } else {
  8875. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr
  8876. if !!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0) {
  8877. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name))) == int32(m_ASCII_x) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + 1))) == int32(m_ASCII_m) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + 2))) == int32(m_ASCII_l) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + 3))) == int32(m_ASCII_n) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + 4))) == int32(m_ASCII_s) && (libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + 5))) == int32('\000') || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + 5))) == int32(m_ASCII_COLON)) {
  8878. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + 5))) == int32('\000') {
  8879. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix = dtd + 152
  8880. } else {
  8881. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix = _lookup(tls, parser, dtd+60, name+uintptr(6), uint32(8))
  8882. }
  8883. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fxmlns = libc.Uint8FromInt32(1)
  8884. } else {
  8885. i = 0
  8886. for {
  8887. if !(*(*TXML_Char)(unsafe.Pointer(name + uintptr(i))) != 0) {
  8888. break
  8889. }
  8890. /* attributes without prefix are *not* in the default namespace */
  8891. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + uintptr(i)))) == int32(m_ASCII_COLON) {
  8892. j = 0
  8893. for {
  8894. if !(j < i) {
  8895. break
  8896. }
  8897. if (*TSTRING_POOL)(unsafe.Pointer(dtd+80)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+80)).Fend && !(_poolGrow(tls, dtd+80) != 0) {
  8898. v6 = 0
  8899. } else {
  8900. v8 = dtd + 80 + 12
  8901. v7 = *(*uintptr)(unsafe.Pointer(v8))
  8902. *(*uintptr)(unsafe.Pointer(v8))++
  8903. *(*TXML_Char)(unsafe.Pointer(v7)) = *(*TXML_Char)(unsafe.Pointer(name + uintptr(j)))
  8904. v6 = libc.Int32FromInt32(1)
  8905. }
  8906. if !(v6 != 0) {
  8907. return libc.UintptrFromInt32(0)
  8908. }
  8909. goto _5
  8910. _5:
  8911. ;
  8912. j++
  8913. }
  8914. if (*TSTRING_POOL)(unsafe.Pointer(dtd+80)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+80)).Fend && !(_poolGrow(tls, dtd+80) != 0) {
  8915. v9 = 0
  8916. } else {
  8917. v11 = dtd + 80 + 12
  8918. v10 = *(*uintptr)(unsafe.Pointer(v11))
  8919. *(*uintptr)(unsafe.Pointer(v11))++
  8920. *(*TXML_Char)(unsafe.Pointer(v10)) = uint8('\000')
  8921. v9 = libc.Int32FromInt32(1)
  8922. }
  8923. if !(v9 != 0) {
  8924. return libc.UintptrFromInt32(0)
  8925. }
  8926. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix = _lookup(tls, parser, dtd+60, (*TSTRING_POOL)(unsafe.Pointer(dtd+80)).Fstart, uint32(8))
  8927. if !((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix != 0) {
  8928. return libc.UintptrFromInt32(0)
  8929. }
  8930. if (*TPREFIX)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix)).Fname == (*TSTRING_POOL)(unsafe.Pointer(dtd+80)).Fstart {
  8931. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr
  8932. } else {
  8933. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart
  8934. }
  8935. break
  8936. }
  8937. goto _4
  8938. _4:
  8939. ;
  8940. i++
  8941. }
  8942. }
  8943. }
  8944. }
  8945. return id
  8946. }
  8947. func _getContext(tls *libc.TLS, parser TXML_Parser) (r uintptr) {
  8948. bp := tls.Alloc(16)
  8949. defer tls.Free(16)
  8950. 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
  8951. var i, i1, len1, len11, v1, v14, v17, v21, v25, v30, v33, v5, v9 int32
  8952. var needSep TXML_Bool
  8953. var v12, v28 bool
  8954. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  8955. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  8956. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  8957. needSep = libc.Uint8FromInt32(0)
  8958. if (*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding != 0 {
  8959. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  8960. v1 = 0
  8961. } else {
  8962. v3 = parser + 412 + 12
  8963. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8964. *(*uintptr)(unsafe.Pointer(v3))++
  8965. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8(m_ASCII_EQUALS)
  8966. v1 = libc.Int32FromInt32(1)
  8967. }
  8968. if !(v1 != 0) {
  8969. return libc.UintptrFromInt32(0)
  8970. }
  8971. len1 = (*TBINDING)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding)).FuriLen
  8972. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  8973. len1--
  8974. }
  8975. i = 0
  8976. for {
  8977. if !(i < len1) {
  8978. break
  8979. }
  8980. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  8981. v5 = 0
  8982. } else {
  8983. v7 = parser + 412 + 12
  8984. v6 = *(*uintptr)(unsafe.Pointer(v7))
  8985. *(*uintptr)(unsafe.Pointer(v7))++
  8986. *(*TXML_Char)(unsafe.Pointer(v6)) = *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding)).Furi + uintptr(i)))
  8987. v5 = libc.Int32FromInt32(1)
  8988. }
  8989. if !(v5 != 0) {
  8990. /* Because of memory caching, I don't believe this line can be
  8991. * executed.
  8992. *
  8993. * This is part of a loop copying the default prefix binding
  8994. * URI into the parser's temporary string pool. Previously,
  8995. * that URI was copied into the same string pool, with a
  8996. * terminating NUL character, as part of setContext(). When
  8997. * the pool was cleared, that leaves a block definitely big
  8998. * enough to hold the URI on the free block list of the pool.
  8999. * The URI copy in getContext() therefore cannot run out of
  9000. * memory.
  9001. *
  9002. * If the pool is used between the setContext() and
  9003. * getContext() calls, the worst it can do is leave a bigger
  9004. * block on the front of the free list. Given that this is
  9005. * all somewhat inobvious and program logic can be changed, we
  9006. * don't delete the line but we do exclude it from the test
  9007. * coverage statistics.
  9008. */
  9009. return libc.UintptrFromInt32(0) /* LCOV_EXCL_LINE */
  9010. }
  9011. goto _4
  9012. _4:
  9013. ;
  9014. i++
  9015. }
  9016. needSep = libc.Uint8FromInt32(1)
  9017. }
  9018. _hashTableIterInit(tls, bp, dtd+60)
  9019. for {
  9020. prefix = _hashTableIterNext(tls, bp)
  9021. if !(prefix != 0) {
  9022. break
  9023. }
  9024. if !((*TPREFIX)(unsafe.Pointer(prefix)).Fbinding != 0) {
  9025. /* This test appears to be (justifiable) paranoia. There does
  9026. * not seem to be a way of injecting a prefix without a binding
  9027. * that doesn't get errored long before this function is called.
  9028. * The test should remain for safety's sake, so we instead
  9029. * exclude the following line from the coverage statistics.
  9030. */
  9031. goto _8 /* LCOV_EXCL_LINE */
  9032. }
  9033. if v12 = needSep != 0; v12 {
  9034. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  9035. v9 = 0
  9036. } else {
  9037. v11 = parser + 412 + 12
  9038. v10 = *(*uintptr)(unsafe.Pointer(v11))
  9039. *(*uintptr)(unsafe.Pointer(v11))++
  9040. *(*TXML_Char)(unsafe.Pointer(v10)) = uint8(m_ASCII_FF)
  9041. v9 = libc.Int32FromInt32(1)
  9042. }
  9043. }
  9044. if v12 && !(v9 != 0) {
  9045. return libc.UintptrFromInt32(0)
  9046. }
  9047. s = (*TPREFIX)(unsafe.Pointer(prefix)).Fname
  9048. for {
  9049. if !(*(*TXML_Char)(unsafe.Pointer(s)) != 0) {
  9050. break
  9051. }
  9052. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  9053. v14 = 0
  9054. } else {
  9055. v16 = parser + 412 + 12
  9056. v15 = *(*uintptr)(unsafe.Pointer(v16))
  9057. *(*uintptr)(unsafe.Pointer(v16))++
  9058. *(*TXML_Char)(unsafe.Pointer(v15)) = *(*TXML_Char)(unsafe.Pointer(s))
  9059. v14 = libc.Int32FromInt32(1)
  9060. }
  9061. if !(v14 != 0) {
  9062. return libc.UintptrFromInt32(0)
  9063. }
  9064. goto _13
  9065. _13:
  9066. ;
  9067. s++
  9068. }
  9069. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  9070. v17 = 0
  9071. } else {
  9072. v19 = parser + 412 + 12
  9073. v18 = *(*uintptr)(unsafe.Pointer(v19))
  9074. *(*uintptr)(unsafe.Pointer(v19))++
  9075. *(*TXML_Char)(unsafe.Pointer(v18)) = uint8(m_ASCII_EQUALS)
  9076. v17 = libc.Int32FromInt32(1)
  9077. }
  9078. if !(v17 != 0) {
  9079. return libc.UintptrFromInt32(0)
  9080. }
  9081. len11 = (*TBINDING)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fbinding)).FuriLen
  9082. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  9083. len11--
  9084. }
  9085. i1 = 0
  9086. for {
  9087. if !(i1 < len11) {
  9088. break
  9089. }
  9090. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  9091. v21 = 0
  9092. } else {
  9093. v23 = parser + 412 + 12
  9094. v22 = *(*uintptr)(unsafe.Pointer(v23))
  9095. *(*uintptr)(unsafe.Pointer(v23))++
  9096. *(*TXML_Char)(unsafe.Pointer(v22)) = *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fbinding)).Furi + uintptr(i1)))
  9097. v21 = libc.Int32FromInt32(1)
  9098. }
  9099. if !(v21 != 0) {
  9100. return libc.UintptrFromInt32(0)
  9101. }
  9102. goto _20
  9103. _20:
  9104. ;
  9105. i1++
  9106. }
  9107. needSep = libc.Uint8FromInt32(1)
  9108. goto _8
  9109. _8:
  9110. }
  9111. _hashTableIterInit(tls, bp, dtd)
  9112. for {
  9113. e = _hashTableIterNext(tls, bp)
  9114. if !(e != 0) {
  9115. break
  9116. }
  9117. if !((*TENTITY)(unsafe.Pointer(e)).Fopen != 0) {
  9118. goto _24
  9119. }
  9120. if v28 = needSep != 0; v28 {
  9121. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  9122. v25 = 0
  9123. } else {
  9124. v27 = parser + 412 + 12
  9125. v26 = *(*uintptr)(unsafe.Pointer(v27))
  9126. *(*uintptr)(unsafe.Pointer(v27))++
  9127. *(*TXML_Char)(unsafe.Pointer(v26)) = uint8(m_ASCII_FF)
  9128. v25 = libc.Int32FromInt32(1)
  9129. }
  9130. }
  9131. if v28 && !(v25 != 0) {
  9132. return libc.UintptrFromInt32(0)
  9133. }
  9134. s1 = (*TENTITY)(unsafe.Pointer(e)).Fname
  9135. for {
  9136. if !(*(*TXML_Char)(unsafe.Pointer(s1)) != 0) {
  9137. break
  9138. }
  9139. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  9140. v30 = 0
  9141. } else {
  9142. v32 = parser + 412 + 12
  9143. v31 = *(*uintptr)(unsafe.Pointer(v32))
  9144. *(*uintptr)(unsafe.Pointer(v32))++
  9145. *(*TXML_Char)(unsafe.Pointer(v31)) = *(*TXML_Char)(unsafe.Pointer(s1))
  9146. v30 = libc.Int32FromInt32(1)
  9147. }
  9148. if !(v30 != 0) {
  9149. return uintptr(0)
  9150. }
  9151. goto _29
  9152. _29:
  9153. ;
  9154. s1++
  9155. }
  9156. needSep = libc.Uint8FromInt32(1)
  9157. goto _24
  9158. _24:
  9159. }
  9160. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  9161. v33 = 0
  9162. } else {
  9163. v35 = parser + 412 + 12
  9164. v34 = *(*uintptr)(unsafe.Pointer(v35))
  9165. *(*uintptr)(unsafe.Pointer(v35))++
  9166. *(*TXML_Char)(unsafe.Pointer(v34)) = uint8('\000')
  9167. v33 = libc.Int32FromInt32(1)
  9168. }
  9169. if !(v33 != 0) {
  9170. return libc.UintptrFromInt32(0)
  9171. }
  9172. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  9173. }
  9174. func _setContext(tls *libc.TLS, parser TXML_Parser, context uintptr) (r TXML_Bool) {
  9175. var dtd, e, prefix, s, v10, v12, v13, v15, v16, v2, v3, v5, v6, v9 uintptr
  9176. var v1, v11, v14, v4, v8 int32
  9177. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, e, prefix, s, v1, v10, v11, v12, v13, v14, v15, v16, v2, v3, v4, v5, v6, v8, v9
  9178. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  9179. s = context
  9180. for libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(context))) != int32('\000') {
  9181. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) == int32(m_ASCII_FF) || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) == int32('\000') {
  9182. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  9183. v1 = 0
  9184. } else {
  9185. v3 = parser + 412 + 12
  9186. v2 = *(*uintptr)(unsafe.Pointer(v3))
  9187. *(*uintptr)(unsafe.Pointer(v3))++
  9188. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8('\000')
  9189. v1 = libc.Int32FromInt32(1)
  9190. }
  9191. if !(v1 != 0) {
  9192. return libc.Uint8FromInt32(0)
  9193. }
  9194. e = _lookup(tls, parser, dtd, (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fstart, uint32(0))
  9195. if e != 0 {
  9196. (*TENTITY)(unsafe.Pointer(e)).Fopen = libc.Uint8FromInt32(1)
  9197. }
  9198. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) != int32('\000') {
  9199. s++
  9200. }
  9201. context = s
  9202. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart
  9203. } else {
  9204. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) == int32(m_ASCII_EQUALS) {
  9205. if int32((*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr)-int32((*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fstart) == 0 {
  9206. prefix = dtd + 152
  9207. } else {
  9208. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  9209. v4 = 0
  9210. } else {
  9211. v6 = parser + 412 + 12
  9212. v5 = *(*uintptr)(unsafe.Pointer(v6))
  9213. *(*uintptr)(unsafe.Pointer(v6))++
  9214. *(*TXML_Char)(unsafe.Pointer(v5)) = uint8('\000')
  9215. v4 = libc.Int32FromInt32(1)
  9216. }
  9217. if !(v4 != 0) {
  9218. return libc.Uint8FromInt32(0)
  9219. }
  9220. prefix = _lookup(tls, parser, dtd+60, (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fstart, uint32(8))
  9221. if !(prefix != 0) {
  9222. return libc.Uint8FromInt32(0)
  9223. }
  9224. if (*TPREFIX)(unsafe.Pointer(prefix)).Fname == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fstart {
  9225. (*TPREFIX)(unsafe.Pointer(prefix)).Fname = _poolCopyString(tls, dtd+80, (*TPREFIX)(unsafe.Pointer(prefix)).Fname)
  9226. if !((*TPREFIX)(unsafe.Pointer(prefix)).Fname != 0) {
  9227. return libc.Uint8FromInt32(0)
  9228. }
  9229. }
  9230. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart
  9231. }
  9232. context = s + uintptr(1)
  9233. for {
  9234. if !(libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(context))) != int32(m_ASCII_FF) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(context))) != int32('\000')) {
  9235. break
  9236. }
  9237. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  9238. v8 = 0
  9239. } else {
  9240. v10 = parser + 412 + 12
  9241. v9 = *(*uintptr)(unsafe.Pointer(v10))
  9242. *(*uintptr)(unsafe.Pointer(v10))++
  9243. *(*TXML_Char)(unsafe.Pointer(v9)) = *(*TXML_Char)(unsafe.Pointer(context))
  9244. v8 = libc.Int32FromInt32(1)
  9245. }
  9246. if !(v8 != 0) {
  9247. return libc.Uint8FromInt32(0)
  9248. }
  9249. goto _7
  9250. _7:
  9251. ;
  9252. context++
  9253. }
  9254. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  9255. v11 = 0
  9256. } else {
  9257. v13 = parser + 412 + 12
  9258. v12 = *(*uintptr)(unsafe.Pointer(v13))
  9259. *(*uintptr)(unsafe.Pointer(v13))++
  9260. *(*TXML_Char)(unsafe.Pointer(v12)) = uint8('\000')
  9261. v11 = libc.Int32FromInt32(1)
  9262. }
  9263. if !(v11 != 0) {
  9264. return libc.Uint8FromInt32(0)
  9265. }
  9266. if _addBinding(tls, parser, prefix, libc.UintptrFromInt32(0), (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fstart, parser+368) != int32(_XML_ERROR_NONE) {
  9267. return libc.Uint8FromInt32(0)
  9268. }
  9269. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart
  9270. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(context))) != int32('\000') {
  9271. context++
  9272. }
  9273. s = context
  9274. } else {
  9275. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  9276. v14 = 0
  9277. } else {
  9278. v16 = parser + 412 + 12
  9279. v15 = *(*uintptr)(unsafe.Pointer(v16))
  9280. *(*uintptr)(unsafe.Pointer(v16))++
  9281. *(*TXML_Char)(unsafe.Pointer(v15)) = *(*TXML_Char)(unsafe.Pointer(s))
  9282. v14 = libc.Int32FromInt32(1)
  9283. }
  9284. if !(v14 != 0) {
  9285. return libc.Uint8FromInt32(0)
  9286. }
  9287. s++
  9288. }
  9289. }
  9290. }
  9291. return libc.Uint8FromInt32(1)
  9292. }
  9293. func _normalizePublicId(tls *libc.TLS, publicId uintptr) {
  9294. var p, s, v2, v3 uintptr
  9295. _, _, _, _ = p, s, v2, v3
  9296. p = publicId
  9297. s = publicId
  9298. for {
  9299. if !(*(*TXML_Char)(unsafe.Pointer(s)) != 0) {
  9300. break
  9301. }
  9302. switch libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) {
  9303. case int32(0x20):
  9304. fallthrough
  9305. case int32(0xD):
  9306. fallthrough
  9307. case int32(0xA):
  9308. if p != publicId && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(p + uintptr(-libc.Int32FromInt32(1))))) != int32(0x20) {
  9309. v2 = p
  9310. p++
  9311. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8(0x20)
  9312. }
  9313. default:
  9314. v3 = p
  9315. p++
  9316. *(*TXML_Char)(unsafe.Pointer(v3)) = *(*TXML_Char)(unsafe.Pointer(s))
  9317. }
  9318. goto _1
  9319. _1:
  9320. ;
  9321. s++
  9322. }
  9323. if p != publicId && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(p + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20) {
  9324. p--
  9325. }
  9326. *(*TXML_Char)(unsafe.Pointer(p)) = uint8('\000')
  9327. }
  9328. func _dtdCreate(tls *libc.TLS, ms uintptr) (r uintptr) {
  9329. var p uintptr
  9330. _ = p
  9331. p = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Fmalloc_fcn})))(tls, uint32(188))
  9332. if p == libc.UintptrFromInt32(0) {
  9333. return p
  9334. }
  9335. _poolInit(tls, p+80, ms)
  9336. _poolInit(tls, p+104, ms)
  9337. _hashTableInit(tls, p, ms)
  9338. _hashTableInit(tls, p+20, ms)
  9339. _hashTableInit(tls, p+40, ms)
  9340. _hashTableInit(tls, p+60, ms)
  9341. (*TDTD)(unsafe.Pointer(p)).FparamEntityRead = libc.Uint8FromInt32(0)
  9342. _hashTableInit(tls, p+132, ms)
  9343. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fname = libc.UintptrFromInt32(0)
  9344. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fbinding = libc.UintptrFromInt32(0)
  9345. (*TDTD)(unsafe.Pointer(p)).Fin_eldecl = libc.Uint8FromInt32(0)
  9346. (*TDTD)(unsafe.Pointer(p)).FscaffIndex = libc.UintptrFromInt32(0)
  9347. (*TDTD)(unsafe.Pointer(p)).Fscaffold = libc.UintptrFromInt32(0)
  9348. (*TDTD)(unsafe.Pointer(p)).FscaffLevel = 0
  9349. (*TDTD)(unsafe.Pointer(p)).FscaffSize = uint32(0)
  9350. (*TDTD)(unsafe.Pointer(p)).FscaffCount = uint32(0)
  9351. (*TDTD)(unsafe.Pointer(p)).FcontentStringLen = uint32(0)
  9352. (*TDTD)(unsafe.Pointer(p)).FkeepProcessing = libc.Uint8FromInt32(1)
  9353. (*TDTD)(unsafe.Pointer(p)).FhasParamEntityRefs = libc.Uint8FromInt32(0)
  9354. (*TDTD)(unsafe.Pointer(p)).Fstandalone = libc.Uint8FromInt32(0)
  9355. return p
  9356. }
  9357. func _dtdReset(tls *libc.TLS, p uintptr, ms uintptr) {
  9358. bp := tls.Alloc(16)
  9359. defer tls.Free(16)
  9360. var e uintptr
  9361. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  9362. _ = e
  9363. _hashTableIterInit(tls, bp, p+20)
  9364. for {
  9365. e = _hashTableIterNext(tls, bp)
  9366. if !(e != 0) {
  9367. break
  9368. }
  9369. if (*TELEMENT_TYPE)(unsafe.Pointer(e)).FallocDefaultAtts != 0 {
  9370. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TELEMENT_TYPE)(unsafe.Pointer(e)).FdefaultAtts)
  9371. }
  9372. goto _1
  9373. _1:
  9374. }
  9375. _hashTableClear(tls, p)
  9376. (*TDTD)(unsafe.Pointer(p)).FparamEntityRead = libc.Uint8FromInt32(0)
  9377. _hashTableClear(tls, p+132)
  9378. _hashTableClear(tls, p+20)
  9379. _hashTableClear(tls, p+40)
  9380. _hashTableClear(tls, p+60)
  9381. _poolClear(tls, p+80)
  9382. _poolClear(tls, p+104)
  9383. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fname = libc.UintptrFromInt32(0)
  9384. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fbinding = libc.UintptrFromInt32(0)
  9385. (*TDTD)(unsafe.Pointer(p)).Fin_eldecl = libc.Uint8FromInt32(0)
  9386. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).FscaffIndex)
  9387. (*TDTD)(unsafe.Pointer(p)).FscaffIndex = libc.UintptrFromInt32(0)
  9388. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).Fscaffold)
  9389. (*TDTD)(unsafe.Pointer(p)).Fscaffold = libc.UintptrFromInt32(0)
  9390. (*TDTD)(unsafe.Pointer(p)).FscaffLevel = 0
  9391. (*TDTD)(unsafe.Pointer(p)).FscaffSize = uint32(0)
  9392. (*TDTD)(unsafe.Pointer(p)).FscaffCount = uint32(0)
  9393. (*TDTD)(unsafe.Pointer(p)).FcontentStringLen = uint32(0)
  9394. (*TDTD)(unsafe.Pointer(p)).FkeepProcessing = libc.Uint8FromInt32(1)
  9395. (*TDTD)(unsafe.Pointer(p)).FhasParamEntityRefs = libc.Uint8FromInt32(0)
  9396. (*TDTD)(unsafe.Pointer(p)).Fstandalone = libc.Uint8FromInt32(0)
  9397. }
  9398. func _dtdDestroy(tls *libc.TLS, p uintptr, isDocEntity TXML_Bool, ms uintptr) {
  9399. bp := tls.Alloc(16)
  9400. defer tls.Free(16)
  9401. var e uintptr
  9402. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  9403. _ = e
  9404. _hashTableIterInit(tls, bp, p+20)
  9405. for {
  9406. e = _hashTableIterNext(tls, bp)
  9407. if !(e != 0) {
  9408. break
  9409. }
  9410. if (*TELEMENT_TYPE)(unsafe.Pointer(e)).FallocDefaultAtts != 0 {
  9411. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TELEMENT_TYPE)(unsafe.Pointer(e)).FdefaultAtts)
  9412. }
  9413. goto _1
  9414. _1:
  9415. }
  9416. _hashTableDestroy(tls, p)
  9417. _hashTableDestroy(tls, p+132)
  9418. _hashTableDestroy(tls, p+20)
  9419. _hashTableDestroy(tls, p+40)
  9420. _hashTableDestroy(tls, p+60)
  9421. _poolDestroy(tls, p+80)
  9422. _poolDestroy(tls, p+104)
  9423. if isDocEntity != 0 {
  9424. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).FscaffIndex)
  9425. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).Fscaffold)
  9426. }
  9427. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, p)
  9428. }
  9429. // C documentation
  9430. //
  9431. // /* Do a deep copy of the DTD. Return 0 for out of memory, non-zero otherwise.
  9432. // The new DTD has already been initialized.
  9433. // */
  9434. func _dtdCopy(tls *libc.TLS, oldParser TXML_Parser, newDtd uintptr, oldDtd uintptr, ms uintptr) (r int32) {
  9435. bp := tls.Alloc(16)
  9436. defer tls.Free(16)
  9437. var i, v3, v7 int32
  9438. var name, name1, name2, newA, newE, oldA, oldE, oldP, v4, v5 uintptr
  9439. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  9440. _, _, _, _, _, _, _, _, _, _, _, _, _ = i, name, name1, name2, newA, newE, oldA, oldE, oldP, v3, v4, v5, v7
  9441. /* Copy the prefix table. */
  9442. _hashTableIterInit(tls, bp, oldDtd+60)
  9443. for {
  9444. oldP = _hashTableIterNext(tls, bp)
  9445. if !(oldP != 0) {
  9446. break
  9447. }
  9448. name = _poolCopyString(tls, newDtd+80, (*TPREFIX)(unsafe.Pointer(oldP)).Fname)
  9449. if !(name != 0) {
  9450. return 0
  9451. }
  9452. if !(_lookup(tls, oldParser, newDtd+60, name, uint32(8)) != 0) {
  9453. return 0
  9454. }
  9455. goto _1
  9456. _1:
  9457. }
  9458. _hashTableIterInit(tls, bp, oldDtd+40)
  9459. /* Copy the attribute id table. */
  9460. for {
  9461. oldA = _hashTableIterNext(tls, bp)
  9462. if !(oldA != 0) {
  9463. break
  9464. }
  9465. /* Remember to allocate the scratch byte before the name. */
  9466. if (*TSTRING_POOL)(unsafe.Pointer(newDtd+80)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(newDtd+80)).Fend && !(_poolGrow(tls, newDtd+80) != 0) {
  9467. v3 = 0
  9468. } else {
  9469. v5 = newDtd + 80 + 12
  9470. v4 = *(*uintptr)(unsafe.Pointer(v5))
  9471. *(*uintptr)(unsafe.Pointer(v5))++
  9472. *(*TXML_Char)(unsafe.Pointer(v4)) = uint8('\000')
  9473. v3 = libc.Int32FromInt32(1)
  9474. }
  9475. if !(v3 != 0) {
  9476. return 0
  9477. }
  9478. name1 = _poolCopyString(tls, newDtd+80, (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fname)
  9479. if !(name1 != 0) {
  9480. return 0
  9481. }
  9482. name1++
  9483. newA = _lookup(tls, oldParser, newDtd+40, name1, uint32(12))
  9484. if !(newA != 0) {
  9485. return 0
  9486. }
  9487. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).FmaybeTokenized = (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).FmaybeTokenized
  9488. if (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fprefix != 0 {
  9489. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).Fxmlns = (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fxmlns
  9490. if (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fprefix == oldDtd+152 {
  9491. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).Fprefix = newDtd + 152
  9492. } else {
  9493. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).Fprefix = _lookup(tls, oldParser, newDtd+60, (*TPREFIX)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fprefix)).Fname, uint32(0))
  9494. }
  9495. }
  9496. goto _2
  9497. _2:
  9498. }
  9499. /* Copy the element type table. */
  9500. _hashTableIterInit(tls, bp, oldDtd+20)
  9501. for {
  9502. oldE = _hashTableIterNext(tls, bp)
  9503. if !(oldE != 0) {
  9504. break
  9505. }
  9506. name2 = _poolCopyString(tls, newDtd+80, (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).Fname)
  9507. if !(name2 != 0) {
  9508. return 0
  9509. }
  9510. newE = _lookup(tls, oldParser, newDtd+20, name2, uint32(24))
  9511. if !(newE != 0) {
  9512. return 0
  9513. }
  9514. if (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FnDefaultAtts != 0 {
  9515. (*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.Uint32FromInt32((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FnDefaultAtts)*uint32(12))
  9516. if !((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts != 0) {
  9517. return 0
  9518. }
  9519. }
  9520. if (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FidAtt != 0 {
  9521. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FidAtt = _lookup(tls, oldParser, newDtd+40, (*TATTRIBUTE_ID)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FidAtt)).Fname, uint32(0))
  9522. }
  9523. v7 = (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FnDefaultAtts
  9524. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FnDefaultAtts = v7
  9525. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FallocDefaultAtts = v7
  9526. if (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).Fprefix != 0 {
  9527. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).Fprefix = _lookup(tls, oldParser, newDtd+60, (*TPREFIX)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).Fprefix)).Fname, uint32(0))
  9528. }
  9529. i = 0
  9530. for {
  9531. if !(i < (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FnDefaultAtts) {
  9532. break
  9533. }
  9534. (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*12))).Fid = _lookup(tls, oldParser, newDtd+40, (*TATTRIBUTE_ID)(unsafe.Pointer((*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FdefaultAtts + uintptr(i)*12))).Fid)).Fname, uint32(0))
  9535. (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*12))).FisCdata = (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FdefaultAtts + uintptr(i)*12))).FisCdata
  9536. if (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FdefaultAtts + uintptr(i)*12))).Fvalue != 0 {
  9537. (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*12))).Fvalue = _poolCopyString(tls, newDtd+80, (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FdefaultAtts + uintptr(i)*12))).Fvalue)
  9538. if !((*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*12))).Fvalue != 0) {
  9539. return 0
  9540. }
  9541. } else {
  9542. (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*12))).Fvalue = libc.UintptrFromInt32(0)
  9543. }
  9544. goto _8
  9545. _8:
  9546. ;
  9547. i++
  9548. }
  9549. goto _6
  9550. _6:
  9551. }
  9552. /* Copy the entity tables. */
  9553. if !(_copyEntityTable(tls, oldParser, newDtd, newDtd+80, oldDtd) != 0) {
  9554. return 0
  9555. }
  9556. if !(_copyEntityTable(tls, oldParser, newDtd+132, newDtd+80, oldDtd+132) != 0) {
  9557. return 0
  9558. }
  9559. (*TDTD)(unsafe.Pointer(newDtd)).FparamEntityRead = (*TDTD)(unsafe.Pointer(oldDtd)).FparamEntityRead
  9560. (*TDTD)(unsafe.Pointer(newDtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(oldDtd)).FkeepProcessing
  9561. (*TDTD)(unsafe.Pointer(newDtd)).FhasParamEntityRefs = (*TDTD)(unsafe.Pointer(oldDtd)).FhasParamEntityRefs
  9562. (*TDTD)(unsafe.Pointer(newDtd)).Fstandalone = (*TDTD)(unsafe.Pointer(oldDtd)).Fstandalone
  9563. /* Don't want deep copying for scaffolding */
  9564. (*TDTD)(unsafe.Pointer(newDtd)).Fin_eldecl = (*TDTD)(unsafe.Pointer(oldDtd)).Fin_eldecl
  9565. (*TDTD)(unsafe.Pointer(newDtd)).Fscaffold = (*TDTD)(unsafe.Pointer(oldDtd)).Fscaffold
  9566. (*TDTD)(unsafe.Pointer(newDtd)).FcontentStringLen = (*TDTD)(unsafe.Pointer(oldDtd)).FcontentStringLen
  9567. (*TDTD)(unsafe.Pointer(newDtd)).FscaffSize = (*TDTD)(unsafe.Pointer(oldDtd)).FscaffSize
  9568. (*TDTD)(unsafe.Pointer(newDtd)).FscaffLevel = (*TDTD)(unsafe.Pointer(oldDtd)).FscaffLevel
  9569. (*TDTD)(unsafe.Pointer(newDtd)).FscaffIndex = (*TDTD)(unsafe.Pointer(oldDtd)).FscaffIndex
  9570. return int32(1)
  9571. }
  9572. /* End dtdCopy */
  9573. func _copyEntityTable(tls *libc.TLS, oldParser TXML_Parser, newTable uintptr, newPool uintptr, oldTable uintptr) (r int32) {
  9574. bp := tls.Alloc(16)
  9575. defer tls.Free(16)
  9576. var cachedNewBase, cachedOldBase, name, newE, oldE, tem, tem1, tem2, v2 uintptr
  9577. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  9578. _, _, _, _, _, _, _, _, _ = cachedNewBase, cachedOldBase, name, newE, oldE, tem, tem1, tem2, v2
  9579. cachedOldBase = libc.UintptrFromInt32(0)
  9580. cachedNewBase = libc.UintptrFromInt32(0)
  9581. _hashTableIterInit(tls, bp, oldTable)
  9582. for {
  9583. oldE = _hashTableIterNext(tls, bp)
  9584. if !(oldE != 0) {
  9585. break
  9586. }
  9587. name = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).Fname)
  9588. if !(name != 0) {
  9589. return 0
  9590. }
  9591. newE = _lookup(tls, oldParser, newTable, name, uint32(36))
  9592. if !(newE != 0) {
  9593. return 0
  9594. }
  9595. if (*TENTITY)(unsafe.Pointer(oldE)).FsystemId != 0 {
  9596. tem = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).FsystemId)
  9597. if !(tem != 0) {
  9598. return 0
  9599. }
  9600. (*TENTITY)(unsafe.Pointer(newE)).FsystemId = tem
  9601. if (*TENTITY)(unsafe.Pointer(oldE)).Fbase != 0 {
  9602. if (*TENTITY)(unsafe.Pointer(oldE)).Fbase == cachedOldBase {
  9603. (*TENTITY)(unsafe.Pointer(newE)).Fbase = cachedNewBase
  9604. } else {
  9605. cachedOldBase = (*TENTITY)(unsafe.Pointer(oldE)).Fbase
  9606. tem = _poolCopyString(tls, newPool, cachedOldBase)
  9607. if !(tem != 0) {
  9608. return 0
  9609. }
  9610. v2 = tem
  9611. (*TENTITY)(unsafe.Pointer(newE)).Fbase = v2
  9612. cachedNewBase = v2
  9613. }
  9614. }
  9615. if (*TENTITY)(unsafe.Pointer(oldE)).FpublicId != 0 {
  9616. tem = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).FpublicId)
  9617. if !(tem != 0) {
  9618. return 0
  9619. }
  9620. (*TENTITY)(unsafe.Pointer(newE)).FpublicId = tem
  9621. }
  9622. } else {
  9623. tem1 = _poolCopyStringN(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).FtextPtr, (*TENTITY)(unsafe.Pointer(oldE)).FtextLen)
  9624. if !(tem1 != 0) {
  9625. return 0
  9626. }
  9627. (*TENTITY)(unsafe.Pointer(newE)).FtextPtr = tem1
  9628. (*TENTITY)(unsafe.Pointer(newE)).FtextLen = (*TENTITY)(unsafe.Pointer(oldE)).FtextLen
  9629. }
  9630. if (*TENTITY)(unsafe.Pointer(oldE)).Fnotation != 0 {
  9631. tem2 = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).Fnotation)
  9632. if !(tem2 != 0) {
  9633. return 0
  9634. }
  9635. (*TENTITY)(unsafe.Pointer(newE)).Fnotation = tem2
  9636. }
  9637. (*TENTITY)(unsafe.Pointer(newE)).Fis_param = (*TENTITY)(unsafe.Pointer(oldE)).Fis_param
  9638. (*TENTITY)(unsafe.Pointer(newE)).Fis_internal = (*TENTITY)(unsafe.Pointer(oldE)).Fis_internal
  9639. goto _1
  9640. _1:
  9641. }
  9642. return int32(1)
  9643. }
  9644. func _keyeq(tls *libc.TLS, s1 TKEY, s2 TKEY) (r TXML_Bool) {
  9645. for {
  9646. if !(libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s1))) == libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s2)))) {
  9647. break
  9648. }
  9649. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s1))) == 0 {
  9650. return libc.Uint8FromInt32(1)
  9651. }
  9652. goto _1
  9653. _1:
  9654. ;
  9655. s1++
  9656. s2++
  9657. }
  9658. return libc.Uint8FromInt32(0)
  9659. }
  9660. func _keylen(tls *libc.TLS, s TKEY) (r Tsize_t) {
  9661. var len1 Tsize_t
  9662. _ = len1
  9663. len1 = uint32(0)
  9664. for {
  9665. if !(*(*TXML_Char)(unsafe.Pointer(s)) != 0) {
  9666. break
  9667. }
  9668. goto _1
  9669. _1:
  9670. ;
  9671. s++
  9672. len1++
  9673. }
  9674. return len1
  9675. }
  9676. func _copy_salt_to_sipkey(tls *libc.TLS, parser TXML_Parser, key uintptr) {
  9677. *(*Tuint64_t)(unsafe.Pointer(key)) = uint64(0)
  9678. *(*Tuint64_t)(unsafe.Pointer(key + 1*8)) = uint64(_get_hash_secret_salt(tls, parser))
  9679. }
  9680. func _hash(tls *libc.TLS, parser TXML_Parser, s TKEY) (r uint32) {
  9681. bp := tls.Alloc(80)
  9682. defer tls.Free(80)
  9683. var _ /* key at bp+56 */ Tsipkey
  9684. var _ /* state at bp+0 */ Tsiphash
  9685. _ = __ccgo_fp(_sip24_valid)
  9686. _copy_salt_to_sipkey(tls, parser, bp+56)
  9687. _sip24_init(tls, bp, bp+56)
  9688. _sip24_update(tls, bp, s, _keylen(tls, s)*uint32(1))
  9689. return uint32(_sip24_final(tls, bp))
  9690. }
  9691. func _lookup(tls *libc.TLS, parser TXML_Parser, table uintptr, name TKEY, createSize Tsize_t) (r uintptr) {
  9692. var h, mask, newHash, newMask uint32
  9693. var i, j, newSize, tsize, tsize1 Tsize_t
  9694. var newPower, step uint8
  9695. var newV uintptr
  9696. _, _, _, _, _, _, _, _, _, _, _, _ = h, i, j, mask, newHash, newMask, newPower, newSize, newV, step, tsize, tsize1
  9697. if (*THASH_TABLE)(unsafe.Pointer(table)).Fsize == uint32(0) {
  9698. if !(createSize != 0) {
  9699. return libc.UintptrFromInt32(0)
  9700. }
  9701. (*THASH_TABLE)(unsafe.Pointer(table)).Fpower = uint8(m_INIT_POWER)
  9702. /* table->size is a power of 2 */
  9703. (*THASH_TABLE)(unsafe.Pointer(table)).Fsize = libc.Uint32FromInt32(1) << libc.Int32FromInt32(m_INIT_POWER)
  9704. tsize = (*THASH_TABLE)(unsafe.Pointer(table)).Fsize * uint32(4)
  9705. (*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)
  9706. if !((*THASH_TABLE)(unsafe.Pointer(table)).Fv != 0) {
  9707. (*THASH_TABLE)(unsafe.Pointer(table)).Fsize = uint32(0)
  9708. return libc.UintptrFromInt32(0)
  9709. }
  9710. libc.Xmemset(tls, (*THASH_TABLE)(unsafe.Pointer(table)).Fv, 0, tsize)
  9711. i = _hash(tls, parser, name) & ((*THASH_TABLE)(unsafe.Pointer(table)).Fsize - uint32(1))
  9712. } else {
  9713. h = _hash(tls, parser, name)
  9714. mask = (*THASH_TABLE)(unsafe.Pointer(table)).Fsize - uint32(1)
  9715. step = uint8(0)
  9716. i = h & mask
  9717. for *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*4)) != 0 {
  9718. if _keyeq(tls, name, (*TNAMED)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*4)))).Fname) != 0 {
  9719. return *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*4))
  9720. }
  9721. if !(step != 0) {
  9722. step = uint8(h & ^mask >> (libc.Int32FromUint8((*THASH_TABLE)(unsafe.Pointer(table)).Fpower)-libc.Int32FromInt32(1)) & (mask>>libc.Int32FromInt32(2)) | libc.Uint32FromInt32(1))
  9723. }
  9724. if i < uint32(step) {
  9725. i += (*THASH_TABLE)(unsafe.Pointer(table)).Fsize - uint32(step)
  9726. } else {
  9727. i -= uint32(step)
  9728. }
  9729. }
  9730. if !(createSize != 0) {
  9731. return libc.UintptrFromInt32(0)
  9732. }
  9733. /* check for overflow (table is half full) */
  9734. if (*THASH_TABLE)(unsafe.Pointer(table)).Fused>>(libc.Int32FromUint8((*THASH_TABLE)(unsafe.Pointer(table)).Fpower)-int32(1)) != 0 {
  9735. newPower = libc.Uint8FromInt32(libc.Int32FromUint8((*THASH_TABLE)(unsafe.Pointer(table)).Fpower) + int32(1))
  9736. /* Detect and prevent invalid shift */
  9737. if uint32(newPower) >= libc.Uint32FromInt64(4)*libc.Uint32FromInt32(8) {
  9738. return libc.UintptrFromInt32(0)
  9739. }
  9740. newSize = libc.Uint32FromInt32(1) << newPower
  9741. newMask = newSize - uint32(1)
  9742. /* Detect and prevent integer overflow */
  9743. if newSize > libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromInt64(4) {
  9744. return libc.UintptrFromInt32(0)
  9745. }
  9746. tsize1 = newSize * uint32(4)
  9747. 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)
  9748. if !(newV != 0) {
  9749. return libc.UintptrFromInt32(0)
  9750. }
  9751. libc.Xmemset(tls, newV, 0, tsize1)
  9752. i = uint32(0)
  9753. for {
  9754. if !(i < (*THASH_TABLE)(unsafe.Pointer(table)).Fsize) {
  9755. break
  9756. }
  9757. if *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*4)) != 0 {
  9758. newHash = _hash(tls, parser, (*TNAMED)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*4)))).Fname)
  9759. j = newHash & newMask
  9760. step = uint8(0)
  9761. for *(*uintptr)(unsafe.Pointer(newV + uintptr(j)*4)) != 0 {
  9762. if !(step != 0) {
  9763. step = uint8(newHash & ^newMask >> (libc.Int32FromUint8(newPower)-libc.Int32FromInt32(1)) & (newMask>>libc.Int32FromInt32(2)) | libc.Uint32FromInt32(1))
  9764. }
  9765. if j < uint32(step) {
  9766. j += newSize - uint32(step)
  9767. } else {
  9768. j -= uint32(step)
  9769. }
  9770. }
  9771. *(*uintptr)(unsafe.Pointer(newV + uintptr(j)*4)) = *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*4))
  9772. }
  9773. goto _2
  9774. _2:
  9775. ;
  9776. i++
  9777. }
  9778. (*(*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)
  9779. (*THASH_TABLE)(unsafe.Pointer(table)).Fv = newV
  9780. (*THASH_TABLE)(unsafe.Pointer(table)).Fpower = newPower
  9781. (*THASH_TABLE)(unsafe.Pointer(table)).Fsize = newSize
  9782. i = h & newMask
  9783. step = uint8(0)
  9784. for *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*4)) != 0 {
  9785. if !(step != 0) {
  9786. step = uint8(h & ^newMask >> (libc.Int32FromUint8(newPower)-libc.Int32FromInt32(1)) & (newMask>>libc.Int32FromInt32(2)) | libc.Uint32FromInt32(1))
  9787. }
  9788. if i < uint32(step) {
  9789. i += newSize - uint32(step)
  9790. } else {
  9791. i -= uint32(step)
  9792. }
  9793. }
  9794. }
  9795. }
  9796. *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*4)) = (*(*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)
  9797. if !(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*4)) != 0) {
  9798. return libc.UintptrFromInt32(0)
  9799. }
  9800. libc.Xmemset(tls, *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*4)), 0, createSize)
  9801. (*TNAMED)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*4)))).Fname = name
  9802. (*THASH_TABLE)(unsafe.Pointer(table)).Fused++
  9803. return *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*4))
  9804. }
  9805. func _hashTableClear(tls *libc.TLS, table uintptr) {
  9806. var i Tsize_t
  9807. _ = i
  9808. i = uint32(0)
  9809. for {
  9810. if !(i < (*THASH_TABLE)(unsafe.Pointer(table)).Fsize) {
  9811. break
  9812. }
  9813. (*(*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)*4)))
  9814. *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*4)) = libc.UintptrFromInt32(0)
  9815. goto _1
  9816. _1:
  9817. ;
  9818. i++
  9819. }
  9820. (*THASH_TABLE)(unsafe.Pointer(table)).Fused = uint32(0)
  9821. }
  9822. func _hashTableDestroy(tls *libc.TLS, table uintptr) {
  9823. var i Tsize_t
  9824. _ = i
  9825. i = uint32(0)
  9826. for {
  9827. if !(i < (*THASH_TABLE)(unsafe.Pointer(table)).Fsize) {
  9828. break
  9829. }
  9830. (*(*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)*4)))
  9831. goto _1
  9832. _1:
  9833. ;
  9834. i++
  9835. }
  9836. (*(*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)
  9837. }
  9838. func _hashTableInit(tls *libc.TLS, p uintptr, ms uintptr) {
  9839. (*THASH_TABLE)(unsafe.Pointer(p)).Fpower = uint8(0)
  9840. (*THASH_TABLE)(unsafe.Pointer(p)).Fsize = uint32(0)
  9841. (*THASH_TABLE)(unsafe.Pointer(p)).Fused = uint32(0)
  9842. (*THASH_TABLE)(unsafe.Pointer(p)).Fv = libc.UintptrFromInt32(0)
  9843. (*THASH_TABLE)(unsafe.Pointer(p)).Fmem = ms
  9844. }
  9845. func _hashTableIterInit(tls *libc.TLS, iter uintptr, table uintptr) {
  9846. var v1 uintptr
  9847. _ = v1
  9848. (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp = (*THASH_TABLE)(unsafe.Pointer(table)).Fv
  9849. if (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp != 0 {
  9850. v1 = (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp + uintptr((*THASH_TABLE)(unsafe.Pointer(table)).Fsize)*4
  9851. } else {
  9852. v1 = libc.UintptrFromInt32(0)
  9853. }
  9854. (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fend = v1
  9855. }
  9856. func _hashTableIterNext(tls *libc.TLS, iter uintptr) (r uintptr) {
  9857. var tem, v1, v2 uintptr
  9858. _, _, _ = tem, v1, v2
  9859. for (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp != (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fend {
  9860. v2 = iter
  9861. v1 = *(*uintptr)(unsafe.Pointer(v2))
  9862. *(*uintptr)(unsafe.Pointer(v2)) += 4
  9863. tem = *(*uintptr)(unsafe.Pointer(v1))
  9864. if tem != 0 {
  9865. return tem
  9866. }
  9867. }
  9868. return libc.UintptrFromInt32(0)
  9869. }
  9870. func _poolInit(tls *libc.TLS, pool uintptr, ms uintptr) {
  9871. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = libc.UintptrFromInt32(0)
  9872. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = libc.UintptrFromInt32(0)
  9873. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = libc.UintptrFromInt32(0)
  9874. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = libc.UintptrFromInt32(0)
  9875. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = libc.UintptrFromInt32(0)
  9876. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem = ms
  9877. }
  9878. func _poolClear(tls *libc.TLS, pool uintptr) {
  9879. var p, tem uintptr
  9880. _, _ = p, tem
  9881. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks != 0) {
  9882. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  9883. } else {
  9884. p = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  9885. for p != 0 {
  9886. tem = (*TBLOCK)(unsafe.Pointer(p)).Fnext
  9887. (*TBLOCK)(unsafe.Pointer(p)).Fnext = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  9888. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = p
  9889. p = tem
  9890. }
  9891. }
  9892. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = libc.UintptrFromInt32(0)
  9893. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = libc.UintptrFromInt32(0)
  9894. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = libc.UintptrFromInt32(0)
  9895. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = libc.UintptrFromInt32(0)
  9896. }
  9897. func _poolDestroy(tls *libc.TLS, pool uintptr) {
  9898. var p, tem, tem1 uintptr
  9899. _, _, _ = p, tem, tem1
  9900. p = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  9901. for p != 0 {
  9902. tem = (*TBLOCK)(unsafe.Pointer(p)).Fnext
  9903. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem)).Ffree_fcn})))(tls, p)
  9904. p = tem
  9905. }
  9906. p = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  9907. for p != 0 {
  9908. tem1 = (*TBLOCK)(unsafe.Pointer(p)).Fnext
  9909. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem)).Ffree_fcn})))(tls, p)
  9910. p = tem1
  9911. }
  9912. }
  9913. func _poolAppend(tls *libc.TLS, pool uintptr, enc uintptr, _ptr uintptr, end uintptr) (r uintptr) {
  9914. bp := tls.Alloc(16)
  9915. defer tls.Free(16)
  9916. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  9917. var convert_res _XML_Convert_Result
  9918. _ = convert_res
  9919. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr != 0) && !(_poolGrow(tls, pool) != 0) {
  9920. return libc.UintptrFromInt32(0)
  9921. }
  9922. for {
  9923. 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+12, (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend)
  9924. if convert_res == int32(_XML_CONVERT_COMPLETED) || convert_res == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  9925. break
  9926. }
  9927. if !(_poolGrow(tls, pool) != 0) {
  9928. return libc.UintptrFromInt32(0)
  9929. }
  9930. goto _1
  9931. _1:
  9932. }
  9933. return (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9934. }
  9935. func _poolCopyString(tls *libc.TLS, pool uintptr, s uintptr) (r uintptr) {
  9936. var v1, v4, v5 uintptr
  9937. var v3 int32
  9938. _, _, _, _ = v1, v3, v4, v5
  9939. for {
  9940. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  9941. v3 = 0
  9942. } else {
  9943. v5 = pool + 12
  9944. v4 = *(*uintptr)(unsafe.Pointer(v5))
  9945. *(*uintptr)(unsafe.Pointer(v5))++
  9946. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(s))
  9947. v3 = libc.Int32FromInt32(1)
  9948. }
  9949. if !(v3 != 0) {
  9950. return libc.UintptrFromInt32(0)
  9951. }
  9952. goto _2
  9953. _2:
  9954. ;
  9955. v1 = s
  9956. s++
  9957. if !(*(*TXML_Char)(unsafe.Pointer(v1)) != 0) {
  9958. break
  9959. }
  9960. }
  9961. s = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9962. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr
  9963. return s
  9964. }
  9965. func _poolCopyStringN(tls *libc.TLS, pool uintptr, s uintptr, n int32) (r uintptr) {
  9966. var v2 int32
  9967. var v3, v4 uintptr
  9968. _, _, _ = v2, v3, v4
  9969. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr != 0) && !(_poolGrow(tls, pool) != 0) {
  9970. /* The following line is unreachable given the current usage of
  9971. * poolCopyStringN(). Currently it is called from exactly one
  9972. * place to copy the text of a simple general entity. By that
  9973. * point, the name of the entity is already stored in the pool, so
  9974. * pool->ptr cannot be NULL.
  9975. *
  9976. * If poolCopyStringN() is used elsewhere as it well might be,
  9977. * this line may well become executable again. Regardless, this
  9978. * sort of check shouldn't be removed lightly, so we just exclude
  9979. * it from the coverage statistics.
  9980. */
  9981. return libc.UintptrFromInt32(0) /* LCOV_EXCL_LINE */
  9982. }
  9983. for {
  9984. if !(n > 0) {
  9985. break
  9986. }
  9987. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  9988. v2 = 0
  9989. } else {
  9990. v4 = pool + 12
  9991. v3 = *(*uintptr)(unsafe.Pointer(v4))
  9992. *(*uintptr)(unsafe.Pointer(v4))++
  9993. *(*TXML_Char)(unsafe.Pointer(v3)) = *(*TXML_Char)(unsafe.Pointer(s))
  9994. v2 = libc.Int32FromInt32(1)
  9995. }
  9996. if !(v2 != 0) {
  9997. return libc.UintptrFromInt32(0)
  9998. }
  9999. goto _1
  10000. _1:
  10001. ;
  10002. n--
  10003. s++
  10004. }
  10005. s = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  10006. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr
  10007. return s
  10008. }
  10009. func _poolAppendString(tls *libc.TLS, pool uintptr, s uintptr) (r uintptr) {
  10010. var v1 int32
  10011. var v2, v3 uintptr
  10012. _, _, _ = v1, v2, v3
  10013. for *(*TXML_Char)(unsafe.Pointer(s)) != 0 {
  10014. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  10015. v1 = 0
  10016. } else {
  10017. v3 = pool + 12
  10018. v2 = *(*uintptr)(unsafe.Pointer(v3))
  10019. *(*uintptr)(unsafe.Pointer(v3))++
  10020. *(*TXML_Char)(unsafe.Pointer(v2)) = *(*TXML_Char)(unsafe.Pointer(s))
  10021. v1 = libc.Int32FromInt32(1)
  10022. }
  10023. if !(v1 != 0) {
  10024. return libc.UintptrFromInt32(0)
  10025. }
  10026. s++
  10027. }
  10028. return (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  10029. }
  10030. func _poolStoreString(tls *libc.TLS, pool uintptr, enc uintptr, ptr uintptr, end uintptr) (r uintptr) {
  10031. var v1, v2 uintptr
  10032. _, _ = v1, v2
  10033. if !(_poolAppend(tls, pool, enc, ptr, end) != 0) {
  10034. return libc.UintptrFromInt32(0)
  10035. }
  10036. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  10037. return libc.UintptrFromInt32(0)
  10038. }
  10039. v2 = pool + 12
  10040. v1 = *(*uintptr)(unsafe.Pointer(v2))
  10041. *(*uintptr)(unsafe.Pointer(v2))++
  10042. *(*TXML_Char)(unsafe.Pointer(v1)) = uint8(0)
  10043. return (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  10044. }
  10045. func _poolBytesToAllocateFor(tls *libc.TLS, blockSize int32) (r Tsize_t) {
  10046. var bytesToAllocate, stretchedBlockSize int32
  10047. var stretch Tsize_t
  10048. _, _, _ = bytesToAllocate, stretch, stretchedBlockSize
  10049. /* Unprotected math would be:
  10050. ** return offsetof(BLOCK, s) + blockSize * sizeof(XML_Char);
  10051. **
  10052. ** Detect overflow, avoiding _signed_ overflow undefined behavior
  10053. ** For a + b * c we check b * c in isolation first, so that addition of a
  10054. ** on top has no chance of making us accept a small non-negative number
  10055. */
  10056. stretch = uint32(1) /* can be 4 bytes */
  10057. if blockSize <= 0 {
  10058. return uint32(0)
  10059. }
  10060. if blockSize > libc.Int32FromUint32(libc.Uint32FromInt32(m_INT_MAX)/stretch) {
  10061. return uint32(0)
  10062. }
  10063. stretchedBlockSize = blockSize * libc.Int32FromUint32(stretch)
  10064. bytesToAllocate = libc.Int32FromUint32(uint32(libc.UintptrFromInt32(0)+8) + libc.Uint32FromInt32(stretchedBlockSize))
  10065. if bytesToAllocate < 0 {
  10066. return uint32(0)
  10067. }
  10068. return libc.Uint32FromInt32(bytesToAllocate)
  10069. return r
  10070. }
  10071. func _poolGrow(tls *libc.TLS, pool uintptr) (r TXML_Bool) {
  10072. var blockSize, blockSize1 int32
  10073. var bytesToAllocate, bytesToAllocate1 Tsize_t
  10074. var offsetInsideBlock Tptrdiff_t
  10075. var tem, tem1, temp uintptr
  10076. _, _, _, _, _, _, _, _ = blockSize, blockSize1, bytesToAllocate, bytesToAllocate1, offsetInsideBlock, tem, tem1, temp
  10077. if (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks != 0 {
  10078. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart == uintptr(0) {
  10079. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  10080. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fnext
  10081. (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fnext = libc.UintptrFromInt32(0)
  10082. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 8
  10083. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart + uintptr((*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fsize)
  10084. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  10085. return libc.Uint8FromInt32(1)
  10086. }
  10087. if int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend)-int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart) < (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fsize {
  10088. tem = (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fnext
  10089. (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fnext = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  10090. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  10091. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = tem
  10092. libc.Xmemcpy(tls, (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks+8, (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart, libc.Uint32FromInt32(int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend)-int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))*uint32(1))
  10093. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 8 + uintptr(int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))
  10094. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 8
  10095. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart + uintptr((*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fsize)
  10096. return libc.Uint8FromInt32(1)
  10097. }
  10098. }
  10099. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks != 0 && (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks+8 {
  10100. blockSize = libc.Int32FromUint32(libc.Uint32FromInt32(int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend)-int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart)) * libc.Uint32FromUint32(2))
  10101. /* NOTE: Needs to be calculated prior to calling `realloc`
  10102. to avoid dangling pointers: */
  10103. offsetInsideBlock = int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr) - int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart)
  10104. if blockSize < 0 {
  10105. /* This condition traps a situation where either more than
  10106. * INT_MAX/2 bytes have already been allocated. This isn't
  10107. * readily testable, since it is unlikely that an average
  10108. * machine will have that much memory, so we exclude it from the
  10109. * coverage statistics.
  10110. */
  10111. return libc.Uint8FromInt32(0) /* LCOV_EXCL_LINE */
  10112. }
  10113. bytesToAllocate = _poolBytesToAllocateFor(tls, blockSize)
  10114. if bytesToAllocate == uint32(0) {
  10115. return libc.Uint8FromInt32(0)
  10116. }
  10117. 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, bytesToAllocate)
  10118. if temp == libc.UintptrFromInt32(0) {
  10119. return libc.Uint8FromInt32(0)
  10120. }
  10121. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = temp
  10122. (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fsize = blockSize
  10123. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 8 + uintptr(offsetInsideBlock)
  10124. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 8
  10125. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart + uintptr(blockSize)
  10126. } else {
  10127. blockSize1 = int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend) - int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart)
  10128. if blockSize1 < 0 {
  10129. /* This condition traps a situation where either more than
  10130. * INT_MAX bytes have already been allocated (which is prevented
  10131. * by various pieces of program logic, not least this one, never
  10132. * mind the unlikelihood of actually having that much memory) or
  10133. * the pool control fields have been corrupted (which could
  10134. * conceivably happen in an extremely buggy user handler
  10135. * function). Either way it isn't readily testable, so we
  10136. * exclude it from the coverage statistics.
  10137. */
  10138. return libc.Uint8FromInt32(0) /* LCOV_EXCL_LINE */
  10139. }
  10140. if blockSize1 < int32(m_INIT_BLOCK_SIZE) {
  10141. blockSize1 = int32(m_INIT_BLOCK_SIZE)
  10142. } else {
  10143. /* Detect overflow, avoiding _signed_ overflow undefined behavior */
  10144. if libc.Int32FromUint32(libc.Uint32FromInt32(blockSize1)*libc.Uint32FromUint32(2)) < 0 {
  10145. return libc.Uint8FromInt32(0)
  10146. }
  10147. blockSize1 *= int32(2)
  10148. }
  10149. bytesToAllocate1 = _poolBytesToAllocateFor(tls, blockSize1)
  10150. if bytesToAllocate1 == uint32(0) {
  10151. return libc.Uint8FromInt32(0)
  10152. }
  10153. 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)
  10154. if !(tem1 != 0) {
  10155. return libc.Uint8FromInt32(0)
  10156. }
  10157. (*TBLOCK)(unsafe.Pointer(tem1)).Fsize = blockSize1
  10158. (*TBLOCK)(unsafe.Pointer(tem1)).Fnext = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  10159. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = tem1
  10160. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr != (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart {
  10161. libc.Xmemcpy(tls, tem1+8, (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart, libc.Uint32FromInt32(int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))*uint32(1))
  10162. }
  10163. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = tem1 + 8 + uintptr(int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))
  10164. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = tem1 + 8
  10165. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = tem1 + 8 + uintptr(blockSize1)
  10166. }
  10167. return libc.Uint8FromInt32(1)
  10168. }
  10169. func _nextScaffoldPart(tls *libc.TLS, parser TXML_Parser) (r int32) {
  10170. var dtd, me, parent, temp, v2 uintptr
  10171. var next, v3, v4, v5 int32
  10172. var v1 uint32
  10173. _, _, _, _, _, _, _, _, _, _ = dtd, me, next, parent, temp, v1, v2, v3, v4, v5
  10174. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  10175. if !((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex != 0) {
  10176. (*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, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize*libc.Uint32FromInt64(4))
  10177. if !((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex != 0) {
  10178. return -int32(1)
  10179. }
  10180. *(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex)) = 0
  10181. }
  10182. if (*TDTD)(unsafe.Pointer(dtd)).FscaffCount >= (*TDTD)(unsafe.Pointer(dtd)).FscaffSize {
  10183. if (*TDTD)(unsafe.Pointer(dtd)).Fscaffold != 0 {
  10184. /* Detect and prevent integer overflow */
  10185. if (*TDTD)(unsafe.Pointer(dtd)).FscaffSize > libc.Uint32FromUint32(0xffffffff)/libc.Uint32FromUint32(2) {
  10186. return -int32(1)
  10187. }
  10188. /* Detect and prevent integer overflow.
  10189. * The preprocessor guard addresses the "always false" warning
  10190. * from -Wtype-limits on platforms where
  10191. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  10192. if (*TDTD)(unsafe.Pointer(dtd)).FscaffSize > libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromUint32(2)/libc.Uint32FromInt64(28) {
  10193. return -int32(1)
  10194. }
  10195. 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, (*TDTD)(unsafe.Pointer(dtd)).FscaffSize*libc.Uint32FromInt32(2)*libc.Uint32FromInt64(28))
  10196. if temp == libc.UintptrFromInt32(0) {
  10197. return -int32(1)
  10198. }
  10199. *(*uint32)(unsafe.Pointer(dtd + 172)) *= uint32(2)
  10200. } else {
  10201. temp = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint32FromInt32(m_INIT_SCAFFOLD_ELEMENTS)*libc.Uint32FromInt64(28))
  10202. if temp == libc.UintptrFromInt32(0) {
  10203. return -int32(1)
  10204. }
  10205. (*TDTD)(unsafe.Pointer(dtd)).FscaffSize = uint32(m_INIT_SCAFFOLD_ELEMENTS)
  10206. }
  10207. (*TDTD)(unsafe.Pointer(dtd)).Fscaffold = temp
  10208. }
  10209. v2 = dtd + 176
  10210. v1 = *(*uint32)(unsafe.Pointer(v2))
  10211. *(*uint32)(unsafe.Pointer(v2))++
  10212. next = libc.Int32FromUint32(v1)
  10213. me = (*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(next)*28
  10214. if (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel != 0 {
  10215. parent = (*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(*(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel-int32(1))*4)))*28
  10216. if (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Flastchild != 0 {
  10217. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr((*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Flastchild)*28))).Fnextsib = next
  10218. }
  10219. if !((*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Fchildcnt != 0) {
  10220. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Ffirstchild = next
  10221. }
  10222. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Flastchild = next
  10223. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Fchildcnt++
  10224. }
  10225. v5 = libc.Int32FromInt32(0)
  10226. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Fnextsib = v5
  10227. v4 = v5
  10228. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Fchildcnt = v4
  10229. v3 = v4
  10230. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Flastchild = v3
  10231. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Ffirstchild = v3
  10232. return next
  10233. }
  10234. func _build_model(tls *libc.TLS, parser TXML_Parser) (r uintptr) {
  10235. var allocsize Tsize_t
  10236. var cn, src_node int32
  10237. var dest, destLimit, dtd, jobDest, ret, src, str, v1, v4, v6 uintptr
  10238. var i uint32
  10239. _, _, _, _, _, _, _, _, _, _, _, _, _, _ = allocsize, cn, dest, destLimit, dtd, i, jobDest, ret, src, src_node, str, v1, v4, v6
  10240. /* Function build_model transforms the existing parser->m_dtd->scaffold
  10241. * array of CONTENT_SCAFFOLD tree nodes into a new array of
  10242. * XML_Content tree nodes followed by a gapless list of zero-terminated
  10243. * strings. */
  10244. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* the current string writing location */
  10245. /* Detect and prevent integer overflow.
  10246. * The preprocessor guard addresses the "always false" warning
  10247. * from -Wtype-limits on platforms where
  10248. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  10249. if (*TDTD)(unsafe.Pointer(dtd)).FscaffCount > libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromInt64(20) {
  10250. return libc.UintptrFromInt32(0)
  10251. }
  10252. if (*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen > libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromInt64(1) {
  10253. return libc.UintptrFromInt32(0)
  10254. }
  10255. if (*TDTD)(unsafe.Pointer(dtd)).FscaffCount*uint32(20) > libc.Uint32FromInt32(-libc.Int32FromInt32(1))-(*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen*uint32(1) {
  10256. return libc.UintptrFromInt32(0)
  10257. }
  10258. allocsize = (*TDTD)(unsafe.Pointer(dtd)).FscaffCount*libc.Uint32FromInt64(20) + (*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen*libc.Uint32FromInt64(1)
  10259. ret = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, allocsize)
  10260. if !(ret != 0) {
  10261. return libc.UintptrFromInt32(0)
  10262. }
  10263. /* What follows is an iterative implementation (of what was previously done
  10264. * recursively in a dedicated function called "build_node". The old recursive
  10265. * build_node could be forced into stack exhaustion from input as small as a
  10266. * few megabyte, and so that was a security issue. Hence, a function call
  10267. * stack is avoided now by resolving recursion.)
  10268. *
  10269. * The iterative approach works as follows:
  10270. *
  10271. * - We have two writing pointers, both walking up the result array; one does
  10272. * the work, the other creates "jobs" for its colleague to do, and leads
  10273. * the way:
  10274. *
  10275. * - The faster one, pointer jobDest, always leads and writes "what job
  10276. * to do" by the other, once they reach that place in the
  10277. * array: leader "jobDest" stores the source node array index (relative
  10278. * to array dtd->scaffold) in field "numchildren".
  10279. *
  10280. * - The slower one, pointer dest, looks at the value stored in the
  10281. * "numchildren" field (which actually holds a source node array index
  10282. * at that time) and puts the real data from dtd->scaffold in.
  10283. *
  10284. * - Before the loop starts, jobDest writes source array index 0
  10285. * (where the root node is located) so that dest will have something to do
  10286. * when it starts operation.
  10287. *
  10288. * - Whenever nodes with children are encountered, jobDest appends
  10289. * them as new jobs, in order. As a result, tree node siblings are
  10290. * adjacent in the resulting array, for example:
  10291. *
  10292. * [0] root, has two children
  10293. * [1] first child of 0, has three children
  10294. * [3] first child of 1, does not have children
  10295. * [4] second child of 1, does not have children
  10296. * [5] third child of 1, does not have children
  10297. * [2] second child of 0, does not have children
  10298. *
  10299. * Or (the same data) presented in flat array view:
  10300. *
  10301. * [0] root, has two children
  10302. *
  10303. * [1] first child of 0, has three children
  10304. * [2] second child of 0, does not have children
  10305. *
  10306. * [3] first child of 1, does not have children
  10307. * [4] second child of 1, does not have children
  10308. * [5] third child of 1, does not have children
  10309. *
  10310. * - The algorithm repeats until all target array indices have been processed.
  10311. */
  10312. dest = ret /* tree node writing location, moves upwards */
  10313. destLimit = ret + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*20
  10314. jobDest = ret /* next free writing location in target array */
  10315. str = ret + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*20
  10316. /* Add the starting job, the root node (index 0) of the source tree */
  10317. v1 = jobDest
  10318. jobDest += 20
  10319. (*TXML_Content)(unsafe.Pointer(v1)).Fnumchildren = uint32(0)
  10320. for {
  10321. if !(dest < destLimit) {
  10322. break
  10323. }
  10324. /* Retrieve source tree array index from job storage */
  10325. src_node = libc.Int32FromUint32((*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren)
  10326. /* Convert item */
  10327. (*TXML_Content)(unsafe.Pointer(dest)).Ftype1 = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*28))).Ftype1
  10328. (*TXML_Content)(unsafe.Pointer(dest)).Fquant = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*28))).Fquant
  10329. if (*TXML_Content)(unsafe.Pointer(dest)).Ftype1 == int32(_XML_CTYPE_NAME) {
  10330. (*TXML_Content)(unsafe.Pointer(dest)).Fname = str
  10331. src = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*28))).Fname
  10332. for {
  10333. v4 = str
  10334. str++
  10335. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(src))
  10336. if !(*(*TXML_Char)(unsafe.Pointer(src)) != 0) {
  10337. break
  10338. }
  10339. src++
  10340. goto _3
  10341. _3:
  10342. }
  10343. (*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren = uint32(0)
  10344. (*TXML_Content)(unsafe.Pointer(dest)).Fchildren = libc.UintptrFromInt32(0)
  10345. } else {
  10346. (*TXML_Content)(unsafe.Pointer(dest)).Fname = libc.UintptrFromInt32(0)
  10347. (*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren = libc.Uint32FromInt32((*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*28))).Fchildcnt)
  10348. (*TXML_Content)(unsafe.Pointer(dest)).Fchildren = jobDest
  10349. /* Append scaffold indices of children to array */
  10350. i = uint32(0)
  10351. cn = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*28))).Ffirstchild
  10352. for {
  10353. if !(i < (*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren) {
  10354. break
  10355. }
  10356. v6 = jobDest
  10357. jobDest += 20
  10358. (*TXML_Content)(unsafe.Pointer(v6)).Fnumchildren = libc.Uint32FromInt32(cn)
  10359. goto _5
  10360. _5:
  10361. ;
  10362. i++
  10363. cn = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(cn)*28))).Fnextsib
  10364. }
  10365. }
  10366. goto _2
  10367. _2:
  10368. ;
  10369. dest += 20
  10370. }
  10371. return ret
  10372. }
  10373. func _getElementType(tls *libc.TLS, parser TXML_Parser, enc uintptr, ptr uintptr, end uintptr) (r uintptr) {
  10374. var dtd, name, ret uintptr
  10375. _, _, _ = dtd, name, ret
  10376. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  10377. name = _poolStoreString(tls, dtd+80, enc, ptr, end)
  10378. if !(name != 0) {
  10379. return libc.UintptrFromInt32(0)
  10380. }
  10381. ret = _lookup(tls, parser, dtd+20, name, uint32(24))
  10382. if !(ret != 0) {
  10383. return libc.UintptrFromInt32(0)
  10384. }
  10385. if (*TELEMENT_TYPE)(unsafe.Pointer(ret)).Fname != name {
  10386. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart
  10387. } else {
  10388. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr
  10389. if !(_setElementTypePrefix(tls, parser, ret) != 0) {
  10390. return libc.UintptrFromInt32(0)
  10391. }
  10392. }
  10393. return ret
  10394. }
  10395. func _copyString(tls *libc.TLS, s uintptr, memsuite uintptr) (r uintptr) {
  10396. var charsRequired Tsize_t
  10397. var result uintptr
  10398. _, _ = charsRequired, result
  10399. charsRequired = uint32(0)
  10400. /* First determine how long the string is */
  10401. for libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s + uintptr(charsRequired)))) != 0 {
  10402. charsRequired++
  10403. }
  10404. /* Include the terminator */
  10405. charsRequired++
  10406. /* Now allocate space for the copy */
  10407. result = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Fmalloc_fcn})))(tls, charsRequired*uint32(1))
  10408. if result == libc.UintptrFromInt32(0) {
  10409. return libc.UintptrFromInt32(0)
  10410. }
  10411. /* Copy the original into place */
  10412. libc.Xmemcpy(tls, result, s, charsRequired*uint32(1))
  10413. return result
  10414. }
  10415. func _accountingGetCurrentAmplification(tls *libc.TLS, rootParser TXML_Parser) (r float32) {
  10416. var amplificationFactor, v1 float32
  10417. var countBytesOutput TXmlBigCount
  10418. _, _, _ = amplificationFactor, countBytesOutput, v1
  10419. countBytesOutput = (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect + (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesIndirect
  10420. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect != 0 {
  10421. v1 = float32(countBytesOutput) / float32((*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect)
  10422. } else {
  10423. v1 = libc.Float32FromFloat32(1)
  10424. }
  10425. amplificationFactor = v1
  10426. return amplificationFactor
  10427. }
  10428. func _accountingReportStats(tls *libc.TLS, originParser TXML_Parser, epilog uintptr) {
  10429. bp := tls.Alloc(48)
  10430. defer tls.Free(48)
  10431. var amplificationFactor float32
  10432. var rootParser TXML_Parser
  10433. _, _ = amplificationFactor, rootParser
  10434. rootParser = _getRootParserOf(tls, originParser, libc.UintptrFromInt32(0))
  10435. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FdebugLevel < int32(1) {
  10436. return
  10437. }
  10438. amplificationFactor = _accountingGetCurrentAmplification(tls, rootParser)
  10439. 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))
  10440. }
  10441. func _accountingOnAbort(tls *libc.TLS, originParser TXML_Parser) {
  10442. _accountingReportStats(tls, originParser, __ccgo_ts+1748)
  10443. }
  10444. func _accountingReportDiff(tls *libc.TLS, rootParser TXML_Parser, levelsAwayFromRootParser uint32, before uintptr, after uintptr, bytesMore Tptrdiff_t, source_line int32, account _XML_Account) {
  10445. bp := tls.Alloc(64)
  10446. defer tls.Free(64)
  10447. var contextLength uint32
  10448. var ellipsisLength Tsize_t
  10449. var walker, v1 uintptr
  10450. var _ /* ellipis at bp+0 */ [5]uint8
  10451. _, _, _, _ = contextLength, ellipsisLength, walker, v1
  10452. if account == int32(_XML_ACCOUNT_DIRECT) {
  10453. v1 = __ccgo_ts + 1759
  10454. } else {
  10455. v1 = __ccgo_ts + 1763
  10456. }
  10457. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1767, libc.VaList(bp+16, bytesMore, v1, levelsAwayFromRootParser, source_line, int32(10), __ccgo_ts+1807))
  10458. *(*[5]uint8)(unsafe.Pointer(bp)) = [5]uint8{'[', '.', '.', ']'}
  10459. ellipsisLength = libc.Uint32FromInt64(5) - libc.Uint32FromInt32(1)
  10460. contextLength = uint32(10)
  10461. /* Note: Performance is of no concern here */
  10462. walker = before
  10463. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FdebugLevel >= int32(3) || int32(after)-int32(before) <= libc.Int32FromUint32(contextLength+ellipsisLength+contextLength) {
  10464. for {
  10465. if !(walker < after) {
  10466. break
  10467. }
  10468. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1808, libc.VaList(bp+16, XunsignedCharToPrintable(tls, *(*uint8)(unsafe.Pointer(walker)))))
  10469. goto _2
  10470. _2:
  10471. ;
  10472. walker++
  10473. }
  10474. } else {
  10475. for {
  10476. if !(walker < before+uintptr(contextLength)) {
  10477. break
  10478. }
  10479. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1808, libc.VaList(bp+16, XunsignedCharToPrintable(tls, *(*uint8)(unsafe.Pointer(walker)))))
  10480. goto _3
  10481. _3:
  10482. ;
  10483. walker++
  10484. }
  10485. libc.Xfprintf(tls, libc.Xstderr, bp, 0)
  10486. walker = after - uintptr(contextLength)
  10487. for {
  10488. if !(walker < after) {
  10489. break
  10490. }
  10491. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1808, libc.VaList(bp+16, XunsignedCharToPrintable(tls, *(*uint8)(unsafe.Pointer(walker)))))
  10492. goto _4
  10493. _4:
  10494. ;
  10495. walker++
  10496. }
  10497. }
  10498. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1811, 0)
  10499. }
  10500. func _accountingDiffTolerated(tls *libc.TLS, originParser TXML_Parser, tok int32, before uintptr, after uintptr, source_line int32, account _XML_Account) (r TXML_Bool) {
  10501. bp := tls.Alloc(16)
  10502. defer tls.Free(16)
  10503. var additionTarget, v1 uintptr
  10504. var amplificationFactor float32
  10505. var bytesMore Tptrdiff_t
  10506. var countBytesOutput TXmlBigCount
  10507. var isDirect int32
  10508. var rootParser TXML_Parser
  10509. var tolerated TXML_Bool
  10510. var _ /* levelsAwayFromRootParser at bp+0 */ uint32
  10511. _, _, _, _, _, _, _, _ = additionTarget, amplificationFactor, bytesMore, countBytesOutput, isDirect, rootParser, tolerated, v1
  10512. /* Note: We need to check the token type *first* to be sure that
  10513. * we can even access variable <after>, safely.
  10514. * E.g. for XML_TOK_NONE <after> may hold an invalid pointer. */
  10515. switch tok {
  10516. case m_XML_TOK_INVALID:
  10517. fallthrough
  10518. case -int32(1):
  10519. fallthrough
  10520. case -int32(2):
  10521. fallthrough
  10522. case -int32(4):
  10523. return libc.Uint8FromInt32(1)
  10524. }
  10525. if account == int32(_XML_ACCOUNT_NONE) {
  10526. return libc.Uint8FromInt32(1)
  10527. }
  10528. rootParser = _getRootParserOf(tls, originParser, bp)
  10529. isDirect = libc.BoolInt32(account == int32(_XML_ACCOUNT_DIRECT) && originParser == rootParser)
  10530. bytesMore = int32(after) - int32(before)
  10531. if isDirect != 0 {
  10532. v1 = rootParser + 496
  10533. } else {
  10534. v1 = rootParser + 496 + 8
  10535. }
  10536. additionTarget = v1
  10537. /* Detect and avoid integer overflow */
  10538. if *(*TXmlBigCount)(unsafe.Pointer(additionTarget)) > libc.Uint64FromInt32(-libc.Int32FromInt32(1))-libc.Uint64FromInt32(bytesMore) {
  10539. return libc.Uint8FromInt32(0)
  10540. }
  10541. *(*TXmlBigCount)(unsafe.Pointer(additionTarget)) += libc.Uint64FromInt32(bytesMore)
  10542. countBytesOutput = (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect + (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesIndirect
  10543. amplificationFactor = _accountingGetCurrentAmplification(tls, rootParser)
  10544. tolerated = libc.BoolUint8(countBytesOutput < (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FactivationThresholdBytes || amplificationFactor <= (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FmaximumAmplificationFactor)
  10545. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FdebugLevel >= int32(2) {
  10546. _accountingReportStats(tls, rootParser, __ccgo_ts+1807)
  10547. _accountingReportDiff(tls, rootParser, *(*uint32)(unsafe.Pointer(bp)), before, after, bytesMore, source_line, account)
  10548. }
  10549. return tolerated
  10550. }
  10551. func XtestingAccountingGetCountBytesDirect(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  10552. if !(parser != 0) {
  10553. return uint64(0)
  10554. }
  10555. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FcountBytesDirect
  10556. }
  10557. func XtestingAccountingGetCountBytesIndirect(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  10558. if !(parser != 0) {
  10559. return uint64(0)
  10560. }
  10561. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FcountBytesIndirect
  10562. }
  10563. func _entityTrackingReportStats(tls *libc.TLS, rootParser TXML_Parser, entity uintptr, action uintptr, sourceLine int32) {
  10564. bp := tls.Alloc(96)
  10565. defer tls.Free(96)
  10566. var entityName, v1 uintptr
  10567. _, _ = entityName, v1
  10568. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FdebugLevel < int32(1) {
  10569. return
  10570. }
  10571. entityName = (*TENTITY)(unsafe.Pointer(entity)).Fname
  10572. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  10573. v1 = __ccgo_ts + 1814
  10574. } else {
  10575. v1 = __ccgo_ts + 1816
  10576. }
  10577. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1818, 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+1807, v1, entityName, action, (*TENTITY)(unsafe.Pointer(entity)).FtextLen, sourceLine))
  10578. }
  10579. func _entityTrackingOnOpen(tls *libc.TLS, originParser TXML_Parser, entity uintptr, sourceLine int32) {
  10580. var rootParser TXML_Parser
  10581. _ = rootParser
  10582. rootParser = _getRootParserOf(tls, originParser, libc.UintptrFromInt32(0))
  10583. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcountEverOpened++
  10584. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcurrentDepth++
  10585. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcurrentDepth > (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FmaximumDepthSeen {
  10586. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FmaximumDepthSeen++
  10587. }
  10588. _entityTrackingReportStats(tls, rootParser, entity, __ccgo_ts+1903, sourceLine)
  10589. }
  10590. func _entityTrackingOnClose(tls *libc.TLS, originParser TXML_Parser, entity uintptr, sourceLine int32) {
  10591. var rootParser TXML_Parser
  10592. _ = rootParser
  10593. rootParser = _getRootParserOf(tls, originParser, libc.UintptrFromInt32(0))
  10594. _entityTrackingReportStats(tls, rootParser, entity, __ccgo_ts+1909, sourceLine)
  10595. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcurrentDepth--
  10596. }
  10597. func _getRootParserOf(tls *libc.TLS, parser TXML_Parser, outLevelDiff uintptr) (r TXML_Parser) {
  10598. var rootParser TXML_Parser
  10599. var stepsTakenUpwards uint32
  10600. _, _ = rootParser, stepsTakenUpwards
  10601. rootParser = parser
  10602. stepsTakenUpwards = uint32(0)
  10603. for (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_parentParser != 0 {
  10604. rootParser = (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_parentParser
  10605. stepsTakenUpwards++
  10606. }
  10607. if outLevelDiff != libc.UintptrFromInt32(0) {
  10608. *(*uint32)(unsafe.Pointer(outLevelDiff)) = stepsTakenUpwards
  10609. }
  10610. return rootParser
  10611. }
  10612. func XunsignedCharToPrintable(tls *libc.TLS, c uint8) (r uintptr) {
  10613. switch libc.Int32FromUint8(c) {
  10614. case 0:
  10615. return __ccgo_ts + 1915
  10616. case int32(1):
  10617. return __ccgo_ts + 1918
  10618. case int32(2):
  10619. return __ccgo_ts + 1922
  10620. case int32(3):
  10621. return __ccgo_ts + 1926
  10622. case int32(4):
  10623. return __ccgo_ts + 1930
  10624. case int32(5):
  10625. return __ccgo_ts + 1934
  10626. case int32(6):
  10627. return __ccgo_ts + 1938
  10628. case int32(7):
  10629. return __ccgo_ts + 1942
  10630. case int32(8):
  10631. return __ccgo_ts + 1946
  10632. case int32(9):
  10633. return __ccgo_ts + 1950
  10634. case int32(10):
  10635. return __ccgo_ts + 1953
  10636. case int32(11):
  10637. return __ccgo_ts + 1956
  10638. case int32(12):
  10639. return __ccgo_ts + 1960
  10640. case int32(13):
  10641. return __ccgo_ts + 1964
  10642. case int32(14):
  10643. return __ccgo_ts + 1967
  10644. case int32(15):
  10645. return __ccgo_ts + 1971
  10646. case int32(16):
  10647. return __ccgo_ts + 1975
  10648. case int32(17):
  10649. return __ccgo_ts + 1980
  10650. case int32(18):
  10651. return __ccgo_ts + 1985
  10652. case int32(19):
  10653. return __ccgo_ts + 1990
  10654. case int32(20):
  10655. return __ccgo_ts + 1995
  10656. case int32(21):
  10657. return __ccgo_ts + 2000
  10658. case int32(22):
  10659. return __ccgo_ts + 2005
  10660. case int32(23):
  10661. return __ccgo_ts + 2010
  10662. case int32(24):
  10663. return __ccgo_ts + 2015
  10664. case int32(25):
  10665. return __ccgo_ts + 2020
  10666. case int32(26):
  10667. return __ccgo_ts + 2025
  10668. case int32(27):
  10669. return __ccgo_ts + 2030
  10670. case int32(28):
  10671. return __ccgo_ts + 2035
  10672. case int32(29):
  10673. return __ccgo_ts + 2040
  10674. case int32(30):
  10675. return __ccgo_ts + 2045
  10676. case int32(31):
  10677. return __ccgo_ts + 2050
  10678. case int32(32):
  10679. return __ccgo_ts + 2055
  10680. case int32(33):
  10681. return __ccgo_ts + 2057
  10682. case int32(34):
  10683. return __ccgo_ts + 2059
  10684. case int32(35):
  10685. return __ccgo_ts + 2062
  10686. case int32(36):
  10687. return __ccgo_ts + 2064
  10688. case int32(37):
  10689. return __ccgo_ts + 1814
  10690. case int32(38):
  10691. return __ccgo_ts + 1816
  10692. case int32(39):
  10693. return __ccgo_ts + 2066
  10694. case int32(40):
  10695. return __ccgo_ts + 2068
  10696. case int32(41):
  10697. return __ccgo_ts + 2070
  10698. case int32(42):
  10699. return __ccgo_ts + 2072
  10700. case int32(43):
  10701. return __ccgo_ts + 2074
  10702. case int32(44):
  10703. return __ccgo_ts + 2076
  10704. case int32(45):
  10705. return __ccgo_ts + 2078
  10706. case int32(46):
  10707. return __ccgo_ts + 2080
  10708. case int32(47):
  10709. return __ccgo_ts + 2082
  10710. case int32(48):
  10711. return __ccgo_ts + 2084
  10712. case int32(49):
  10713. return __ccgo_ts + 2086
  10714. case int32(50):
  10715. return __ccgo_ts + 2088
  10716. case int32(51):
  10717. return __ccgo_ts + 2090
  10718. case int32(52):
  10719. return __ccgo_ts + 2092
  10720. case int32(53):
  10721. return __ccgo_ts + 2094
  10722. case int32(54):
  10723. return __ccgo_ts + 2096
  10724. case int32(55):
  10725. return __ccgo_ts + 2098
  10726. case int32(56):
  10727. return __ccgo_ts + 2100
  10728. case int32(57):
  10729. return __ccgo_ts + 2102
  10730. case int32(58):
  10731. return __ccgo_ts + 2104
  10732. case int32(59):
  10733. return __ccgo_ts + 2106
  10734. case int32(60):
  10735. return __ccgo_ts + 2108
  10736. case int32(61):
  10737. return __ccgo_ts + 2110
  10738. case int32(62):
  10739. return __ccgo_ts + 2112
  10740. case int32(63):
  10741. return __ccgo_ts + 2114
  10742. case int32(64):
  10743. return __ccgo_ts + 2116
  10744. case int32(65):
  10745. return __ccgo_ts + 2118
  10746. case int32(66):
  10747. return __ccgo_ts + 2120
  10748. case int32(67):
  10749. return __ccgo_ts + 2122
  10750. case int32(68):
  10751. return __ccgo_ts + 2124
  10752. case int32(69):
  10753. return __ccgo_ts + 2126
  10754. case int32(70):
  10755. return __ccgo_ts + 2128
  10756. case int32(71):
  10757. return __ccgo_ts + 2130
  10758. case int32(72):
  10759. return __ccgo_ts + 2132
  10760. case int32(73):
  10761. return __ccgo_ts + 2134
  10762. case int32(74):
  10763. return __ccgo_ts + 2136
  10764. case int32(75):
  10765. return __ccgo_ts + 2138
  10766. case int32(76):
  10767. return __ccgo_ts + 2140
  10768. case int32(77):
  10769. return __ccgo_ts + 2142
  10770. case int32(78):
  10771. return __ccgo_ts + 2144
  10772. case int32(79):
  10773. return __ccgo_ts + 2146
  10774. case int32(80):
  10775. return __ccgo_ts + 2148
  10776. case int32(81):
  10777. return __ccgo_ts + 2150
  10778. case int32(82):
  10779. return __ccgo_ts + 2152
  10780. case int32(83):
  10781. return __ccgo_ts + 2154
  10782. case int32(84):
  10783. return __ccgo_ts + 2156
  10784. case int32(85):
  10785. return __ccgo_ts + 2158
  10786. case int32(86):
  10787. return __ccgo_ts + 2160
  10788. case int32(87):
  10789. return __ccgo_ts + 2162
  10790. case int32(88):
  10791. return __ccgo_ts + 2164
  10792. case int32(89):
  10793. return __ccgo_ts + 2166
  10794. case int32(90):
  10795. return __ccgo_ts + 2168
  10796. case int32(91):
  10797. return __ccgo_ts + 2170
  10798. case int32(92):
  10799. return __ccgo_ts + 2172
  10800. case int32(93):
  10801. return __ccgo_ts + 2175
  10802. case int32(94):
  10803. return __ccgo_ts + 2177
  10804. case int32(95):
  10805. return __ccgo_ts + 2179
  10806. case int32(96):
  10807. return __ccgo_ts + 2181
  10808. case int32(97):
  10809. return __ccgo_ts + 2183
  10810. case int32(98):
  10811. return __ccgo_ts + 2185
  10812. case int32(99):
  10813. return __ccgo_ts + 2187
  10814. case int32(100):
  10815. return __ccgo_ts + 2189
  10816. case int32(101):
  10817. return __ccgo_ts + 2191
  10818. case int32(102):
  10819. return __ccgo_ts + 2193
  10820. case int32(103):
  10821. return __ccgo_ts + 2195
  10822. case int32(104):
  10823. return __ccgo_ts + 2197
  10824. case int32(105):
  10825. return __ccgo_ts + 2199
  10826. case int32(106):
  10827. return __ccgo_ts + 2201
  10828. case int32(107):
  10829. return __ccgo_ts + 2203
  10830. case int32(108):
  10831. return __ccgo_ts + 2205
  10832. case int32(109):
  10833. return __ccgo_ts + 2207
  10834. case int32(110):
  10835. return __ccgo_ts + 2209
  10836. case int32(111):
  10837. return __ccgo_ts + 2211
  10838. case int32(112):
  10839. return __ccgo_ts + 2213
  10840. case int32(113):
  10841. return __ccgo_ts + 2215
  10842. case int32(114):
  10843. return __ccgo_ts + 2217
  10844. case int32(115):
  10845. return __ccgo_ts + 2219
  10846. case int32(116):
  10847. return __ccgo_ts + 2221
  10848. case int32(117):
  10849. return __ccgo_ts + 2223
  10850. case int32(118):
  10851. return __ccgo_ts + 2225
  10852. case int32(119):
  10853. return __ccgo_ts + 2227
  10854. case int32(120):
  10855. return __ccgo_ts + 2229
  10856. case int32(121):
  10857. return __ccgo_ts + 2231
  10858. case int32(122):
  10859. return __ccgo_ts + 2233
  10860. case int32(123):
  10861. return __ccgo_ts + 2235
  10862. case int32(124):
  10863. return __ccgo_ts + 2237
  10864. case int32(125):
  10865. return __ccgo_ts + 2239
  10866. case int32(126):
  10867. return __ccgo_ts + 2241
  10868. case int32(127):
  10869. return __ccgo_ts + 2243
  10870. case int32(128):
  10871. return __ccgo_ts + 2248
  10872. case int32(129):
  10873. return __ccgo_ts + 2253
  10874. case int32(130):
  10875. return __ccgo_ts + 2258
  10876. case int32(131):
  10877. return __ccgo_ts + 2263
  10878. case int32(132):
  10879. return __ccgo_ts + 2268
  10880. case int32(133):
  10881. return __ccgo_ts + 2273
  10882. case int32(134):
  10883. return __ccgo_ts + 2278
  10884. case int32(135):
  10885. return __ccgo_ts + 2283
  10886. case int32(136):
  10887. return __ccgo_ts + 2288
  10888. case int32(137):
  10889. return __ccgo_ts + 2293
  10890. case int32(138):
  10891. return __ccgo_ts + 2298
  10892. case int32(139):
  10893. return __ccgo_ts + 2303
  10894. case int32(140):
  10895. return __ccgo_ts + 2308
  10896. case int32(141):
  10897. return __ccgo_ts + 2313
  10898. case int32(142):
  10899. return __ccgo_ts + 2318
  10900. case int32(143):
  10901. return __ccgo_ts + 2323
  10902. case int32(144):
  10903. return __ccgo_ts + 2328
  10904. case int32(145):
  10905. return __ccgo_ts + 2333
  10906. case int32(146):
  10907. return __ccgo_ts + 2338
  10908. case int32(147):
  10909. return __ccgo_ts + 2343
  10910. case int32(148):
  10911. return __ccgo_ts + 2348
  10912. case int32(149):
  10913. return __ccgo_ts + 2353
  10914. case int32(150):
  10915. return __ccgo_ts + 2358
  10916. case int32(151):
  10917. return __ccgo_ts + 2363
  10918. case int32(152):
  10919. return __ccgo_ts + 2368
  10920. case int32(153):
  10921. return __ccgo_ts + 2373
  10922. case int32(154):
  10923. return __ccgo_ts + 2378
  10924. case int32(155):
  10925. return __ccgo_ts + 2383
  10926. case int32(156):
  10927. return __ccgo_ts + 2388
  10928. case int32(157):
  10929. return __ccgo_ts + 2393
  10930. case int32(158):
  10931. return __ccgo_ts + 2398
  10932. case int32(159):
  10933. return __ccgo_ts + 2403
  10934. case int32(160):
  10935. return __ccgo_ts + 2408
  10936. case int32(161):
  10937. return __ccgo_ts + 2413
  10938. case int32(162):
  10939. return __ccgo_ts + 2418
  10940. case int32(163):
  10941. return __ccgo_ts + 2423
  10942. case int32(164):
  10943. return __ccgo_ts + 2428
  10944. case int32(165):
  10945. return __ccgo_ts + 2433
  10946. case int32(166):
  10947. return __ccgo_ts + 2438
  10948. case int32(167):
  10949. return __ccgo_ts + 2443
  10950. case int32(168):
  10951. return __ccgo_ts + 2448
  10952. case int32(169):
  10953. return __ccgo_ts + 2453
  10954. case int32(170):
  10955. return __ccgo_ts + 2458
  10956. case int32(171):
  10957. return __ccgo_ts + 2463
  10958. case int32(172):
  10959. return __ccgo_ts + 2468
  10960. case int32(173):
  10961. return __ccgo_ts + 2473
  10962. case int32(174):
  10963. return __ccgo_ts + 2478
  10964. case int32(175):
  10965. return __ccgo_ts + 2483
  10966. case int32(176):
  10967. return __ccgo_ts + 2488
  10968. case int32(177):
  10969. return __ccgo_ts + 2493
  10970. case int32(178):
  10971. return __ccgo_ts + 2498
  10972. case int32(179):
  10973. return __ccgo_ts + 2503
  10974. case int32(180):
  10975. return __ccgo_ts + 2508
  10976. case int32(181):
  10977. return __ccgo_ts + 2513
  10978. case int32(182):
  10979. return __ccgo_ts + 2518
  10980. case int32(183):
  10981. return __ccgo_ts + 2523
  10982. case int32(184):
  10983. return __ccgo_ts + 2528
  10984. case int32(185):
  10985. return __ccgo_ts + 2533
  10986. case int32(186):
  10987. return __ccgo_ts + 2538
  10988. case int32(187):
  10989. return __ccgo_ts + 2543
  10990. case int32(188):
  10991. return __ccgo_ts + 2548
  10992. case int32(189):
  10993. return __ccgo_ts + 2553
  10994. case int32(190):
  10995. return __ccgo_ts + 2558
  10996. case int32(191):
  10997. return __ccgo_ts + 2563
  10998. case int32(192):
  10999. return __ccgo_ts + 2568
  11000. case int32(193):
  11001. return __ccgo_ts + 2573
  11002. case int32(194):
  11003. return __ccgo_ts + 2578
  11004. case int32(195):
  11005. return __ccgo_ts + 2583
  11006. case int32(196):
  11007. return __ccgo_ts + 2588
  11008. case int32(197):
  11009. return __ccgo_ts + 2593
  11010. case int32(198):
  11011. return __ccgo_ts + 2598
  11012. case int32(199):
  11013. return __ccgo_ts + 2603
  11014. case int32(200):
  11015. return __ccgo_ts + 2608
  11016. case int32(201):
  11017. return __ccgo_ts + 2613
  11018. case int32(202):
  11019. return __ccgo_ts + 2618
  11020. case int32(203):
  11021. return __ccgo_ts + 2623
  11022. case int32(204):
  11023. return __ccgo_ts + 2628
  11024. case int32(205):
  11025. return __ccgo_ts + 2633
  11026. case int32(206):
  11027. return __ccgo_ts + 2638
  11028. case int32(207):
  11029. return __ccgo_ts + 2643
  11030. case int32(208):
  11031. return __ccgo_ts + 2648
  11032. case int32(209):
  11033. return __ccgo_ts + 2653
  11034. case int32(210):
  11035. return __ccgo_ts + 2658
  11036. case int32(211):
  11037. return __ccgo_ts + 2663
  11038. case int32(212):
  11039. return __ccgo_ts + 2668
  11040. case int32(213):
  11041. return __ccgo_ts + 2673
  11042. case int32(214):
  11043. return __ccgo_ts + 2678
  11044. case int32(215):
  11045. return __ccgo_ts + 2683
  11046. case int32(216):
  11047. return __ccgo_ts + 2688
  11048. case int32(217):
  11049. return __ccgo_ts + 2693
  11050. case int32(218):
  11051. return __ccgo_ts + 2698
  11052. case int32(219):
  11053. return __ccgo_ts + 2703
  11054. case int32(220):
  11055. return __ccgo_ts + 2708
  11056. case int32(221):
  11057. return __ccgo_ts + 2713
  11058. case int32(222):
  11059. return __ccgo_ts + 2718
  11060. case int32(223):
  11061. return __ccgo_ts + 2723
  11062. case int32(224):
  11063. return __ccgo_ts + 2728
  11064. case int32(225):
  11065. return __ccgo_ts + 2733
  11066. case int32(226):
  11067. return __ccgo_ts + 2738
  11068. case int32(227):
  11069. return __ccgo_ts + 2743
  11070. case int32(228):
  11071. return __ccgo_ts + 2748
  11072. case int32(229):
  11073. return __ccgo_ts + 2753
  11074. case int32(230):
  11075. return __ccgo_ts + 2758
  11076. case int32(231):
  11077. return __ccgo_ts + 2763
  11078. case int32(232):
  11079. return __ccgo_ts + 2768
  11080. case int32(233):
  11081. return __ccgo_ts + 2773
  11082. case int32(234):
  11083. return __ccgo_ts + 2778
  11084. case int32(235):
  11085. return __ccgo_ts + 2783
  11086. case int32(236):
  11087. return __ccgo_ts + 2788
  11088. case int32(237):
  11089. return __ccgo_ts + 2793
  11090. case int32(238):
  11091. return __ccgo_ts + 2798
  11092. case int32(239):
  11093. return __ccgo_ts + 2803
  11094. case int32(240):
  11095. return __ccgo_ts + 2808
  11096. case int32(241):
  11097. return __ccgo_ts + 2813
  11098. case int32(242):
  11099. return __ccgo_ts + 2818
  11100. case int32(243):
  11101. return __ccgo_ts + 2823
  11102. case int32(244):
  11103. return __ccgo_ts + 2828
  11104. case int32(245):
  11105. return __ccgo_ts + 2833
  11106. case int32(246):
  11107. return __ccgo_ts + 2838
  11108. case int32(247):
  11109. return __ccgo_ts + 2843
  11110. case int32(248):
  11111. return __ccgo_ts + 2848
  11112. case int32(249):
  11113. return __ccgo_ts + 2853
  11114. case int32(250):
  11115. return __ccgo_ts + 2858
  11116. case int32(251):
  11117. return __ccgo_ts + 2863
  11118. case int32(252):
  11119. return __ccgo_ts + 2868
  11120. case int32(253):
  11121. return __ccgo_ts + 2873
  11122. case int32(254):
  11123. return __ccgo_ts + 2878
  11124. case int32(255):
  11125. return __ccgo_ts + 2883
  11126. default:
  11127. /* never gets here */
  11128. return __ccgo_ts + 2888
  11129. }
  11130. /* never gets here */
  11131. return r
  11132. }
  11133. func _getDebugLevel(tls *libc.TLS, variableName uintptr, defaultDebugLevel uint32) (r uint32) {
  11134. bp := tls.Alloc(16)
  11135. defer tls.Free(16)
  11136. var debugLevel uint32
  11137. var value, valueOrNull uintptr
  11138. var _ /* afterValue at bp+0 */ uintptr
  11139. _, _, _ = debugLevel, value, valueOrNull
  11140. valueOrNull = libc.Xgetenv(tls, variableName)
  11141. if valueOrNull == libc.UintptrFromInt32(0) {
  11142. return defaultDebugLevel
  11143. }
  11144. value = valueOrNull
  11145. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = 0
  11146. *(*uintptr)(unsafe.Pointer(bp)) = value
  11147. debugLevel = libc.Xstrtoul(tls, value, bp, int32(10))
  11148. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) != 0 || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) != int32('\000') {
  11149. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = 0
  11150. return defaultDebugLevel
  11151. }
  11152. return debugLevel
  11153. }
  11154. const m_ASCII_01 = 0x30
  11155. const m_ASCII_11 = 0x31
  11156. const m_ASCII_21 = 0x32
  11157. const m_ASCII_31 = 0x33
  11158. const m_ASCII_81 = 0x38
  11159. const m_ASCII_91 = 0x39
  11160. const m_ASCII_B1 = 66
  11161. const m_ASCII_COLON1 = 0x3A
  11162. const m_ASCII_COMMA1 = 0x2C
  11163. const m_ASCII_EQUALS1 = 0x3D
  11164. const m_ASCII_EXCL1 = 0x21
  11165. const m_ASCII_FF1 = 0x0C
  11166. const m_ASCII_G1 = 71
  11167. const m_ASCII_HASH1 = 0x23
  11168. const m_ASCII_LPAREN1 = 0x28
  11169. const m_ASCII_P1 = 80
  11170. const m_ASCII_PERIOD1 = 0x2E
  11171. const m_ASCII_PIPE1 = 0x7C
  11172. const m_ASCII_Q1 = 81
  11173. const m_ASCII_RPAREN1 = 0x29
  11174. const m_ASCII_SLASH1 = 0x2F
  11175. const m_ASCII_U1 = 85
  11176. const m_ASCII_a1 = 0x61
  11177. const m_ASCII_c1 = 0x63
  11178. const m_ASCII_e1 = 0x65
  11179. const m_ASCII_g1 = 0x67
  11180. const m_ASCII_h1 = 0x68
  11181. const m_ASCII_l1 = 0x6C
  11182. const m_ASCII_m1 = 0x6D
  11183. const m_ASCII_n1 = 0x6E
  11184. const m_ASCII_o1 = 0x6F
  11185. const m_ASCII_p1 = 0x70
  11186. const m_ASCII_r1 = 0x72
  11187. const m_ASCII_s1 = 0x73
  11188. const m_ASCII_t1 = 0x74
  11189. const m_ASCII_w1 = 0x77
  11190. const m_ASCII_x1 = 0x78
  11191. const m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT1 = "100.0f"
  11192. const m_INT_MAX1 = 0x7fffffff
  11193. const m_UINT_MAX1 = 0xffffffff
  11194. /*
  11195. __ __ _
  11196. ___\ \/ /_ __ __ _| |_
  11197. / _ \\ /| '_ \ / _` | __|
  11198. | __// \| |_) | (_| | |_
  11199. \___/_/\_\ .__/ \__,_|\__|
  11200. |_| XML parser
  11201. Copyright (c) 1999-2000 Thai Open Source Software Center Ltd
  11202. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  11203. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  11204. Copyright (c) 2007 Karl Waclawek <karl@waclawek.net>
  11205. Copyright (c) 2017 Sebastian Pipping <sebastian@pipping.org>
  11206. Licensed under the MIT license:
  11207. Permission is hereby granted, free of charge, to any person obtaining
  11208. a copy of this software and associated documentation files (the
  11209. "Software"), to deal in the Software without restriction, including
  11210. without limitation the rights to use, copy, modify, merge, publish,
  11211. distribute, sublicense, and/or sell copies of the Software, and to permit
  11212. persons to whom the Software is furnished to do so, subject to the
  11213. following conditions:
  11214. The above copyright notice and this permission notice shall be included
  11215. in all copies or substantial portions of the Software.
  11216. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  11217. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  11218. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  11219. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  11220. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  11221. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  11222. USE OR OTHER DEALINGS IN THE SOFTWARE.
  11223. */
  11224. /* Doesn't check:
  11225. that ,| are not mixed in a model group
  11226. content of literals
  11227. */
  11228. var _KW_ANY = [4]uint8{
  11229. 0: uint8(m_ASCII_A),
  11230. 1: uint8(m_ASCII_N),
  11231. 2: uint8(m_ASCII_Y),
  11232. }
  11233. var _KW_ATTLIST = [8]uint8{
  11234. 0: uint8(m_ASCII_A),
  11235. 1: uint8(m_ASCII_T),
  11236. 2: uint8(m_ASCII_T),
  11237. 3: uint8(m_ASCII_L),
  11238. 4: uint8(m_ASCII_I),
  11239. 5: uint8(m_ASCII_S),
  11240. 6: uint8(m_ASCII_T),
  11241. }
  11242. var _KW_CDATA = [6]uint8{
  11243. 0: uint8(m_ASCII_C),
  11244. 1: uint8(m_ASCII_D),
  11245. 2: uint8(m_ASCII_A),
  11246. 3: uint8(m_ASCII_T),
  11247. 4: uint8(m_ASCII_A),
  11248. }
  11249. var _KW_DOCTYPE = [8]uint8{
  11250. 0: uint8(m_ASCII_D),
  11251. 1: uint8(m_ASCII_O),
  11252. 2: uint8(m_ASCII_C),
  11253. 3: uint8(m_ASCII_T),
  11254. 4: uint8(m_ASCII_Y),
  11255. 5: uint8(m_ASCII_P1),
  11256. 6: uint8(m_ASCII_E),
  11257. }
  11258. var _KW_ELEMENT = [8]uint8{
  11259. 0: uint8(m_ASCII_E),
  11260. 1: uint8(m_ASCII_L),
  11261. 2: uint8(m_ASCII_E),
  11262. 3: uint8(m_ASCII_M),
  11263. 4: uint8(m_ASCII_E),
  11264. 5: uint8(m_ASCII_N),
  11265. 6: uint8(m_ASCII_T),
  11266. }
  11267. var _KW_EMPTY = [6]uint8{
  11268. 0: uint8(m_ASCII_E),
  11269. 1: uint8(m_ASCII_M),
  11270. 2: uint8(m_ASCII_P1),
  11271. 3: uint8(m_ASCII_T),
  11272. 4: uint8(m_ASCII_Y),
  11273. }
  11274. var _KW_ENTITIES = [9]uint8{
  11275. 0: uint8(m_ASCII_E),
  11276. 1: uint8(m_ASCII_N),
  11277. 2: uint8(m_ASCII_T),
  11278. 3: uint8(m_ASCII_I),
  11279. 4: uint8(m_ASCII_T),
  11280. 5: uint8(m_ASCII_I),
  11281. 6: uint8(m_ASCII_E),
  11282. 7: uint8(m_ASCII_S),
  11283. }
  11284. var _KW_ENTITY = [7]uint8{
  11285. 0: uint8(m_ASCII_E),
  11286. 1: uint8(m_ASCII_N),
  11287. 2: uint8(m_ASCII_T),
  11288. 3: uint8(m_ASCII_I),
  11289. 4: uint8(m_ASCII_T),
  11290. 5: uint8(m_ASCII_Y),
  11291. }
  11292. var _KW_FIXED = [6]uint8{
  11293. 0: uint8(m_ASCII_F),
  11294. 1: uint8(m_ASCII_I),
  11295. 2: uint8(m_ASCII_X),
  11296. 3: uint8(m_ASCII_E),
  11297. 4: uint8(m_ASCII_D),
  11298. }
  11299. var _KW_ID = [3]uint8{
  11300. 0: uint8(m_ASCII_I),
  11301. 1: uint8(m_ASCII_D),
  11302. }
  11303. var _KW_IDREF = [6]uint8{
  11304. 0: uint8(m_ASCII_I),
  11305. 1: uint8(m_ASCII_D),
  11306. 2: uint8(m_ASCII_R),
  11307. 3: uint8(m_ASCII_E),
  11308. 4: uint8(m_ASCII_F),
  11309. }
  11310. var _KW_IDREFS = [7]uint8{
  11311. 0: uint8(m_ASCII_I),
  11312. 1: uint8(m_ASCII_D),
  11313. 2: uint8(m_ASCII_R),
  11314. 3: uint8(m_ASCII_E),
  11315. 4: uint8(m_ASCII_F),
  11316. 5: uint8(m_ASCII_S),
  11317. }
  11318. var _KW_IGNORE = [7]uint8{
  11319. 0: uint8(m_ASCII_I),
  11320. 1: uint8(m_ASCII_G1),
  11321. 2: uint8(m_ASCII_N),
  11322. 3: uint8(m_ASCII_O),
  11323. 4: uint8(m_ASCII_R),
  11324. 5: uint8(m_ASCII_E),
  11325. }
  11326. var _KW_IMPLIED = [8]uint8{
  11327. 0: uint8(m_ASCII_I),
  11328. 1: uint8(m_ASCII_M),
  11329. 2: uint8(m_ASCII_P1),
  11330. 3: uint8(m_ASCII_L),
  11331. 4: uint8(m_ASCII_I),
  11332. 5: uint8(m_ASCII_E),
  11333. 6: uint8(m_ASCII_D),
  11334. }
  11335. var _KW_INCLUDE = [8]uint8{
  11336. 0: uint8(m_ASCII_I),
  11337. 1: uint8(m_ASCII_N),
  11338. 2: uint8(m_ASCII_C),
  11339. 3: uint8(m_ASCII_L),
  11340. 4: uint8(m_ASCII_U1),
  11341. 5: uint8(m_ASCII_D),
  11342. 6: uint8(m_ASCII_E),
  11343. }
  11344. var _KW_NDATA = [6]uint8{
  11345. 0: uint8(m_ASCII_N),
  11346. 1: uint8(m_ASCII_D),
  11347. 2: uint8(m_ASCII_A),
  11348. 3: uint8(m_ASCII_T),
  11349. 4: uint8(m_ASCII_A),
  11350. }
  11351. var _KW_NMTOKEN = [8]uint8{
  11352. 0: uint8(m_ASCII_N),
  11353. 1: uint8(m_ASCII_M),
  11354. 2: uint8(m_ASCII_T),
  11355. 3: uint8(m_ASCII_O),
  11356. 4: uint8(m_ASCII_K),
  11357. 5: uint8(m_ASCII_E),
  11358. 6: uint8(m_ASCII_N),
  11359. }
  11360. var _KW_NMTOKENS = [9]uint8{
  11361. 0: uint8(m_ASCII_N),
  11362. 1: uint8(m_ASCII_M),
  11363. 2: uint8(m_ASCII_T),
  11364. 3: uint8(m_ASCII_O),
  11365. 4: uint8(m_ASCII_K),
  11366. 5: uint8(m_ASCII_E),
  11367. 6: uint8(m_ASCII_N),
  11368. 7: uint8(m_ASCII_S),
  11369. }
  11370. var _KW_NOTATION = [9]uint8{
  11371. 0: uint8(m_ASCII_N),
  11372. 1: uint8(m_ASCII_O),
  11373. 2: uint8(m_ASCII_T),
  11374. 3: uint8(m_ASCII_A),
  11375. 4: uint8(m_ASCII_T),
  11376. 5: uint8(m_ASCII_I),
  11377. 6: uint8(m_ASCII_O),
  11378. 7: uint8(m_ASCII_N),
  11379. }
  11380. var _KW_PCDATA = [7]uint8{
  11381. 0: uint8(m_ASCII_P1),
  11382. 1: uint8(m_ASCII_C),
  11383. 2: uint8(m_ASCII_D),
  11384. 3: uint8(m_ASCII_A),
  11385. 4: uint8(m_ASCII_T),
  11386. 5: uint8(m_ASCII_A),
  11387. }
  11388. var _KW_PUBLIC = [7]uint8{
  11389. 0: uint8(m_ASCII_P1),
  11390. 1: uint8(m_ASCII_U1),
  11391. 2: uint8(m_ASCII_B1),
  11392. 3: uint8(m_ASCII_L),
  11393. 4: uint8(m_ASCII_I),
  11394. 5: uint8(m_ASCII_C),
  11395. }
  11396. var _KW_REQUIRED = [9]uint8{
  11397. 0: uint8(m_ASCII_R),
  11398. 1: uint8(m_ASCII_E),
  11399. 2: uint8(m_ASCII_Q1),
  11400. 3: uint8(m_ASCII_U1),
  11401. 4: uint8(m_ASCII_I),
  11402. 5: uint8(m_ASCII_R),
  11403. 6: uint8(m_ASCII_E),
  11404. 7: uint8(m_ASCII_D),
  11405. }
  11406. var _KW_SYSTEM = [7]uint8{
  11407. 0: uint8(m_ASCII_S),
  11408. 1: uint8(m_ASCII_Y),
  11409. 2: uint8(m_ASCII_S),
  11410. 3: uint8(m_ASCII_T),
  11411. 4: uint8(m_ASCII_E),
  11412. 5: uint8(m_ASCII_M),
  11413. }
  11414. func _prolog0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11415. switch tok {
  11416. case int32(m_XML_TOK_PROLOG_S):
  11417. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  11418. return int32(_XML_ROLE_NONE)
  11419. case int32(m_XML_TOK_XML_DECL):
  11420. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  11421. return int32(_XML_ROLE_XML_DECL)
  11422. case int32(m_XML_TOK_PI):
  11423. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  11424. return int32(_XML_ROLE_PI)
  11425. case int32(m_XML_TOK_COMMENT):
  11426. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  11427. return int32(_XML_ROLE_COMMENT)
  11428. case int32(m_XML_TOK_BOM):
  11429. return int32(_XML_ROLE_NONE)
  11430. case int32(m_XML_TOK_DECL_OPEN):
  11431. 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) {
  11432. break
  11433. }
  11434. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype0)
  11435. return int32(_XML_ROLE_DOCTYPE_NONE)
  11436. case int32(m_XML_TOK_INSTANCE_START):
  11437. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  11438. return int32(_XML_ROLE_INSTANCE_START)
  11439. }
  11440. return _common(tls, state, tok)
  11441. }
  11442. func _prolog1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11443. switch tok {
  11444. case int32(m_XML_TOK_PROLOG_S):
  11445. return int32(_XML_ROLE_NONE)
  11446. case int32(m_XML_TOK_PI):
  11447. return int32(_XML_ROLE_PI)
  11448. case int32(m_XML_TOK_COMMENT):
  11449. return int32(_XML_ROLE_COMMENT)
  11450. case int32(m_XML_TOK_BOM):
  11451. /* This case can never arise. To reach this role function, the
  11452. * parse must have passed through prolog0 and therefore have had
  11453. * some form of input, even if only a space. At that point, a
  11454. * byte order mark is no longer a valid character (though
  11455. * technically it should be interpreted as a non-breaking space),
  11456. * so will be rejected by the tokenizing stages.
  11457. */
  11458. return int32(_XML_ROLE_NONE) /* LCOV_EXCL_LINE */
  11459. case int32(m_XML_TOK_DECL_OPEN):
  11460. 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) {
  11461. break
  11462. }
  11463. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype0)
  11464. return int32(_XML_ROLE_DOCTYPE_NONE)
  11465. case int32(m_XML_TOK_INSTANCE_START):
  11466. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  11467. return int32(_XML_ROLE_INSTANCE_START)
  11468. }
  11469. return _common(tls, state, tok)
  11470. }
  11471. func _prolog2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11472. _ = ptr
  11473. _ = end
  11474. _ = enc
  11475. switch tok {
  11476. case int32(m_XML_TOK_PROLOG_S):
  11477. return int32(_XML_ROLE_NONE)
  11478. case int32(m_XML_TOK_PI):
  11479. return int32(_XML_ROLE_PI)
  11480. case int32(m_XML_TOK_COMMENT):
  11481. return int32(_XML_ROLE_COMMENT)
  11482. case int32(m_XML_TOK_INSTANCE_START):
  11483. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  11484. return int32(_XML_ROLE_INSTANCE_START)
  11485. }
  11486. return _common(tls, state, tok)
  11487. }
  11488. func _doctype0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11489. _ = ptr
  11490. _ = end
  11491. _ = enc
  11492. switch tok {
  11493. case int32(m_XML_TOK_PROLOG_S):
  11494. return int32(_XML_ROLE_DOCTYPE_NONE)
  11495. case int32(m_XML_TOK_NAME):
  11496. fallthrough
  11497. case int32(m_XML_TOK_PREFIXED_NAME):
  11498. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype1)
  11499. return int32(_XML_ROLE_DOCTYPE_NAME)
  11500. }
  11501. return _common(tls, state, tok)
  11502. }
  11503. func _doctype1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11504. switch tok {
  11505. case int32(m_XML_TOK_PROLOG_S):
  11506. return int32(_XML_ROLE_DOCTYPE_NONE)
  11507. case int32(m_XML_TOK_OPEN_BRACKET):
  11508. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_internalSubset)
  11509. return int32(_XML_ROLE_DOCTYPE_INTERNAL_SUBSET)
  11510. case int32(m_XML_TOK_DECL_CLOSE):
  11511. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog2)
  11512. return int32(_XML_ROLE_DOCTYPE_CLOSE)
  11513. case int32(m_XML_TOK_NAME):
  11514. 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 {
  11515. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype3)
  11516. return int32(_XML_ROLE_DOCTYPE_NONE)
  11517. }
  11518. 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 {
  11519. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype2)
  11520. return int32(_XML_ROLE_DOCTYPE_NONE)
  11521. }
  11522. break
  11523. }
  11524. return _common(tls, state, tok)
  11525. }
  11526. func _doctype2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11527. _ = ptr
  11528. _ = end
  11529. _ = enc
  11530. switch tok {
  11531. case int32(m_XML_TOK_PROLOG_S):
  11532. return int32(_XML_ROLE_DOCTYPE_NONE)
  11533. case int32(m_XML_TOK_LITERAL):
  11534. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype3)
  11535. return int32(_XML_ROLE_DOCTYPE_PUBLIC_ID)
  11536. }
  11537. return _common(tls, state, tok)
  11538. }
  11539. func _doctype3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11540. _ = ptr
  11541. _ = end
  11542. _ = enc
  11543. switch tok {
  11544. case int32(m_XML_TOK_PROLOG_S):
  11545. return int32(_XML_ROLE_DOCTYPE_NONE)
  11546. case int32(m_XML_TOK_LITERAL):
  11547. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype4)
  11548. return int32(_XML_ROLE_DOCTYPE_SYSTEM_ID)
  11549. }
  11550. return _common(tls, state, tok)
  11551. }
  11552. func _doctype4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11553. _ = ptr
  11554. _ = end
  11555. _ = enc
  11556. switch tok {
  11557. case int32(m_XML_TOK_PROLOG_S):
  11558. return int32(_XML_ROLE_DOCTYPE_NONE)
  11559. case int32(m_XML_TOK_OPEN_BRACKET):
  11560. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_internalSubset)
  11561. return int32(_XML_ROLE_DOCTYPE_INTERNAL_SUBSET)
  11562. case int32(m_XML_TOK_DECL_CLOSE):
  11563. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog2)
  11564. return int32(_XML_ROLE_DOCTYPE_CLOSE)
  11565. }
  11566. return _common(tls, state, tok)
  11567. }
  11568. func _doctype5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11569. _ = ptr
  11570. _ = end
  11571. _ = enc
  11572. switch tok {
  11573. case int32(m_XML_TOK_PROLOG_S):
  11574. return int32(_XML_ROLE_DOCTYPE_NONE)
  11575. case int32(m_XML_TOK_DECL_CLOSE):
  11576. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog2)
  11577. return int32(_XML_ROLE_DOCTYPE_CLOSE)
  11578. }
  11579. return _common(tls, state, tok)
  11580. }
  11581. func _internalSubset(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11582. switch tok {
  11583. case int32(m_XML_TOK_PROLOG_S):
  11584. return int32(_XML_ROLE_NONE)
  11585. case int32(m_XML_TOK_DECL_OPEN):
  11586. 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 {
  11587. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity0)
  11588. return int32(_XML_ROLE_ENTITY_NONE)
  11589. }
  11590. 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 {
  11591. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist0)
  11592. return int32(_XML_ROLE_ATTLIST_NONE)
  11593. }
  11594. 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 {
  11595. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element0)
  11596. return int32(_XML_ROLE_ELEMENT_NONE)
  11597. }
  11598. 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 {
  11599. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation0)
  11600. return int32(_XML_ROLE_NOTATION_NONE)
  11601. }
  11602. case int32(m_XML_TOK_PI):
  11603. return int32(_XML_ROLE_PI)
  11604. case int32(m_XML_TOK_COMMENT):
  11605. return int32(_XML_ROLE_COMMENT)
  11606. case int32(m_XML_TOK_PARAM_ENTITY_REF):
  11607. return int32(_XML_ROLE_PARAM_ENTITY_REF)
  11608. case int32(m_XML_TOK_CLOSE_BRACKET):
  11609. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype5)
  11610. return int32(_XML_ROLE_DOCTYPE_NONE)
  11611. case -int32(4):
  11612. return int32(_XML_ROLE_NONE)
  11613. }
  11614. return _common(tls, state, tok)
  11615. }
  11616. func _externalSubset0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11617. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset1)
  11618. if tok == int32(m_XML_TOK_XML_DECL) {
  11619. return int32(_XML_ROLE_TEXT_DECL)
  11620. }
  11621. return _externalSubset1(tls, state, tok, ptr, end, enc)
  11622. }
  11623. func _externalSubset1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11624. switch tok {
  11625. case int32(m_XML_TOK_COND_SECT_OPEN):
  11626. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_condSect0)
  11627. return int32(_XML_ROLE_NONE)
  11628. case int32(m_XML_TOK_COND_SECT_CLOSE):
  11629. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel == uint32(0) {
  11630. break
  11631. }
  11632. *(*uint32)(unsafe.Pointer(state + 12)) -= uint32(1)
  11633. return int32(_XML_ROLE_NONE)
  11634. case int32(m_XML_TOK_PROLOG_S):
  11635. return int32(_XML_ROLE_NONE)
  11636. case int32(m_XML_TOK_CLOSE_BRACKET):
  11637. case -int32(4):
  11638. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel != 0 {
  11639. break
  11640. }
  11641. return int32(_XML_ROLE_NONE)
  11642. default:
  11643. return _internalSubset(tls, state, tok, ptr, end, enc)
  11644. }
  11645. return _common(tls, state, tok)
  11646. }
  11647. func _entity0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11648. _ = ptr
  11649. _ = end
  11650. _ = enc
  11651. switch tok {
  11652. case int32(m_XML_TOK_PROLOG_S):
  11653. return int32(_XML_ROLE_ENTITY_NONE)
  11654. case int32(m_XML_TOK_PERCENT):
  11655. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity1)
  11656. return int32(_XML_ROLE_ENTITY_NONE)
  11657. case int32(m_XML_TOK_NAME):
  11658. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity2)
  11659. return int32(_XML_ROLE_GENERAL_ENTITY_NAME)
  11660. }
  11661. return _common(tls, state, tok)
  11662. }
  11663. func _entity1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11664. _ = ptr
  11665. _ = end
  11666. _ = enc
  11667. switch tok {
  11668. case int32(m_XML_TOK_PROLOG_S):
  11669. return int32(_XML_ROLE_ENTITY_NONE)
  11670. case int32(m_XML_TOK_NAME):
  11671. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity7)
  11672. return int32(_XML_ROLE_PARAM_ENTITY_NAME)
  11673. }
  11674. return _common(tls, state, tok)
  11675. }
  11676. func _entity2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11677. switch tok {
  11678. case int32(m_XML_TOK_PROLOG_S):
  11679. return int32(_XML_ROLE_ENTITY_NONE)
  11680. case int32(m_XML_TOK_NAME):
  11681. 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 {
  11682. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity4)
  11683. return int32(_XML_ROLE_ENTITY_NONE)
  11684. }
  11685. 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 {
  11686. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity3)
  11687. return int32(_XML_ROLE_ENTITY_NONE)
  11688. }
  11689. case int32(m_XML_TOK_LITERAL):
  11690. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11691. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ENTITY_NONE)
  11692. return int32(_XML_ROLE_ENTITY_VALUE)
  11693. }
  11694. return _common(tls, state, tok)
  11695. }
  11696. func _entity3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11697. _ = ptr
  11698. _ = end
  11699. _ = enc
  11700. switch tok {
  11701. case int32(m_XML_TOK_PROLOG_S):
  11702. return int32(_XML_ROLE_ENTITY_NONE)
  11703. case int32(m_XML_TOK_LITERAL):
  11704. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity4)
  11705. return int32(_XML_ROLE_ENTITY_PUBLIC_ID)
  11706. }
  11707. return _common(tls, state, tok)
  11708. }
  11709. func _entity4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11710. _ = ptr
  11711. _ = end
  11712. _ = enc
  11713. switch tok {
  11714. case int32(m_XML_TOK_PROLOG_S):
  11715. return int32(_XML_ROLE_ENTITY_NONE)
  11716. case int32(m_XML_TOK_LITERAL):
  11717. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity5)
  11718. return int32(_XML_ROLE_ENTITY_SYSTEM_ID)
  11719. }
  11720. return _common(tls, state, tok)
  11721. }
  11722. func _entity5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11723. var v1 uintptr
  11724. _ = v1
  11725. switch tok {
  11726. case int32(m_XML_TOK_PROLOG_S):
  11727. return int32(_XML_ROLE_ENTITY_NONE)
  11728. case int32(m_XML_TOK_DECL_CLOSE):
  11729. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  11730. v1 = __ccgo_fp(_internalSubset)
  11731. } else {
  11732. v1 = __ccgo_fp(_externalSubset1)
  11733. }
  11734. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  11735. return int32(_XML_ROLE_ENTITY_COMPLETE)
  11736. case int32(m_XML_TOK_NAME):
  11737. 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 {
  11738. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity6)
  11739. return int32(_XML_ROLE_ENTITY_NONE)
  11740. }
  11741. break
  11742. }
  11743. return _common(tls, state, tok)
  11744. }
  11745. func _entity6(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11746. _ = ptr
  11747. _ = end
  11748. _ = enc
  11749. switch tok {
  11750. case int32(m_XML_TOK_PROLOG_S):
  11751. return int32(_XML_ROLE_ENTITY_NONE)
  11752. case int32(m_XML_TOK_NAME):
  11753. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11754. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ENTITY_NONE)
  11755. return int32(_XML_ROLE_ENTITY_NOTATION_NAME)
  11756. }
  11757. return _common(tls, state, tok)
  11758. }
  11759. func _entity7(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11760. switch tok {
  11761. case int32(m_XML_TOK_PROLOG_S):
  11762. return int32(_XML_ROLE_ENTITY_NONE)
  11763. case int32(m_XML_TOK_NAME):
  11764. 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 {
  11765. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity9)
  11766. return int32(_XML_ROLE_ENTITY_NONE)
  11767. }
  11768. 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 {
  11769. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity8)
  11770. return int32(_XML_ROLE_ENTITY_NONE)
  11771. }
  11772. case int32(m_XML_TOK_LITERAL):
  11773. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11774. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ENTITY_NONE)
  11775. return int32(_XML_ROLE_ENTITY_VALUE)
  11776. }
  11777. return _common(tls, state, tok)
  11778. }
  11779. func _entity8(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11780. _ = ptr
  11781. _ = end
  11782. _ = enc
  11783. switch tok {
  11784. case int32(m_XML_TOK_PROLOG_S):
  11785. return int32(_XML_ROLE_ENTITY_NONE)
  11786. case int32(m_XML_TOK_LITERAL):
  11787. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity9)
  11788. return int32(_XML_ROLE_ENTITY_PUBLIC_ID)
  11789. }
  11790. return _common(tls, state, tok)
  11791. }
  11792. func _entity9(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11793. _ = ptr
  11794. _ = end
  11795. _ = enc
  11796. switch tok {
  11797. case int32(m_XML_TOK_PROLOG_S):
  11798. return int32(_XML_ROLE_ENTITY_NONE)
  11799. case int32(m_XML_TOK_LITERAL):
  11800. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity10)
  11801. return int32(_XML_ROLE_ENTITY_SYSTEM_ID)
  11802. }
  11803. return _common(tls, state, tok)
  11804. }
  11805. func _entity10(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11806. var v1 uintptr
  11807. _ = v1
  11808. _ = ptr
  11809. _ = end
  11810. _ = enc
  11811. switch tok {
  11812. case int32(m_XML_TOK_PROLOG_S):
  11813. return int32(_XML_ROLE_ENTITY_NONE)
  11814. case int32(m_XML_TOK_DECL_CLOSE):
  11815. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  11816. v1 = __ccgo_fp(_internalSubset)
  11817. } else {
  11818. v1 = __ccgo_fp(_externalSubset1)
  11819. }
  11820. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  11821. return int32(_XML_ROLE_ENTITY_COMPLETE)
  11822. }
  11823. return _common(tls, state, tok)
  11824. }
  11825. func _notation0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11826. _ = ptr
  11827. _ = end
  11828. _ = enc
  11829. switch tok {
  11830. case int32(m_XML_TOK_PROLOG_S):
  11831. return int32(_XML_ROLE_NOTATION_NONE)
  11832. case int32(m_XML_TOK_NAME):
  11833. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation1)
  11834. return int32(_XML_ROLE_NOTATION_NAME)
  11835. }
  11836. return _common(tls, state, tok)
  11837. }
  11838. func _notation1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11839. switch tok {
  11840. case int32(m_XML_TOK_PROLOG_S):
  11841. return int32(_XML_ROLE_NOTATION_NONE)
  11842. case int32(m_XML_TOK_NAME):
  11843. 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 {
  11844. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation3)
  11845. return int32(_XML_ROLE_NOTATION_NONE)
  11846. }
  11847. 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 {
  11848. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation2)
  11849. return int32(_XML_ROLE_NOTATION_NONE)
  11850. }
  11851. break
  11852. }
  11853. return _common(tls, state, tok)
  11854. }
  11855. func _notation2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11856. _ = ptr
  11857. _ = end
  11858. _ = enc
  11859. switch tok {
  11860. case int32(m_XML_TOK_PROLOG_S):
  11861. return int32(_XML_ROLE_NOTATION_NONE)
  11862. case int32(m_XML_TOK_LITERAL):
  11863. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation4)
  11864. return int32(_XML_ROLE_NOTATION_PUBLIC_ID)
  11865. }
  11866. return _common(tls, state, tok)
  11867. }
  11868. func _notation3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11869. _ = ptr
  11870. _ = end
  11871. _ = enc
  11872. switch tok {
  11873. case int32(m_XML_TOK_PROLOG_S):
  11874. return int32(_XML_ROLE_NOTATION_NONE)
  11875. case int32(m_XML_TOK_LITERAL):
  11876. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11877. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_NOTATION_NONE)
  11878. return int32(_XML_ROLE_NOTATION_SYSTEM_ID)
  11879. }
  11880. return _common(tls, state, tok)
  11881. }
  11882. func _notation4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11883. var v1 uintptr
  11884. _ = v1
  11885. _ = ptr
  11886. _ = end
  11887. _ = enc
  11888. switch tok {
  11889. case int32(m_XML_TOK_PROLOG_S):
  11890. return int32(_XML_ROLE_NOTATION_NONE)
  11891. case int32(m_XML_TOK_LITERAL):
  11892. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11893. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_NOTATION_NONE)
  11894. return int32(_XML_ROLE_NOTATION_SYSTEM_ID)
  11895. case int32(m_XML_TOK_DECL_CLOSE):
  11896. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  11897. v1 = __ccgo_fp(_internalSubset)
  11898. } else {
  11899. v1 = __ccgo_fp(_externalSubset1)
  11900. }
  11901. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  11902. return int32(_XML_ROLE_NOTATION_NO_SYSTEM_ID)
  11903. }
  11904. return _common(tls, state, tok)
  11905. }
  11906. func _attlist0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11907. _ = ptr
  11908. _ = end
  11909. _ = enc
  11910. switch tok {
  11911. case int32(m_XML_TOK_PROLOG_S):
  11912. return int32(_XML_ROLE_ATTLIST_NONE)
  11913. case int32(m_XML_TOK_NAME):
  11914. fallthrough
  11915. case int32(m_XML_TOK_PREFIXED_NAME):
  11916. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  11917. return int32(_XML_ROLE_ATTLIST_ELEMENT_NAME)
  11918. }
  11919. return _common(tls, state, tok)
  11920. }
  11921. func _attlist1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11922. var v1 uintptr
  11923. _ = v1
  11924. _ = ptr
  11925. _ = end
  11926. _ = enc
  11927. switch tok {
  11928. case int32(m_XML_TOK_PROLOG_S):
  11929. return int32(_XML_ROLE_ATTLIST_NONE)
  11930. case int32(m_XML_TOK_DECL_CLOSE):
  11931. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  11932. v1 = __ccgo_fp(_internalSubset)
  11933. } else {
  11934. v1 = __ccgo_fp(_externalSubset1)
  11935. }
  11936. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  11937. return int32(_XML_ROLE_ATTLIST_NONE)
  11938. case int32(m_XML_TOK_NAME):
  11939. fallthrough
  11940. case int32(m_XML_TOK_PREFIXED_NAME):
  11941. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist2)
  11942. return int32(_XML_ROLE_ATTRIBUTE_NAME)
  11943. }
  11944. return _common(tls, state, tok)
  11945. }
  11946. func _attlist2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11947. var i int32
  11948. _ = i
  11949. switch tok {
  11950. case int32(m_XML_TOK_PROLOG_S):
  11951. return int32(_XML_ROLE_ATTLIST_NONE)
  11952. case int32(m_XML_TOK_NAME):
  11953. i = 0
  11954. for {
  11955. if !(i < libc.Int32FromUint32(libc.Uint32FromInt64(32)/libc.Uint32FromInt64(4))) {
  11956. break
  11957. }
  11958. 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 {
  11959. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist8)
  11960. return int32(_XML_ROLE_ATTRIBUTE_TYPE_CDATA) + i
  11961. }
  11962. goto _1
  11963. _1:
  11964. ;
  11965. i++
  11966. }
  11967. 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 {
  11968. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist5)
  11969. return int32(_XML_ROLE_ATTLIST_NONE)
  11970. }
  11971. case int32(m_XML_TOK_OPEN_PAREN):
  11972. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist3)
  11973. return int32(_XML_ROLE_ATTLIST_NONE)
  11974. }
  11975. return _common(tls, state, tok)
  11976. }
  11977. var _types = [8]uintptr{
  11978. 0: uintptr(unsafe.Pointer(&_KW_CDATA)),
  11979. 1: uintptr(unsafe.Pointer(&_KW_ID)),
  11980. 2: uintptr(unsafe.Pointer(&_KW_IDREF)),
  11981. 3: uintptr(unsafe.Pointer(&_KW_IDREFS)),
  11982. 4: uintptr(unsafe.Pointer(&_KW_ENTITY)),
  11983. 5: uintptr(unsafe.Pointer(&_KW_ENTITIES)),
  11984. 6: uintptr(unsafe.Pointer(&_KW_NMTOKEN)),
  11985. 7: uintptr(unsafe.Pointer(&_KW_NMTOKENS)),
  11986. }
  11987. func _attlist3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11988. _ = ptr
  11989. _ = end
  11990. _ = enc
  11991. switch tok {
  11992. case int32(m_XML_TOK_PROLOG_S):
  11993. return int32(_XML_ROLE_ATTLIST_NONE)
  11994. case int32(m_XML_TOK_NMTOKEN):
  11995. fallthrough
  11996. case int32(m_XML_TOK_NAME):
  11997. fallthrough
  11998. case int32(m_XML_TOK_PREFIXED_NAME):
  11999. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist4)
  12000. return int32(_XML_ROLE_ATTRIBUTE_ENUM_VALUE)
  12001. }
  12002. return _common(tls, state, tok)
  12003. }
  12004. func _attlist4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12005. _ = ptr
  12006. _ = end
  12007. _ = enc
  12008. switch tok {
  12009. case int32(m_XML_TOK_PROLOG_S):
  12010. return int32(_XML_ROLE_ATTLIST_NONE)
  12011. case int32(m_XML_TOK_CLOSE_PAREN):
  12012. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist8)
  12013. return int32(_XML_ROLE_ATTLIST_NONE)
  12014. case int32(m_XML_TOK_OR):
  12015. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist3)
  12016. return int32(_XML_ROLE_ATTLIST_NONE)
  12017. }
  12018. return _common(tls, state, tok)
  12019. }
  12020. func _attlist5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12021. _ = ptr
  12022. _ = end
  12023. _ = enc
  12024. switch tok {
  12025. case int32(m_XML_TOK_PROLOG_S):
  12026. return int32(_XML_ROLE_ATTLIST_NONE)
  12027. case int32(m_XML_TOK_OPEN_PAREN):
  12028. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist6)
  12029. return int32(_XML_ROLE_ATTLIST_NONE)
  12030. }
  12031. return _common(tls, state, tok)
  12032. }
  12033. func _attlist6(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12034. _ = ptr
  12035. _ = end
  12036. _ = enc
  12037. switch tok {
  12038. case int32(m_XML_TOK_PROLOG_S):
  12039. return int32(_XML_ROLE_ATTLIST_NONE)
  12040. case int32(m_XML_TOK_NAME):
  12041. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist7)
  12042. return int32(_XML_ROLE_ATTRIBUTE_NOTATION_VALUE)
  12043. }
  12044. return _common(tls, state, tok)
  12045. }
  12046. func _attlist7(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12047. _ = ptr
  12048. _ = end
  12049. _ = enc
  12050. switch tok {
  12051. case int32(m_XML_TOK_PROLOG_S):
  12052. return int32(_XML_ROLE_ATTLIST_NONE)
  12053. case int32(m_XML_TOK_CLOSE_PAREN):
  12054. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist8)
  12055. return int32(_XML_ROLE_ATTLIST_NONE)
  12056. case int32(m_XML_TOK_OR):
  12057. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist6)
  12058. return int32(_XML_ROLE_ATTLIST_NONE)
  12059. }
  12060. return _common(tls, state, tok)
  12061. }
  12062. // C documentation
  12063. //
  12064. // /* default value */
  12065. func _attlist8(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12066. switch tok {
  12067. case int32(m_XML_TOK_PROLOG_S):
  12068. return int32(_XML_ROLE_ATTLIST_NONE)
  12069. case int32(m_XML_TOK_POUND_NAME):
  12070. 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 {
  12071. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  12072. return int32(_XML_ROLE_IMPLIED_ATTRIBUTE_VALUE)
  12073. }
  12074. 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 {
  12075. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  12076. return int32(_XML_ROLE_REQUIRED_ATTRIBUTE_VALUE)
  12077. }
  12078. 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 {
  12079. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist9)
  12080. return int32(_XML_ROLE_ATTLIST_NONE)
  12081. }
  12082. case int32(m_XML_TOK_LITERAL):
  12083. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  12084. return int32(_XML_ROLE_DEFAULT_ATTRIBUTE_VALUE)
  12085. }
  12086. return _common(tls, state, tok)
  12087. }
  12088. func _attlist9(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12089. _ = ptr
  12090. _ = end
  12091. _ = enc
  12092. switch tok {
  12093. case int32(m_XML_TOK_PROLOG_S):
  12094. return int32(_XML_ROLE_ATTLIST_NONE)
  12095. case int32(m_XML_TOK_LITERAL):
  12096. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  12097. return int32(_XML_ROLE_FIXED_ATTRIBUTE_VALUE)
  12098. }
  12099. return _common(tls, state, tok)
  12100. }
  12101. func _element0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12102. _ = ptr
  12103. _ = end
  12104. _ = enc
  12105. switch tok {
  12106. case int32(m_XML_TOK_PROLOG_S):
  12107. return int32(_XML_ROLE_ELEMENT_NONE)
  12108. case int32(m_XML_TOK_NAME):
  12109. fallthrough
  12110. case int32(m_XML_TOK_PREFIXED_NAME):
  12111. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element1)
  12112. return int32(_XML_ROLE_ELEMENT_NAME)
  12113. }
  12114. return _common(tls, state, tok)
  12115. }
  12116. func _element1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12117. switch tok {
  12118. case int32(m_XML_TOK_PROLOG_S):
  12119. return int32(_XML_ROLE_ELEMENT_NONE)
  12120. case int32(m_XML_TOK_NAME):
  12121. 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 {
  12122. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12123. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12124. return int32(_XML_ROLE_CONTENT_EMPTY)
  12125. }
  12126. 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 {
  12127. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12128. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12129. return int32(_XML_ROLE_CONTENT_ANY)
  12130. }
  12131. case int32(m_XML_TOK_OPEN_PAREN):
  12132. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element2)
  12133. (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel = uint32(1)
  12134. return int32(_XML_ROLE_GROUP_OPEN)
  12135. }
  12136. return _common(tls, state, tok)
  12137. }
  12138. func _element2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12139. switch tok {
  12140. case int32(m_XML_TOK_PROLOG_S):
  12141. return int32(_XML_ROLE_ELEMENT_NONE)
  12142. case int32(m_XML_TOK_POUND_NAME):
  12143. 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 {
  12144. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element3)
  12145. return int32(_XML_ROLE_CONTENT_PCDATA)
  12146. }
  12147. case int32(m_XML_TOK_OPEN_PAREN):
  12148. (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel = uint32(2)
  12149. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element6)
  12150. return int32(_XML_ROLE_GROUP_OPEN)
  12151. case int32(m_XML_TOK_NAME):
  12152. fallthrough
  12153. case int32(m_XML_TOK_PREFIXED_NAME):
  12154. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12155. return int32(_XML_ROLE_CONTENT_ELEMENT)
  12156. case int32(m_XML_TOK_NAME_QUESTION):
  12157. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12158. return int32(_XML_ROLE_CONTENT_ELEMENT_OPT)
  12159. case int32(m_XML_TOK_NAME_ASTERISK):
  12160. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12161. return int32(_XML_ROLE_CONTENT_ELEMENT_REP)
  12162. case int32(m_XML_TOK_NAME_PLUS):
  12163. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12164. return int32(_XML_ROLE_CONTENT_ELEMENT_PLUS)
  12165. }
  12166. return _common(tls, state, tok)
  12167. }
  12168. func _element3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12169. _ = ptr
  12170. _ = end
  12171. _ = enc
  12172. switch tok {
  12173. case int32(m_XML_TOK_PROLOG_S):
  12174. return int32(_XML_ROLE_ELEMENT_NONE)
  12175. case int32(m_XML_TOK_CLOSE_PAREN):
  12176. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12177. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12178. return int32(_XML_ROLE_GROUP_CLOSE)
  12179. case int32(m_XML_TOK_CLOSE_PAREN_ASTERISK):
  12180. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12181. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12182. return int32(_XML_ROLE_GROUP_CLOSE_REP)
  12183. case int32(m_XML_TOK_OR):
  12184. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element4)
  12185. return int32(_XML_ROLE_ELEMENT_NONE)
  12186. }
  12187. return _common(tls, state, tok)
  12188. }
  12189. func _element4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12190. _ = ptr
  12191. _ = end
  12192. _ = enc
  12193. switch tok {
  12194. case int32(m_XML_TOK_PROLOG_S):
  12195. return int32(_XML_ROLE_ELEMENT_NONE)
  12196. case int32(m_XML_TOK_NAME):
  12197. fallthrough
  12198. case int32(m_XML_TOK_PREFIXED_NAME):
  12199. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element5)
  12200. return int32(_XML_ROLE_CONTENT_ELEMENT)
  12201. }
  12202. return _common(tls, state, tok)
  12203. }
  12204. func _element5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12205. _ = ptr
  12206. _ = end
  12207. _ = enc
  12208. switch tok {
  12209. case int32(m_XML_TOK_PROLOG_S):
  12210. return int32(_XML_ROLE_ELEMENT_NONE)
  12211. case int32(m_XML_TOK_CLOSE_PAREN_ASTERISK):
  12212. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12213. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12214. return int32(_XML_ROLE_GROUP_CLOSE_REP)
  12215. case int32(m_XML_TOK_OR):
  12216. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element4)
  12217. return int32(_XML_ROLE_ELEMENT_NONE)
  12218. }
  12219. return _common(tls, state, tok)
  12220. }
  12221. func _element6(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12222. _ = ptr
  12223. _ = end
  12224. _ = enc
  12225. switch tok {
  12226. case int32(m_XML_TOK_PROLOG_S):
  12227. return int32(_XML_ROLE_ELEMENT_NONE)
  12228. case int32(m_XML_TOK_OPEN_PAREN):
  12229. *(*uint32)(unsafe.Pointer(state + 4)) += uint32(1)
  12230. return int32(_XML_ROLE_GROUP_OPEN)
  12231. case int32(m_XML_TOK_NAME):
  12232. fallthrough
  12233. case int32(m_XML_TOK_PREFIXED_NAME):
  12234. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12235. return int32(_XML_ROLE_CONTENT_ELEMENT)
  12236. case int32(m_XML_TOK_NAME_QUESTION):
  12237. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12238. return int32(_XML_ROLE_CONTENT_ELEMENT_OPT)
  12239. case int32(m_XML_TOK_NAME_ASTERISK):
  12240. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12241. return int32(_XML_ROLE_CONTENT_ELEMENT_REP)
  12242. case int32(m_XML_TOK_NAME_PLUS):
  12243. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12244. return int32(_XML_ROLE_CONTENT_ELEMENT_PLUS)
  12245. }
  12246. return _common(tls, state, tok)
  12247. }
  12248. func _element7(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12249. _ = ptr
  12250. _ = end
  12251. _ = enc
  12252. switch tok {
  12253. case int32(m_XML_TOK_PROLOG_S):
  12254. return int32(_XML_ROLE_ELEMENT_NONE)
  12255. case int32(m_XML_TOK_CLOSE_PAREN):
  12256. *(*uint32)(unsafe.Pointer(state + 4)) -= uint32(1)
  12257. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  12258. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12259. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12260. }
  12261. return int32(_XML_ROLE_GROUP_CLOSE)
  12262. case int32(m_XML_TOK_CLOSE_PAREN_ASTERISK):
  12263. *(*uint32)(unsafe.Pointer(state + 4)) -= uint32(1)
  12264. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  12265. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12266. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12267. }
  12268. return int32(_XML_ROLE_GROUP_CLOSE_REP)
  12269. case int32(m_XML_TOK_CLOSE_PAREN_QUESTION):
  12270. *(*uint32)(unsafe.Pointer(state + 4)) -= uint32(1)
  12271. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  12272. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12273. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12274. }
  12275. return int32(_XML_ROLE_GROUP_CLOSE_OPT)
  12276. case int32(m_XML_TOK_CLOSE_PAREN_PLUS):
  12277. *(*uint32)(unsafe.Pointer(state + 4)) -= uint32(1)
  12278. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  12279. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12280. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12281. }
  12282. return int32(_XML_ROLE_GROUP_CLOSE_PLUS)
  12283. case int32(m_XML_TOK_COMMA):
  12284. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element6)
  12285. return int32(_XML_ROLE_GROUP_SEQUENCE)
  12286. case int32(m_XML_TOK_OR):
  12287. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element6)
  12288. return int32(_XML_ROLE_GROUP_CHOICE)
  12289. }
  12290. return _common(tls, state, tok)
  12291. }
  12292. func _condSect0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12293. switch tok {
  12294. case int32(m_XML_TOK_PROLOG_S):
  12295. return int32(_XML_ROLE_NONE)
  12296. case int32(m_XML_TOK_NAME):
  12297. 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 {
  12298. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_condSect1)
  12299. return int32(_XML_ROLE_NONE)
  12300. }
  12301. 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 {
  12302. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_condSect2)
  12303. return int32(_XML_ROLE_NONE)
  12304. }
  12305. break
  12306. }
  12307. return _common(tls, state, tok)
  12308. }
  12309. func _condSect1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12310. _ = ptr
  12311. _ = end
  12312. _ = enc
  12313. switch tok {
  12314. case int32(m_XML_TOK_PROLOG_S):
  12315. return int32(_XML_ROLE_NONE)
  12316. case int32(m_XML_TOK_OPEN_BRACKET):
  12317. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset1)
  12318. *(*uint32)(unsafe.Pointer(state + 12)) += uint32(1)
  12319. return int32(_XML_ROLE_NONE)
  12320. }
  12321. return _common(tls, state, tok)
  12322. }
  12323. func _condSect2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12324. _ = ptr
  12325. _ = end
  12326. _ = enc
  12327. switch tok {
  12328. case int32(m_XML_TOK_PROLOG_S):
  12329. return int32(_XML_ROLE_NONE)
  12330. case int32(m_XML_TOK_OPEN_BRACKET):
  12331. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset1)
  12332. return int32(_XML_ROLE_IGNORE_SECT)
  12333. }
  12334. return _common(tls, state, tok)
  12335. }
  12336. func _declClose(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12337. var v1 uintptr
  12338. _ = v1
  12339. _ = ptr
  12340. _ = end
  12341. _ = enc
  12342. switch tok {
  12343. case int32(m_XML_TOK_PROLOG_S):
  12344. return (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none
  12345. case int32(m_XML_TOK_DECL_CLOSE):
  12346. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  12347. v1 = __ccgo_fp(_internalSubset)
  12348. } else {
  12349. v1 = __ccgo_fp(_externalSubset1)
  12350. }
  12351. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  12352. return (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none
  12353. }
  12354. return _common(tls, state, tok)
  12355. }
  12356. // C documentation
  12357. //
  12358. // /* This function will only be invoked if the internal logic of the
  12359. // * parser has broken down. It is used in two cases:
  12360. // *
  12361. // * 1: When the XML prolog has been finished. At this point the
  12362. // * processor (the parser level above these role handlers) should
  12363. // * switch from prologProcessor to contentProcessor and reinitialise
  12364. // * the handler function.
  12365. // *
  12366. // * 2: When an error has been detected (via common() below). At this
  12367. // * point again the processor should be switched to errorProcessor,
  12368. // * which will never call a handler.
  12369. // *
  12370. // * The result of this is that error() can only be called if the
  12371. // * processor switch failed to happen, which is an internal error and
  12372. // * therefore we shouldn't be able to provoke it simply by using the
  12373. // * library. It is a necessary backstop, however, so we merely exclude
  12374. // * it from the coverage statistics.
  12375. // *
  12376. // * LCOV_EXCL_START
  12377. // */
  12378. func _error(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12379. _ = state
  12380. _ = tok
  12381. _ = ptr
  12382. _ = end
  12383. _ = enc
  12384. return int32(_XML_ROLE_NONE)
  12385. }
  12386. /* LCOV_EXCL_STOP */
  12387. func _common(tls *libc.TLS, state uintptr, tok int32) (r int32) {
  12388. if !((*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0) && tok == int32(m_XML_TOK_PARAM_ENTITY_REF) {
  12389. return int32(_XML_ROLE_INNER_PARAM_ENTITY_REF)
  12390. }
  12391. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  12392. return int32(_XML_ROLE_ERROR)
  12393. }
  12394. func XXmlPrologStateInit(tls *libc.TLS, state uintptr) {
  12395. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog0)
  12396. (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity = int32(1)
  12397. (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel = uint32(0)
  12398. (*TPROLOG_STATE)(unsafe.Pointer(state)).FinEntityValue = 0
  12399. }
  12400. func XXmlPrologStateInitExternalEntity(tls *libc.TLS, state uintptr) {
  12401. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset0)
  12402. (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity = 0
  12403. (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel = uint32(0)
  12404. }
  12405. const m_ASCII_02 = 48
  12406. const m_ASCII_12 = 49
  12407. const m_ASCII_22 = 50
  12408. const m_ASCII_32 = 51
  12409. const m_ASCII_41 = 52
  12410. const m_ASCII_51 = 53
  12411. const m_ASCII_61 = 54
  12412. const m_ASCII_71 = 55
  12413. const m_ASCII_82 = 56
  12414. const m_ASCII_92 = 57
  12415. const m_ASCII_AMP1 = 38
  12416. const m_ASCII_APOS1 = 39
  12417. const m_ASCII_COLON2 = 58
  12418. const m_ASCII_EQUALS2 = 61
  12419. const m_ASCII_EXCL2 = 33
  12420. const m_ASCII_G2 = 0x47
  12421. const m_ASCII_GT1 = 62
  12422. const m_ASCII_K1 = 0x4B
  12423. const m_ASCII_LSQB1 = 91
  12424. const m_ASCII_LT1 = 60
  12425. const m_ASCII_MINUS1 = 45
  12426. const m_ASCII_N1 = 0x4E
  12427. const m_ASCII_P2 = 0x50
  12428. const m_ASCII_PERIOD2 = 46
  12429. const m_ASCII_Q2 = 0x51
  12430. const m_ASCII_QUOT1 = 34
  12431. const m_ASCII_R1 = 0x52
  12432. const m_ASCII_RSQB1 = 93
  12433. const m_ASCII_SEMI1 = 59
  12434. const m_ASCII_SPACE1 = 32
  12435. const m_ASCII_TAB1 = 9
  12436. const m_ASCII_UNDERSCORE1 = 95
  12437. const m_ASCII_Y1 = 0x59
  12438. const m_ASCII_Z1 = 90
  12439. const m_ASCII_a2 = 97
  12440. const m_ASCII_b1 = 98
  12441. const m_ASCII_c2 = 99
  12442. const m_ASCII_d1 = 100
  12443. const m_ASCII_e2 = 101
  12444. const m_ASCII_f1 = 102
  12445. const m_ASCII_g2 = 103
  12446. const m_ASCII_i1 = 105
  12447. const m_ASCII_l2 = 108
  12448. const m_ASCII_m2 = 109
  12449. const m_ASCII_n2 = 110
  12450. const m_ASCII_o2 = 111
  12451. const m_ASCII_p2 = 112
  12452. const m_ASCII_q1 = 113
  12453. const m_ASCII_r2 = 114
  12454. const m_ASCII_s2 = 115
  12455. const m_ASCII_t2 = 116
  12456. const m_ASCII_u1 = 117
  12457. const m_ASCII_v1 = 118
  12458. const m_ASCII_x2 = 120
  12459. const m_ASCII_y1 = 121
  12460. const m_ASCII_z1 = 122
  12461. const m_ENCODING_MAX = 128
  12462. const m___bool_true_false_are_defined = 1
  12463. const m_bool = "_Bool"
  12464. const m_false = 0
  12465. const m_true = 1
  12466. const m_utf8_isName4 = "isNever"
  12467. const m_utf8_isNmstrt4 = "isNever"
  12468. var _namingBitmap = [320]uint32{
  12469. 8: uint32(0xFFFFFFFF),
  12470. 9: uint32(0xFFFFFFFF),
  12471. 10: uint32(0xFFFFFFFF),
  12472. 11: uint32(0xFFFFFFFF),
  12473. 12: uint32(0xFFFFFFFF),
  12474. 13: uint32(0xFFFFFFFF),
  12475. 14: uint32(0xFFFFFFFF),
  12476. 15: uint32(0xFFFFFFFF),
  12477. 17: uint32(0x04000000),
  12478. 18: uint32(0x87FFFFFE),
  12479. 19: uint32(0x07FFFFFE),
  12480. 22: uint32(0xFF7FFFFF),
  12481. 23: uint32(0xFF7FFFFF),
  12482. 24: uint32(0xFFFFFFFF),
  12483. 25: uint32(0x7FF3FFFF),
  12484. 26: uint32(0xFFFFFDFE),
  12485. 27: uint32(0x7FFFFFFF),
  12486. 28: uint32(0xFFFFFFFF),
  12487. 29: uint32(0xFFFFFFFF),
  12488. 30: uint32(0xFFFFE00F),
  12489. 31: uint32(0xFC31FFFF),
  12490. 32: uint32(0x00FFFFFF),
  12491. 34: uint32(0xFFFF0000),
  12492. 35: uint32(0xFFFFFFFF),
  12493. 36: uint32(0xFFFFFFFF),
  12494. 37: uint32(0xF80001FF),
  12495. 38: uint32(0x00000003),
  12496. 44: uint32(0xFFFFD740),
  12497. 45: uint32(0xFFFFFFFB),
  12498. 46: uint32(0x547F7FFF),
  12499. 47: uint32(0x000FFFFD),
  12500. 48: uint32(0xFFFFDFFE),
  12501. 49: uint32(0xFFFFFFFF),
  12502. 50: uint32(0xDFFEFFFF),
  12503. 51: uint32(0xFFFFFFFF),
  12504. 52: uint32(0xFFFF0003),
  12505. 53: uint32(0xFFFFFFFF),
  12506. 54: uint32(0xFFFF199F),
  12507. 55: uint32(0x033FCFFF),
  12508. 57: uint32(0xFFFE0000),
  12509. 58: uint32(0x027FFFFF),
  12510. 59: uint32(0xFFFFFFFE),
  12511. 60: uint32(0x0000007F),
  12512. 62: uint32(0xFFFF0000),
  12513. 63: uint32(0x000707FF),
  12514. 65: uint32(0x07FFFFFE),
  12515. 66: uint32(0x000007FE),
  12516. 67: uint32(0xFFFE0000),
  12517. 68: uint32(0xFFFFFFFF),
  12518. 69: uint32(0x7CFFFFFF),
  12519. 70: uint32(0x002F7FFF),
  12520. 71: uint32(0x00000060),
  12521. 72: uint32(0xFFFFFFE0),
  12522. 73: uint32(0x23FFFFFF),
  12523. 74: uint32(0xFF000000),
  12524. 75: uint32(0x00000003),
  12525. 76: uint32(0xFFF99FE0),
  12526. 77: uint32(0x03C5FDFF),
  12527. 78: uint32(0xB0000000),
  12528. 79: uint32(0x00030003),
  12529. 80: uint32(0xFFF987E0),
  12530. 81: uint32(0x036DFDFF),
  12531. 82: uint32(0x5E000000),
  12532. 83: uint32(0x001C0000),
  12533. 84: uint32(0xFFFBAFE0),
  12534. 85: uint32(0x23EDFDFF),
  12535. 87: uint32(0x00000001),
  12536. 88: uint32(0xFFF99FE0),
  12537. 89: uint32(0x23CDFDFF),
  12538. 90: uint32(0xB0000000),
  12539. 91: uint32(0x00000003),
  12540. 92: uint32(0xD63DC7E0),
  12541. 93: uint32(0x03BFC718),
  12542. 96: uint32(0xFFFDDFE0),
  12543. 97: uint32(0x03EFFDFF),
  12544. 99: uint32(0x00000003),
  12545. 100: uint32(0xFFFDDFE0),
  12546. 101: uint32(0x03EFFDFF),
  12547. 102: uint32(0x40000000),
  12548. 103: uint32(0x00000003),
  12549. 104: uint32(0xFFFDDFE0),
  12550. 105: uint32(0x03FFFDFF),
  12551. 107: uint32(0x00000003),
  12552. 112: uint32(0xFFFFFFFE),
  12553. 113: uint32(0x000D7FFF),
  12554. 114: uint32(0x0000003F),
  12555. 116: uint32(0xFEF02596),
  12556. 117: uint32(0x200D6CAE),
  12557. 118: uint32(0x0000001F),
  12558. 122: uint32(0xFFFFFEFF),
  12559. 123: uint32(0x000003FF),
  12560. 133: uint32(0xFFFFFFFF),
  12561. 134: uint32(0xFFFF003F),
  12562. 135: uint32(0x007FFFFF),
  12563. 136: uint32(0x0007DAED),
  12564. 137: uint32(0x50000000),
  12565. 138: uint32(0x82315001),
  12566. 139: uint32(0x002C62AB),
  12567. 140: uint32(0x40000000),
  12568. 141: uint32(0xF580C900),
  12569. 142: uint32(0x00000007),
  12570. 143: uint32(0x02010800),
  12571. 144: uint32(0xFFFFFFFF),
  12572. 145: uint32(0xFFFFFFFF),
  12573. 146: uint32(0xFFFFFFFF),
  12574. 147: uint32(0xFFFFFFFF),
  12575. 148: uint32(0x0FFFFFFF),
  12576. 149: uint32(0xFFFFFFFF),
  12577. 150: uint32(0xFFFFFFFF),
  12578. 151: uint32(0x03FFFFFF),
  12579. 152: uint32(0x3F3FFFFF),
  12580. 153: uint32(0xFFFFFFFF),
  12581. 154: uint32(0xAAFF3F3F),
  12582. 155: uint32(0x3FFFFFFF),
  12583. 156: uint32(0xFFFFFFFF),
  12584. 157: uint32(0x5FDFFFFF),
  12585. 158: uint32(0x0FCF1FDC),
  12586. 159: uint32(0x1FDC1FFF),
  12587. 161: uint32(0x00004C40),
  12588. 164: uint32(0x00000007),
  12589. 168: uint32(0x00000080),
  12590. 169: uint32(0x000003FE),
  12591. 170: uint32(0xFFFFFFFE),
  12592. 171: uint32(0xFFFFFFFF),
  12593. 172: uint32(0x001FFFFF),
  12594. 173: uint32(0xFFFFFFFE),
  12595. 174: uint32(0xFFFFFFFF),
  12596. 175: uint32(0x07FFFFFF),
  12597. 176: uint32(0xFFFFFFE0),
  12598. 177: uint32(0x00001FFF),
  12599. 184: uint32(0xFFFFFFFF),
  12600. 185: uint32(0xFFFFFFFF),
  12601. 186: uint32(0xFFFFFFFF),
  12602. 187: uint32(0xFFFFFFFF),
  12603. 188: uint32(0xFFFFFFFF),
  12604. 189: uint32(0x0000003F),
  12605. 192: uint32(0xFFFFFFFF),
  12606. 193: uint32(0xFFFFFFFF),
  12607. 194: uint32(0xFFFFFFFF),
  12608. 195: uint32(0xFFFFFFFF),
  12609. 196: uint32(0xFFFFFFFF),
  12610. 197: uint32(0x0000000F),
  12611. 201: uint32(0x07FF6000),
  12612. 202: uint32(0x87FFFFFE),
  12613. 203: uint32(0x07FFFFFE),
  12614. 205: uint32(0x00800000),
  12615. 206: uint32(0xFF7FFFFF),
  12616. 207: uint32(0xFF7FFFFF),
  12617. 208: uint32(0x00FFFFFF),
  12618. 210: uint32(0xFFFF0000),
  12619. 211: uint32(0xFFFFFFFF),
  12620. 212: uint32(0xFFFFFFFF),
  12621. 213: uint32(0xF80001FF),
  12622. 214: uint32(0x00030003),
  12623. 216: uint32(0xFFFFFFFF),
  12624. 217: uint32(0xFFFFFFFF),
  12625. 218: uint32(0x0000003F),
  12626. 219: uint32(0x00000003),
  12627. 220: uint32(0xFFFFD7C0),
  12628. 221: uint32(0xFFFFFFFB),
  12629. 222: uint32(0x547F7FFF),
  12630. 223: uint32(0x000FFFFD),
  12631. 224: uint32(0xFFFFDFFE),
  12632. 225: uint32(0xFFFFFFFF),
  12633. 226: uint32(0xDFFEFFFF),
  12634. 227: uint32(0xFFFFFFFF),
  12635. 228: uint32(0xFFFF007B),
  12636. 229: uint32(0xFFFFFFFF),
  12637. 230: uint32(0xFFFF199F),
  12638. 231: uint32(0x033FCFFF),
  12639. 233: uint32(0xFFFE0000),
  12640. 234: uint32(0x027FFFFF),
  12641. 235: uint32(0xFFFFFFFE),
  12642. 236: uint32(0xFFFE007F),
  12643. 237: uint32(0xBBFFFFFB),
  12644. 238: uint32(0xFFFF0016),
  12645. 239: uint32(0x000707FF),
  12646. 241: uint32(0x07FFFFFE),
  12647. 242: uint32(0x0007FFFF),
  12648. 243: uint32(0xFFFF03FF),
  12649. 244: uint32(0xFFFFFFFF),
  12650. 245: uint32(0x7CFFFFFF),
  12651. 246: uint32(0xFFEF7FFF),
  12652. 247: uint32(0x03FF3DFF),
  12653. 248: uint32(0xFFFFFFEE),
  12654. 249: uint32(0xF3FFFFFF),
  12655. 250: uint32(0xFF1E3FFF),
  12656. 251: uint32(0x0000FFCF),
  12657. 252: uint32(0xFFF99FEE),
  12658. 253: uint32(0xD3C5FDFF),
  12659. 254: uint32(0xB080399F),
  12660. 255: uint32(0x0003FFCF),
  12661. 256: uint32(0xFFF987E4),
  12662. 257: uint32(0xD36DFDFF),
  12663. 258: uint32(0x5E003987),
  12664. 259: uint32(0x001FFFC0),
  12665. 260: uint32(0xFFFBAFEE),
  12666. 261: uint32(0xF3EDFDFF),
  12667. 262: uint32(0x00003BBF),
  12668. 263: uint32(0x0000FFC1),
  12669. 264: uint32(0xFFF99FEE),
  12670. 265: uint32(0xF3CDFDFF),
  12671. 266: uint32(0xB0C0398F),
  12672. 267: uint32(0x0000FFC3),
  12673. 268: uint32(0xD63DC7EC),
  12674. 269: uint32(0xC3BFC718),
  12675. 270: uint32(0x00803DC7),
  12676. 271: uint32(0x0000FF80),
  12677. 272: uint32(0xFFFDDFEE),
  12678. 273: uint32(0xC3EFFDFF),
  12679. 274: uint32(0x00603DDF),
  12680. 275: uint32(0x0000FFC3),
  12681. 276: uint32(0xFFFDDFEC),
  12682. 277: uint32(0xC3EFFDFF),
  12683. 278: uint32(0x40603DDF),
  12684. 279: uint32(0x0000FFC3),
  12685. 280: uint32(0xFFFDDFEC),
  12686. 281: uint32(0xC3FFFDFF),
  12687. 282: uint32(0x00803DCF),
  12688. 283: uint32(0x0000FFC3),
  12689. 288: uint32(0xFFFFFFFE),
  12690. 289: uint32(0x07FF7FFF),
  12691. 290: uint32(0x03FF7FFF),
  12692. 292: uint32(0xFEF02596),
  12693. 293: uint32(0x3BFF6CAE),
  12694. 294: uint32(0x03FF3F5F),
  12695. 296: uint32(0x03000000),
  12696. 297: uint32(0xC2A003FF),
  12697. 298: uint32(0xFFFFFEFF),
  12698. 299: uint32(0xFFFE03FF),
  12699. 300: uint32(0xFEBF0FDF),
  12700. 301: uint32(0x02FE3FFF),
  12701. 310: uint32(0x1FFF0000),
  12702. 311: uint32(0x00000002),
  12703. 312: uint32(0x000000A0),
  12704. 313: uint32(0x003EFFFE),
  12705. 314: uint32(0xFFFFFFFE),
  12706. 315: uint32(0xFFFFFFFF),
  12707. 316: uint32(0x661FFFFF),
  12708. 317: uint32(0xFFFFFFFE),
  12709. 318: uint32(0xFFFFFFFF),
  12710. 319: uint32(0x77FFFFFF),
  12711. }
  12712. var _nmstrtPages = [256]uint8{
  12713. 0: uint8(0x02),
  12714. 1: uint8(0x03),
  12715. 2: uint8(0x04),
  12716. 3: uint8(0x05),
  12717. 4: uint8(0x06),
  12718. 5: uint8(0x07),
  12719. 6: uint8(0x08),
  12720. 9: uint8(0x09),
  12721. 10: uint8(0x0A),
  12722. 11: uint8(0x0B),
  12723. 12: uint8(0x0C),
  12724. 13: uint8(0x0D),
  12725. 14: uint8(0x0E),
  12726. 15: uint8(0x0F),
  12727. 16: uint8(0x10),
  12728. 17: uint8(0x11),
  12729. 30: uint8(0x12),
  12730. 31: uint8(0x13),
  12731. 33: uint8(0x14),
  12732. 48: uint8(0x15),
  12733. 49: uint8(0x16),
  12734. 78: uint8(0x01),
  12735. 79: uint8(0x01),
  12736. 80: uint8(0x01),
  12737. 81: uint8(0x01),
  12738. 82: uint8(0x01),
  12739. 83: uint8(0x01),
  12740. 84: uint8(0x01),
  12741. 85: uint8(0x01),
  12742. 86: uint8(0x01),
  12743. 87: uint8(0x01),
  12744. 88: uint8(0x01),
  12745. 89: uint8(0x01),
  12746. 90: uint8(0x01),
  12747. 91: uint8(0x01),
  12748. 92: uint8(0x01),
  12749. 93: uint8(0x01),
  12750. 94: uint8(0x01),
  12751. 95: uint8(0x01),
  12752. 96: uint8(0x01),
  12753. 97: uint8(0x01),
  12754. 98: uint8(0x01),
  12755. 99: uint8(0x01),
  12756. 100: uint8(0x01),
  12757. 101: uint8(0x01),
  12758. 102: uint8(0x01),
  12759. 103: uint8(0x01),
  12760. 104: uint8(0x01),
  12761. 105: uint8(0x01),
  12762. 106: uint8(0x01),
  12763. 107: uint8(0x01),
  12764. 108: uint8(0x01),
  12765. 109: uint8(0x01),
  12766. 110: uint8(0x01),
  12767. 111: uint8(0x01),
  12768. 112: uint8(0x01),
  12769. 113: uint8(0x01),
  12770. 114: uint8(0x01),
  12771. 115: uint8(0x01),
  12772. 116: uint8(0x01),
  12773. 117: uint8(0x01),
  12774. 118: uint8(0x01),
  12775. 119: uint8(0x01),
  12776. 120: uint8(0x01),
  12777. 121: uint8(0x01),
  12778. 122: uint8(0x01),
  12779. 123: uint8(0x01),
  12780. 124: uint8(0x01),
  12781. 125: uint8(0x01),
  12782. 126: uint8(0x01),
  12783. 127: uint8(0x01),
  12784. 128: uint8(0x01),
  12785. 129: uint8(0x01),
  12786. 130: uint8(0x01),
  12787. 131: uint8(0x01),
  12788. 132: uint8(0x01),
  12789. 133: uint8(0x01),
  12790. 134: uint8(0x01),
  12791. 135: uint8(0x01),
  12792. 136: uint8(0x01),
  12793. 137: uint8(0x01),
  12794. 138: uint8(0x01),
  12795. 139: uint8(0x01),
  12796. 140: uint8(0x01),
  12797. 141: uint8(0x01),
  12798. 142: uint8(0x01),
  12799. 143: uint8(0x01),
  12800. 144: uint8(0x01),
  12801. 145: uint8(0x01),
  12802. 146: uint8(0x01),
  12803. 147: uint8(0x01),
  12804. 148: uint8(0x01),
  12805. 149: uint8(0x01),
  12806. 150: uint8(0x01),
  12807. 151: uint8(0x01),
  12808. 152: uint8(0x01),
  12809. 153: uint8(0x01),
  12810. 154: uint8(0x01),
  12811. 155: uint8(0x01),
  12812. 156: uint8(0x01),
  12813. 157: uint8(0x01),
  12814. 158: uint8(0x01),
  12815. 159: uint8(0x17),
  12816. 172: uint8(0x01),
  12817. 173: uint8(0x01),
  12818. 174: uint8(0x01),
  12819. 175: uint8(0x01),
  12820. 176: uint8(0x01),
  12821. 177: uint8(0x01),
  12822. 178: uint8(0x01),
  12823. 179: uint8(0x01),
  12824. 180: uint8(0x01),
  12825. 181: uint8(0x01),
  12826. 182: uint8(0x01),
  12827. 183: uint8(0x01),
  12828. 184: uint8(0x01),
  12829. 185: uint8(0x01),
  12830. 186: uint8(0x01),
  12831. 187: uint8(0x01),
  12832. 188: uint8(0x01),
  12833. 189: uint8(0x01),
  12834. 190: uint8(0x01),
  12835. 191: uint8(0x01),
  12836. 192: uint8(0x01),
  12837. 193: uint8(0x01),
  12838. 194: uint8(0x01),
  12839. 195: uint8(0x01),
  12840. 196: uint8(0x01),
  12841. 197: uint8(0x01),
  12842. 198: uint8(0x01),
  12843. 199: uint8(0x01),
  12844. 200: uint8(0x01),
  12845. 201: uint8(0x01),
  12846. 202: uint8(0x01),
  12847. 203: uint8(0x01),
  12848. 204: uint8(0x01),
  12849. 205: uint8(0x01),
  12850. 206: uint8(0x01),
  12851. 207: uint8(0x01),
  12852. 208: uint8(0x01),
  12853. 209: uint8(0x01),
  12854. 210: uint8(0x01),
  12855. 211: uint8(0x01),
  12856. 212: uint8(0x01),
  12857. 213: uint8(0x01),
  12858. 214: uint8(0x01),
  12859. 215: uint8(0x18),
  12860. }
  12861. var _namePages = [256]uint8{
  12862. 0: uint8(0x19),
  12863. 1: uint8(0x03),
  12864. 2: uint8(0x1A),
  12865. 3: uint8(0x1B),
  12866. 4: uint8(0x1C),
  12867. 5: uint8(0x1D),
  12868. 6: uint8(0x1E),
  12869. 9: uint8(0x1F),
  12870. 10: uint8(0x20),
  12871. 11: uint8(0x21),
  12872. 12: uint8(0x22),
  12873. 13: uint8(0x23),
  12874. 14: uint8(0x24),
  12875. 15: uint8(0x25),
  12876. 16: uint8(0x10),
  12877. 17: uint8(0x11),
  12878. 30: uint8(0x12),
  12879. 31: uint8(0x13),
  12880. 32: uint8(0x26),
  12881. 33: uint8(0x14),
  12882. 48: uint8(0x27),
  12883. 49: uint8(0x16),
  12884. 78: uint8(0x01),
  12885. 79: uint8(0x01),
  12886. 80: uint8(0x01),
  12887. 81: uint8(0x01),
  12888. 82: uint8(0x01),
  12889. 83: uint8(0x01),
  12890. 84: uint8(0x01),
  12891. 85: uint8(0x01),
  12892. 86: uint8(0x01),
  12893. 87: uint8(0x01),
  12894. 88: uint8(0x01),
  12895. 89: uint8(0x01),
  12896. 90: uint8(0x01),
  12897. 91: uint8(0x01),
  12898. 92: uint8(0x01),
  12899. 93: uint8(0x01),
  12900. 94: uint8(0x01),
  12901. 95: uint8(0x01),
  12902. 96: uint8(0x01),
  12903. 97: uint8(0x01),
  12904. 98: uint8(0x01),
  12905. 99: uint8(0x01),
  12906. 100: uint8(0x01),
  12907. 101: uint8(0x01),
  12908. 102: uint8(0x01),
  12909. 103: uint8(0x01),
  12910. 104: uint8(0x01),
  12911. 105: uint8(0x01),
  12912. 106: uint8(0x01),
  12913. 107: uint8(0x01),
  12914. 108: uint8(0x01),
  12915. 109: uint8(0x01),
  12916. 110: uint8(0x01),
  12917. 111: uint8(0x01),
  12918. 112: uint8(0x01),
  12919. 113: uint8(0x01),
  12920. 114: uint8(0x01),
  12921. 115: uint8(0x01),
  12922. 116: uint8(0x01),
  12923. 117: uint8(0x01),
  12924. 118: uint8(0x01),
  12925. 119: uint8(0x01),
  12926. 120: uint8(0x01),
  12927. 121: uint8(0x01),
  12928. 122: uint8(0x01),
  12929. 123: uint8(0x01),
  12930. 124: uint8(0x01),
  12931. 125: uint8(0x01),
  12932. 126: uint8(0x01),
  12933. 127: uint8(0x01),
  12934. 128: uint8(0x01),
  12935. 129: uint8(0x01),
  12936. 130: uint8(0x01),
  12937. 131: uint8(0x01),
  12938. 132: uint8(0x01),
  12939. 133: uint8(0x01),
  12940. 134: uint8(0x01),
  12941. 135: uint8(0x01),
  12942. 136: uint8(0x01),
  12943. 137: uint8(0x01),
  12944. 138: uint8(0x01),
  12945. 139: uint8(0x01),
  12946. 140: uint8(0x01),
  12947. 141: uint8(0x01),
  12948. 142: uint8(0x01),
  12949. 143: uint8(0x01),
  12950. 144: uint8(0x01),
  12951. 145: uint8(0x01),
  12952. 146: uint8(0x01),
  12953. 147: uint8(0x01),
  12954. 148: uint8(0x01),
  12955. 149: uint8(0x01),
  12956. 150: uint8(0x01),
  12957. 151: uint8(0x01),
  12958. 152: uint8(0x01),
  12959. 153: uint8(0x01),
  12960. 154: uint8(0x01),
  12961. 155: uint8(0x01),
  12962. 156: uint8(0x01),
  12963. 157: uint8(0x01),
  12964. 158: uint8(0x01),
  12965. 159: uint8(0x17),
  12966. 172: uint8(0x01),
  12967. 173: uint8(0x01),
  12968. 174: uint8(0x01),
  12969. 175: uint8(0x01),
  12970. 176: uint8(0x01),
  12971. 177: uint8(0x01),
  12972. 178: uint8(0x01),
  12973. 179: uint8(0x01),
  12974. 180: uint8(0x01),
  12975. 181: uint8(0x01),
  12976. 182: uint8(0x01),
  12977. 183: uint8(0x01),
  12978. 184: uint8(0x01),
  12979. 185: uint8(0x01),
  12980. 186: uint8(0x01),
  12981. 187: uint8(0x01),
  12982. 188: uint8(0x01),
  12983. 189: uint8(0x01),
  12984. 190: uint8(0x01),
  12985. 191: uint8(0x01),
  12986. 192: uint8(0x01),
  12987. 193: uint8(0x01),
  12988. 194: uint8(0x01),
  12989. 195: uint8(0x01),
  12990. 196: uint8(0x01),
  12991. 197: uint8(0x01),
  12992. 198: uint8(0x01),
  12993. 199: uint8(0x01),
  12994. 200: uint8(0x01),
  12995. 201: uint8(0x01),
  12996. 202: uint8(0x01),
  12997. 203: uint8(0x01),
  12998. 204: uint8(0x01),
  12999. 205: uint8(0x01),
  13000. 206: uint8(0x01),
  13001. 207: uint8(0x01),
  13002. 208: uint8(0x01),
  13003. 209: uint8(0x01),
  13004. 210: uint8(0x01),
  13005. 211: uint8(0x01),
  13006. 212: uint8(0x01),
  13007. 213: uint8(0x01),
  13008. 214: uint8(0x01),
  13009. 215: uint8(0x18),
  13010. }
  13011. /* A 2 byte UTF-8 representation splits the characters 11 bits between
  13012. the bottom 5 and 6 bits of the bytes. We need 8 bits to index into
  13013. pages, 3 bits to add to that index and 5 bits to generate the mask.
  13014. */
  13015. /* A 3 byte UTF-8 representation splits the characters 16 bits between
  13016. the bottom 4, 6 and 6 bits of the bytes. We need 8 bits to index
  13017. into pages, 3 bits to add to that index and 5 bits to generate the
  13018. mask.
  13019. */
  13020. /* Detection of invalid UTF-8 sequences is based on Table 3.1B
  13021. of Unicode 3.2: http://www.unicode.org/unicode/reports/tr28/
  13022. with the additional restriction of not allowing the Unicode
  13023. code points 0xFFFF and 0xFFFE (sequences EF,BF,BF and EF,BF,BE).
  13024. Implementation details:
  13025. (A & 0x80) == 0 means A < 0x80
  13026. and
  13027. (A & 0xC0) == 0xC0 means A > 0xBF
  13028. */
  13029. func _isNever(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  13030. _ = enc
  13031. _ = p
  13032. return 0
  13033. }
  13034. func _utf8_isName2(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  13035. _ = enc
  13036. 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))))
  13037. }
  13038. func _utf8_isName3(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  13039. _ = enc
  13040. 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))))
  13041. }
  13042. func _utf8_isNmstrt2(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  13043. _ = enc
  13044. 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))))
  13045. }
  13046. func _utf8_isNmstrt3(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  13047. _ = enc
  13048. 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))))
  13049. }
  13050. func _utf8_isInvalid2(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  13051. _ = enc
  13052. 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))
  13053. }
  13054. func _utf8_isInvalid3(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  13055. var v1, v3, v4 int32
  13056. var v2, v5, v6 bool
  13057. _, _, _, _, _, _ = v1, v2, v3, v4, v5, v6
  13058. _ = enc
  13059. if v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2)))&int32(0x80) == 0; !v2 {
  13060. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xEF) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) == int32(0xBF) {
  13061. v1 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2))) > int32(0xBD))
  13062. } else {
  13063. v1 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2)))&int32(0xC0) == int32(0xC0))
  13064. }
  13065. }
  13066. if v6 = v2 || v1 != 0; !v6 {
  13067. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xE0) {
  13068. v3 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) < int32(0xA0) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  13069. } else {
  13070. if v5 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0x80) == 0; !v5 {
  13071. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xED) {
  13072. v4 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) > int32(0x9F))
  13073. } else {
  13074. v4 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  13075. }
  13076. }
  13077. v3 = libc.BoolInt32(v5 || v4 != 0)
  13078. }
  13079. }
  13080. return libc.BoolInt32(v6 || v3 != 0)
  13081. }
  13082. func _utf8_isInvalid4(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  13083. var v1, v2 int32
  13084. var v3, v4 bool
  13085. _, _, _, _ = v1, v2, v3, v4
  13086. _ = enc
  13087. 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 {
  13088. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xF0) {
  13089. v1 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) < int32(0x90) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  13090. } else {
  13091. if v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0x80) == 0; !v3 {
  13092. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xF4) {
  13093. v2 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) > int32(0x8F))
  13094. } else {
  13095. v2 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  13096. }
  13097. }
  13098. v1 = libc.BoolInt32(v3 || v2 != 0)
  13099. }
  13100. }
  13101. return libc.BoolInt32(v4 || v1 != 0)
  13102. }
  13103. type Tnormal_encoding = struct {
  13104. Fenc TENCODING
  13105. Ftype1 [256]uint8
  13106. FisName2 uintptr
  13107. FisName3 uintptr
  13108. FisName4 uintptr
  13109. FisNmstrt2 uintptr
  13110. FisNmstrt3 uintptr
  13111. FisNmstrt4 uintptr
  13112. FisInvalid2 uintptr
  13113. FisInvalid3 uintptr
  13114. FisInvalid4 uintptr
  13115. }
  13116. const _BT_NONXML = 0
  13117. const _BT_MALFORM = 1
  13118. const _BT_LT = 2
  13119. const _BT_AMP = 3
  13120. const _BT_RSQB = 4
  13121. const _BT_LEAD2 = 5
  13122. const _BT_LEAD3 = 6
  13123. const _BT_LEAD4 = 7
  13124. const _BT_TRAIL = 8
  13125. const _BT_CR = 9
  13126. const _BT_LF = 10
  13127. const _BT_GT = 11
  13128. const _BT_QUOT = 12
  13129. const _BT_APOS = 13
  13130. const _BT_EQUALS = 14
  13131. const _BT_QUEST = 15
  13132. const _BT_EXCL = 16
  13133. const _BT_SOL = 17
  13134. const _BT_SEMI = 18
  13135. const _BT_NUM = 19
  13136. const _BT_LSQB = 20
  13137. const _BT_S = 21
  13138. const _BT_NMSTRT = 22
  13139. const _BT_COLON = 23
  13140. const _BT_HEX = 24
  13141. const _BT_DIGIT = 25
  13142. const _BT_NAME = 26
  13143. const _BT_MINUS = 27
  13144. const _BT_OTHER = 28
  13145. const _BT_NONASCII = 29
  13146. const _BT_PERCNT = 30
  13147. const _BT_LPAR = 31
  13148. const _BT_RPAR = 32
  13149. const _BT_AST = 33
  13150. const _BT_PLUS = 34
  13151. const _BT_COMMA = 35
  13152. const _BT_VERBAR = 36
  13153. /*
  13154. __ __ _
  13155. ___\ \/ /_ __ __ _| |_
  13156. / _ \\ /| '_ \ / _` | __|
  13157. | __// \| |_) | (_| | |_
  13158. \___/_/\_\ .__/ \__,_|\__|
  13159. |_| XML parser
  13160. Copyright (c) 1999-2000 Thai Open Source Software Center Ltd
  13161. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  13162. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  13163. Copyright (c) 2007 Karl Waclawek <karl@waclawek.net>
  13164. Copyright (c) 2017 Sebastian Pipping <sebastian@pipping.org>
  13165. Licensed under the MIT license:
  13166. Permission is hereby granted, free of charge, to any person obtaining
  13167. a copy of this software and associated documentation files (the
  13168. "Software"), to deal in the Software without restriction, including
  13169. without limitation the rights to use, copy, modify, merge, publish,
  13170. distribute, sublicense, and/or sell copies of the Software, and to permit
  13171. persons to whom the Software is furnished to do so, subject to the
  13172. following conditions:
  13173. The above copyright notice and this permission notice shall be included
  13174. in all copies or substantial portions of the Software.
  13175. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  13176. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  13177. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  13178. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  13179. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  13180. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  13181. USE OR OTHER DEALINGS IN THE SOFTWARE.
  13182. */
  13183. /* minimum bytes per character */
  13184. /* c is an ASCII character */
  13185. /* This file is included (from xmltok.c, 1-3 times depending on XML_MIN_SIZE)!
  13186. __ __ _
  13187. ___\ \/ /_ __ __ _| |_
  13188. / _ \\ /| '_ \ / _` | __|
  13189. | __// \| |_) | (_| | |_
  13190. \___/_/\_\ .__/ \__,_|\__|
  13191. |_| XML parser
  13192. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  13193. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  13194. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  13195. Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
  13196. Copyright (c) 2016-2022 Sebastian Pipping <sebastian@pipping.org>
  13197. Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
  13198. Copyright (c) 2018 Benjamin Peterson <benjamin@python.org>
  13199. Copyright (c) 2018 Anton Maklakov <antmak.pub@gmail.com>
  13200. Copyright (c) 2019 David Loffredo <loffredo@steptools.com>
  13201. Copyright (c) 2020 Boris Kolpackov <boris@codesynthesis.com>
  13202. Copyright (c) 2022 Martin Ettl <ettl.martin78@googlemail.com>
  13203. Licensed under the MIT license:
  13204. Permission is hereby granted, free of charge, to any person obtaining
  13205. a copy of this software and associated documentation files (the
  13206. "Software"), to deal in the Software without restriction, including
  13207. without limitation the rights to use, copy, modify, merge, publish,
  13208. distribute, sublicense, and/or sell copies of the Software, and to permit
  13209. persons to whom the Software is furnished to do so, subject to the
  13210. following conditions:
  13211. The above copyright notice and this permission notice shall be included
  13212. in all copies or substantial portions of the Software.
  13213. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  13214. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  13215. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  13216. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  13217. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  13218. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  13219. USE OR OTHER DEALINGS IN THE SOFTWARE.
  13220. */
  13221. /* ptr points to character following "<!-" */
  13222. func _normal_scanComment(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13223. if int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  13224. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_MINUS1)) {
  13225. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13226. return m_XML_TOK_INVALID
  13227. }
  13228. ptr += uintptr(1)
  13229. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  13230. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13231. case int32(_BT_LEAD2):
  13232. if int32(end)-int32(ptr) < int32(2) {
  13233. return -int32(2)
  13234. }
  13235. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  13236. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13237. return m_XML_TOK_INVALID
  13238. }
  13239. ptr += uintptr(2)
  13240. case int32(_BT_LEAD3):
  13241. if int32(end)-int32(ptr) < int32(3) {
  13242. return -int32(2)
  13243. }
  13244. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  13245. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13246. return m_XML_TOK_INVALID
  13247. }
  13248. ptr += uintptr(3)
  13249. case int32(_BT_LEAD4):
  13250. if int32(end)-int32(ptr) < int32(4) {
  13251. return -int32(2)
  13252. }
  13253. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  13254. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13255. return m_XML_TOK_INVALID
  13256. }
  13257. ptr += uintptr(4)
  13258. case int32(_BT_NONXML):
  13259. fallthrough
  13260. case int32(_BT_MALFORM):
  13261. fallthrough
  13262. case int32(_BT_TRAIL):
  13263. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13264. return m_XML_TOK_INVALID
  13265. case int32(_BT_MINUS):
  13266. ptr += uintptr(1)
  13267. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13268. return -int32(1)
  13269. }
  13270. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_MINUS1) {
  13271. ptr += uintptr(1)
  13272. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13273. return -int32(1)
  13274. }
  13275. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  13276. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13277. return m_XML_TOK_INVALID
  13278. }
  13279. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13280. return int32(m_XML_TOK_COMMENT)
  13281. }
  13282. default:
  13283. ptr += uintptr(1)
  13284. break
  13285. }
  13286. }
  13287. }
  13288. return -int32(1)
  13289. }
  13290. /* ptr points to character following "<!" */
  13291. func _normal_scanDecl(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13292. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13293. return -int32(1)
  13294. }
  13295. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13296. case int32(_BT_MINUS):
  13297. return _normal_scanComment(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  13298. case int32(_BT_LSQB):
  13299. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13300. return int32(m_XML_TOK_COND_SECT_OPEN)
  13301. case int32(_BT_NMSTRT):
  13302. fallthrough
  13303. case int32(_BT_HEX):
  13304. ptr += uintptr(1)
  13305. default:
  13306. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13307. return m_XML_TOK_INVALID
  13308. }
  13309. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  13310. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13311. case int32(_BT_PERCNT):
  13312. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(2)*libc.Int32FromInt32(1)) {
  13313. return -int32(1)
  13314. }
  13315. /* don't allow <!ENTITY% foo "whatever"> */
  13316. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1))))))) {
  13317. case int32(_BT_S):
  13318. fallthrough
  13319. case int32(_BT_CR):
  13320. fallthrough
  13321. case int32(_BT_LF):
  13322. fallthrough
  13323. case int32(_BT_PERCNT):
  13324. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13325. return m_XML_TOK_INVALID
  13326. }
  13327. /* fall through */
  13328. fallthrough
  13329. case int32(_BT_S):
  13330. fallthrough
  13331. case int32(_BT_CR):
  13332. fallthrough
  13333. case int32(_BT_LF):
  13334. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13335. return int32(m_XML_TOK_DECL_OPEN)
  13336. case int32(_BT_NMSTRT):
  13337. fallthrough
  13338. case int32(_BT_HEX):
  13339. ptr += uintptr(1)
  13340. default:
  13341. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13342. return m_XML_TOK_INVALID
  13343. }
  13344. }
  13345. return -int32(1)
  13346. }
  13347. func _normal_checkPiTarget(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, tokPtr uintptr) (r int32) {
  13348. var upper int32
  13349. _ = upper
  13350. upper = 0
  13351. _ = enc
  13352. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_PI)
  13353. if int32(end)-int32(ptr) != libc.Int32FromInt32(1)*libc.Int32FromInt32(3) {
  13354. return int32(1)
  13355. }
  13356. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  13357. case int32(m_ASCII_x2):
  13358. case int32(m_ASCII_X):
  13359. upper = int32(1)
  13360. default:
  13361. return int32(1)
  13362. }
  13363. ptr += uintptr(1)
  13364. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  13365. case int32(m_ASCII_m2):
  13366. case int32(m_ASCII_M):
  13367. upper = int32(1)
  13368. default:
  13369. return int32(1)
  13370. }
  13371. ptr += uintptr(1)
  13372. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  13373. case int32(m_ASCII_l2):
  13374. case int32(m_ASCII_L):
  13375. upper = int32(1)
  13376. default:
  13377. return int32(1)
  13378. }
  13379. if upper != 0 {
  13380. return 0
  13381. }
  13382. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_XML_DECL)
  13383. return int32(1)
  13384. }
  13385. /* ptr points to character following "<?" */
  13386. func _normal_scanPi(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13387. bp := tls.Alloc(16)
  13388. defer tls.Free(16)
  13389. var target uintptr
  13390. var _ /* tok at bp+0 */ int32
  13391. _ = target
  13392. target = ptr
  13393. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13394. return -int32(1)
  13395. }
  13396. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13397. case int32(_BT_NONASCII):
  13398. if !(libc.Int32FromInt32(0) != 0) {
  13399. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13400. return m_XML_TOK_INVALID
  13401. } /* fall through */
  13402. fallthrough
  13403. case int32(_BT_NMSTRT):
  13404. fallthrough
  13405. case int32(_BT_HEX):
  13406. ptr += uintptr(1)
  13407. case int32(_BT_LEAD2):
  13408. if int32(end)-int32(ptr) < int32(2) {
  13409. return -int32(2)
  13410. }
  13411. 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) {
  13412. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13413. return m_XML_TOK_INVALID
  13414. }
  13415. ptr += uintptr(2)
  13416. case int32(_BT_LEAD3):
  13417. if int32(end)-int32(ptr) < int32(3) {
  13418. return -int32(2)
  13419. }
  13420. 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) {
  13421. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13422. return m_XML_TOK_INVALID
  13423. }
  13424. ptr += uintptr(3)
  13425. case int32(_BT_LEAD4):
  13426. if int32(end)-int32(ptr) < int32(4) {
  13427. return -int32(2)
  13428. }
  13429. 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) {
  13430. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13431. return m_XML_TOK_INVALID
  13432. }
  13433. ptr += uintptr(4)
  13434. default:
  13435. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13436. return m_XML_TOK_INVALID
  13437. }
  13438. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  13439. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13440. case int32(_BT_NONASCII):
  13441. if !(libc.Int32FromInt32(0) != 0) {
  13442. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13443. return m_XML_TOK_INVALID
  13444. } /* fall through */
  13445. fallthrough
  13446. case int32(_BT_NMSTRT):
  13447. fallthrough
  13448. case int32(_BT_HEX):
  13449. fallthrough
  13450. case int32(_BT_DIGIT):
  13451. fallthrough
  13452. case int32(_BT_NAME):
  13453. fallthrough
  13454. case int32(_BT_MINUS):
  13455. ptr += uintptr(1)
  13456. case int32(_BT_LEAD2):
  13457. if int32(end)-int32(ptr) < int32(2) {
  13458. return -int32(2)
  13459. }
  13460. 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) {
  13461. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13462. return m_XML_TOK_INVALID
  13463. }
  13464. ptr += uintptr(2)
  13465. case int32(_BT_LEAD3):
  13466. if int32(end)-int32(ptr) < int32(3) {
  13467. return -int32(2)
  13468. }
  13469. 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) {
  13470. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13471. return m_XML_TOK_INVALID
  13472. }
  13473. ptr += uintptr(3)
  13474. case int32(_BT_LEAD4):
  13475. if int32(end)-int32(ptr) < int32(4) {
  13476. return -int32(2)
  13477. }
  13478. 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) {
  13479. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13480. return m_XML_TOK_INVALID
  13481. }
  13482. ptr += uintptr(4)
  13483. case int32(_BT_S):
  13484. fallthrough
  13485. case int32(_BT_CR):
  13486. fallthrough
  13487. case int32(_BT_LF):
  13488. if !(_normal_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  13489. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13490. return m_XML_TOK_INVALID
  13491. }
  13492. ptr += uintptr(1)
  13493. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  13494. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13495. case int32(_BT_LEAD2):
  13496. if int32(end)-int32(ptr) < int32(2) {
  13497. return -int32(2)
  13498. }
  13499. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  13500. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13501. return m_XML_TOK_INVALID
  13502. }
  13503. ptr += uintptr(2)
  13504. case int32(_BT_LEAD3):
  13505. if int32(end)-int32(ptr) < int32(3) {
  13506. return -int32(2)
  13507. }
  13508. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  13509. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13510. return m_XML_TOK_INVALID
  13511. }
  13512. ptr += uintptr(3)
  13513. case int32(_BT_LEAD4):
  13514. if int32(end)-int32(ptr) < int32(4) {
  13515. return -int32(2)
  13516. }
  13517. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  13518. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13519. return m_XML_TOK_INVALID
  13520. }
  13521. ptr += uintptr(4)
  13522. case int32(_BT_NONXML):
  13523. fallthrough
  13524. case int32(_BT_MALFORM):
  13525. fallthrough
  13526. case int32(_BT_TRAIL):
  13527. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13528. return m_XML_TOK_INVALID
  13529. case int32(_BT_QUEST):
  13530. ptr += uintptr(1)
  13531. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13532. return -int32(1)
  13533. }
  13534. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  13535. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13536. return *(*int32)(unsafe.Pointer(bp))
  13537. }
  13538. default:
  13539. ptr += uintptr(1)
  13540. break
  13541. }
  13542. }
  13543. return -int32(1)
  13544. case int32(_BT_QUEST):
  13545. if !(_normal_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  13546. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13547. return m_XML_TOK_INVALID
  13548. }
  13549. ptr += uintptr(1)
  13550. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13551. return -int32(1)
  13552. }
  13553. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  13554. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13555. return *(*int32)(unsafe.Pointer(bp))
  13556. }
  13557. /* fall through */
  13558. fallthrough
  13559. default:
  13560. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13561. return m_XML_TOK_INVALID
  13562. }
  13563. }
  13564. return -int32(1)
  13565. }
  13566. func _normal_scanCdataSection(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13567. var i int32
  13568. _ = i
  13569. _ = enc
  13570. /* CDATA[ */
  13571. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(6)*libc.Int32FromInt32(1)) {
  13572. return -int32(1)
  13573. }
  13574. i = 0
  13575. for {
  13576. if !(i < int32(6)) {
  13577. break
  13578. }
  13579. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromUint8(_CDATA_LSQB[i])) {
  13580. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13581. return m_XML_TOK_INVALID
  13582. }
  13583. goto _1
  13584. _1:
  13585. ;
  13586. i++
  13587. ptr += uintptr(1)
  13588. }
  13589. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13590. return int32(m_XML_TOK_CDATA_SECT_OPEN)
  13591. }
  13592. var _CDATA_LSQB = [6]uint8{
  13593. 0: uint8(m_ASCII_C),
  13594. 1: uint8(m_ASCII_D),
  13595. 2: uint8(m_ASCII_A),
  13596. 3: uint8(m_ASCII_T),
  13597. 4: uint8(m_ASCII_A),
  13598. 5: uint8(m_ASCII_LSQB1),
  13599. }
  13600. func _normal_cdataSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13601. var n Tsize_t
  13602. _ = n
  13603. if ptr >= end {
  13604. return -int32(4)
  13605. }
  13606. if int32(1) > int32(1) {
  13607. n = libc.Uint32FromInt32(int32(end) - int32(ptr))
  13608. if n&libc.Uint32FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  13609. n &= libc.Uint32FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  13610. if n == uint32(0) {
  13611. return -int32(1)
  13612. }
  13613. end = ptr + uintptr(n)
  13614. }
  13615. }
  13616. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13617. case int32(_BT_RSQB):
  13618. ptr += uintptr(1)
  13619. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13620. return -int32(1)
  13621. }
  13622. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_RSQB1)) {
  13623. break
  13624. }
  13625. ptr += uintptr(1)
  13626. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13627. return -int32(1)
  13628. }
  13629. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  13630. ptr -= uintptr(1)
  13631. break
  13632. }
  13633. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13634. return int32(m_XML_TOK_CDATA_SECT_CLOSE)
  13635. case int32(_BT_CR):
  13636. ptr += uintptr(1)
  13637. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13638. return -int32(1)
  13639. }
  13640. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) == int32(_BT_LF) {
  13641. ptr += uintptr(1)
  13642. }
  13643. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13644. return int32(m_XML_TOK_DATA_NEWLINE)
  13645. case int32(_BT_LF):
  13646. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13647. return int32(m_XML_TOK_DATA_NEWLINE)
  13648. case int32(_BT_LEAD2):
  13649. if int32(end)-int32(ptr) < int32(2) {
  13650. return -int32(2)
  13651. }
  13652. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  13653. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13654. return m_XML_TOK_INVALID
  13655. }
  13656. ptr += uintptr(2)
  13657. case int32(_BT_LEAD3):
  13658. if int32(end)-int32(ptr) < int32(3) {
  13659. return -int32(2)
  13660. }
  13661. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  13662. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13663. return m_XML_TOK_INVALID
  13664. }
  13665. ptr += uintptr(3)
  13666. case int32(_BT_LEAD4):
  13667. if int32(end)-int32(ptr) < int32(4) {
  13668. return -int32(2)
  13669. }
  13670. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  13671. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13672. return m_XML_TOK_INVALID
  13673. }
  13674. ptr += uintptr(4)
  13675. case int32(_BT_NONXML):
  13676. fallthrough
  13677. case int32(_BT_MALFORM):
  13678. fallthrough
  13679. case int32(_BT_TRAIL):
  13680. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13681. return m_XML_TOK_INVALID
  13682. default:
  13683. ptr += uintptr(1)
  13684. break
  13685. }
  13686. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  13687. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13688. case int32(_BT_LEAD2):
  13689. if int32(end)-int32(ptr) < int32(2) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  13690. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13691. return int32(m_XML_TOK_DATA_CHARS)
  13692. }
  13693. ptr += uintptr(2)
  13694. case int32(_BT_LEAD3):
  13695. if int32(end)-int32(ptr) < int32(3) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  13696. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13697. return int32(m_XML_TOK_DATA_CHARS)
  13698. }
  13699. ptr += uintptr(3)
  13700. case int32(_BT_LEAD4):
  13701. if int32(end)-int32(ptr) < int32(4) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  13702. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13703. return int32(m_XML_TOK_DATA_CHARS)
  13704. }
  13705. ptr += uintptr(4)
  13706. case int32(_BT_NONXML):
  13707. fallthrough
  13708. case int32(_BT_MALFORM):
  13709. fallthrough
  13710. case int32(_BT_TRAIL):
  13711. fallthrough
  13712. case int32(_BT_CR):
  13713. fallthrough
  13714. case int32(_BT_LF):
  13715. fallthrough
  13716. case int32(_BT_RSQB):
  13717. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13718. return int32(m_XML_TOK_DATA_CHARS)
  13719. default:
  13720. ptr += uintptr(1)
  13721. break
  13722. }
  13723. }
  13724. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13725. return int32(m_XML_TOK_DATA_CHARS)
  13726. }
  13727. /* ptr points to character following "</" */
  13728. func _normal_scanEndTag(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13729. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13730. return -int32(1)
  13731. }
  13732. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13733. case int32(_BT_NONASCII):
  13734. if !(libc.Int32FromInt32(0) != 0) {
  13735. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13736. return m_XML_TOK_INVALID
  13737. } /* fall through */
  13738. fallthrough
  13739. case int32(_BT_NMSTRT):
  13740. fallthrough
  13741. case int32(_BT_HEX):
  13742. ptr += uintptr(1)
  13743. case int32(_BT_LEAD2):
  13744. if int32(end)-int32(ptr) < int32(2) {
  13745. return -int32(2)
  13746. }
  13747. 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) {
  13748. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13749. return m_XML_TOK_INVALID
  13750. }
  13751. ptr += uintptr(2)
  13752. case int32(_BT_LEAD3):
  13753. if int32(end)-int32(ptr) < int32(3) {
  13754. return -int32(2)
  13755. }
  13756. 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) {
  13757. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13758. return m_XML_TOK_INVALID
  13759. }
  13760. ptr += uintptr(3)
  13761. case int32(_BT_LEAD4):
  13762. if int32(end)-int32(ptr) < int32(4) {
  13763. return -int32(2)
  13764. }
  13765. 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) {
  13766. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13767. return m_XML_TOK_INVALID
  13768. }
  13769. ptr += uintptr(4)
  13770. default:
  13771. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13772. return m_XML_TOK_INVALID
  13773. }
  13774. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  13775. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13776. case int32(_BT_NONASCII):
  13777. goto _1
  13778. case int32(_BT_MINUS):
  13779. goto _2
  13780. case int32(_BT_NAME):
  13781. goto _3
  13782. case int32(_BT_DIGIT):
  13783. goto _4
  13784. case int32(_BT_HEX):
  13785. goto _5
  13786. case int32(_BT_NMSTRT):
  13787. goto _6
  13788. case int32(_BT_LEAD2):
  13789. goto _7
  13790. case int32(_BT_LEAD3):
  13791. goto _8
  13792. case int32(_BT_LEAD4):
  13793. goto _9
  13794. case int32(_BT_LF):
  13795. goto _10
  13796. case int32(_BT_CR):
  13797. goto _11
  13798. case int32(_BT_S):
  13799. goto _12
  13800. case int32(_BT_COLON):
  13801. goto _13
  13802. case int32(_BT_GT):
  13803. goto _14
  13804. default:
  13805. goto _15
  13806. }
  13807. goto _16
  13808. _1:
  13809. ;
  13810. if !(libc.Int32FromInt32(0) != 0) {
  13811. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13812. return m_XML_TOK_INVALID
  13813. } /* fall through */
  13814. _6:
  13815. ;
  13816. _5:
  13817. ;
  13818. _4:
  13819. ;
  13820. _3:
  13821. ;
  13822. _2:
  13823. ;
  13824. ptr += uintptr(1)
  13825. goto _16
  13826. _7:
  13827. ;
  13828. if int32(end)-int32(ptr) < int32(2) {
  13829. return -int32(2)
  13830. }
  13831. 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) {
  13832. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13833. return m_XML_TOK_INVALID
  13834. }
  13835. ptr += uintptr(2)
  13836. goto _16
  13837. _8:
  13838. ;
  13839. if int32(end)-int32(ptr) < int32(3) {
  13840. return -int32(2)
  13841. }
  13842. 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) {
  13843. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13844. return m_XML_TOK_INVALID
  13845. }
  13846. ptr += uintptr(3)
  13847. goto _16
  13848. _9:
  13849. ;
  13850. if int32(end)-int32(ptr) < int32(4) {
  13851. return -int32(2)
  13852. }
  13853. 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) {
  13854. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13855. return m_XML_TOK_INVALID
  13856. }
  13857. ptr += uintptr(4)
  13858. goto _16
  13859. _12:
  13860. ;
  13861. _11:
  13862. ;
  13863. _10:
  13864. ;
  13865. ptr += uintptr(1)
  13866. _19:
  13867. ;
  13868. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13869. goto _17
  13870. }
  13871. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13872. case int32(_BT_S):
  13873. fallthrough
  13874. case int32(_BT_CR):
  13875. fallthrough
  13876. case int32(_BT_LF):
  13877. case int32(_BT_GT):
  13878. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13879. return int32(m_XML_TOK_END_TAG)
  13880. default:
  13881. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13882. return m_XML_TOK_INVALID
  13883. }
  13884. goto _18
  13885. _18:
  13886. ;
  13887. ptr += uintptr(1)
  13888. goto _19
  13889. goto _17
  13890. _17:
  13891. ;
  13892. return -int32(1)
  13893. _13:
  13894. ;
  13895. /* no need to check qname syntax here,
  13896. since end-tag must match exactly */
  13897. ptr += uintptr(1)
  13898. goto _16
  13899. _14:
  13900. ;
  13901. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13902. return int32(m_XML_TOK_END_TAG)
  13903. _15:
  13904. ;
  13905. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13906. return m_XML_TOK_INVALID
  13907. _16:
  13908. }
  13909. return -int32(1)
  13910. }
  13911. /* ptr points to character following "&#X" */
  13912. func _normal_scanHexCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13913. if int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  13914. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13915. case int32(_BT_DIGIT):
  13916. fallthrough
  13917. case int32(_BT_HEX):
  13918. default:
  13919. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13920. return m_XML_TOK_INVALID
  13921. }
  13922. ptr += uintptr(1)
  13923. for {
  13924. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13925. break
  13926. }
  13927. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13928. case int32(_BT_DIGIT):
  13929. fallthrough
  13930. case int32(_BT_HEX):
  13931. case int32(_BT_SEMI):
  13932. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13933. return int32(m_XML_TOK_CHAR_REF)
  13934. default:
  13935. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13936. return m_XML_TOK_INVALID
  13937. }
  13938. goto _1
  13939. _1:
  13940. ;
  13941. ptr += uintptr(1)
  13942. }
  13943. }
  13944. return -int32(1)
  13945. }
  13946. /* ptr points to character following "&#" */
  13947. func _normal_scanCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13948. if int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  13949. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  13950. return _normal_scanHexCharRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  13951. }
  13952. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13953. case int32(_BT_DIGIT):
  13954. default:
  13955. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13956. return m_XML_TOK_INVALID
  13957. }
  13958. ptr += uintptr(1)
  13959. for {
  13960. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13961. break
  13962. }
  13963. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13964. case int32(_BT_DIGIT):
  13965. case int32(_BT_SEMI):
  13966. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13967. return int32(m_XML_TOK_CHAR_REF)
  13968. default:
  13969. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13970. return m_XML_TOK_INVALID
  13971. }
  13972. goto _1
  13973. _1:
  13974. ;
  13975. ptr += uintptr(1)
  13976. }
  13977. }
  13978. return -int32(1)
  13979. }
  13980. /* ptr points to character following "&" */
  13981. func _normal_scanRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13982. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13983. return -int32(1)
  13984. }
  13985. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13986. case int32(_BT_NONASCII):
  13987. if !(libc.Int32FromInt32(0) != 0) {
  13988. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13989. return m_XML_TOK_INVALID
  13990. } /* fall through */
  13991. fallthrough
  13992. case int32(_BT_NMSTRT):
  13993. fallthrough
  13994. case int32(_BT_HEX):
  13995. ptr += uintptr(1)
  13996. case int32(_BT_LEAD2):
  13997. if int32(end)-int32(ptr) < int32(2) {
  13998. return -int32(2)
  13999. }
  14000. 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) {
  14001. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14002. return m_XML_TOK_INVALID
  14003. }
  14004. ptr += uintptr(2)
  14005. case int32(_BT_LEAD3):
  14006. if int32(end)-int32(ptr) < int32(3) {
  14007. return -int32(2)
  14008. }
  14009. 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) {
  14010. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14011. return m_XML_TOK_INVALID
  14012. }
  14013. ptr += uintptr(3)
  14014. case int32(_BT_LEAD4):
  14015. if int32(end)-int32(ptr) < int32(4) {
  14016. return -int32(2)
  14017. }
  14018. 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) {
  14019. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14020. return m_XML_TOK_INVALID
  14021. }
  14022. ptr += uintptr(4)
  14023. case int32(_BT_NUM):
  14024. return _normal_scanCharRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14025. default:
  14026. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14027. return m_XML_TOK_INVALID
  14028. }
  14029. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  14030. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  14031. case int32(_BT_NONASCII):
  14032. if !(libc.Int32FromInt32(0) != 0) {
  14033. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14034. return m_XML_TOK_INVALID
  14035. } /* fall through */
  14036. fallthrough
  14037. case int32(_BT_NMSTRT):
  14038. fallthrough
  14039. case int32(_BT_HEX):
  14040. fallthrough
  14041. case int32(_BT_DIGIT):
  14042. fallthrough
  14043. case int32(_BT_NAME):
  14044. fallthrough
  14045. case int32(_BT_MINUS):
  14046. ptr += uintptr(1)
  14047. case int32(_BT_LEAD2):
  14048. if int32(end)-int32(ptr) < int32(2) {
  14049. return -int32(2)
  14050. }
  14051. 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) {
  14052. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14053. return m_XML_TOK_INVALID
  14054. }
  14055. ptr += uintptr(2)
  14056. case int32(_BT_LEAD3):
  14057. if int32(end)-int32(ptr) < int32(3) {
  14058. return -int32(2)
  14059. }
  14060. 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) {
  14061. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14062. return m_XML_TOK_INVALID
  14063. }
  14064. ptr += uintptr(3)
  14065. case int32(_BT_LEAD4):
  14066. if int32(end)-int32(ptr) < int32(4) {
  14067. return -int32(2)
  14068. }
  14069. 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) {
  14070. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14071. return m_XML_TOK_INVALID
  14072. }
  14073. ptr += uintptr(4)
  14074. case int32(_BT_SEMI):
  14075. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14076. return int32(m_XML_TOK_ENTITY_REF)
  14077. default:
  14078. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14079. return m_XML_TOK_INVALID
  14080. }
  14081. }
  14082. return -int32(1)
  14083. }
  14084. /* ptr points to character following first character of attribute name */
  14085. func _normal_scanAtts(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  14086. bp := tls.Alloc(16)
  14087. defer tls.Free(16)
  14088. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  14089. var hadColon, open, t, t1, tok int32
  14090. _, _, _, _, _ = hadColon, open, t, t1, tok
  14091. hadColon = 0
  14092. for int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  14093. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))) {
  14094. case int32(_BT_NONASCII):
  14095. goto _1
  14096. case int32(_BT_MINUS):
  14097. goto _2
  14098. case int32(_BT_NAME):
  14099. goto _3
  14100. case int32(_BT_DIGIT):
  14101. goto _4
  14102. case int32(_BT_HEX):
  14103. goto _5
  14104. case int32(_BT_NMSTRT):
  14105. goto _6
  14106. case int32(_BT_LEAD2):
  14107. goto _7
  14108. case int32(_BT_LEAD3):
  14109. goto _8
  14110. case int32(_BT_LEAD4):
  14111. goto _9
  14112. case int32(_BT_COLON):
  14113. goto _10
  14114. case int32(_BT_LF):
  14115. goto _11
  14116. case int32(_BT_CR):
  14117. goto _12
  14118. case int32(_BT_S):
  14119. goto _13
  14120. case int32(_BT_EQUALS):
  14121. goto _14
  14122. default:
  14123. goto _15
  14124. }
  14125. goto _16
  14126. _1:
  14127. ;
  14128. if !(libc.Int32FromInt32(0) != 0) {
  14129. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14130. return m_XML_TOK_INVALID
  14131. } /* fall through */
  14132. _6:
  14133. ;
  14134. _5:
  14135. ;
  14136. _4:
  14137. ;
  14138. _3:
  14139. ;
  14140. _2:
  14141. ;
  14142. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14143. goto _16
  14144. _7:
  14145. ;
  14146. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(2) {
  14147. return -int32(2)
  14148. }
  14149. 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) {
  14150. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14151. return m_XML_TOK_INVALID
  14152. }
  14153. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  14154. goto _16
  14155. _8:
  14156. ;
  14157. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(3) {
  14158. return -int32(2)
  14159. }
  14160. 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) {
  14161. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14162. return m_XML_TOK_INVALID
  14163. }
  14164. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  14165. goto _16
  14166. _9:
  14167. ;
  14168. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(4) {
  14169. return -int32(2)
  14170. }
  14171. 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) {
  14172. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14173. return m_XML_TOK_INVALID
  14174. }
  14175. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  14176. goto _16
  14177. _10:
  14178. ;
  14179. if hadColon != 0 {
  14180. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14181. return m_XML_TOK_INVALID
  14182. }
  14183. hadColon = int32(1)
  14184. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14185. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14186. return -int32(1)
  14187. }
  14188. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))) {
  14189. case int32(_BT_NONASCII):
  14190. if !(libc.Int32FromInt32(0) != 0) {
  14191. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14192. return m_XML_TOK_INVALID
  14193. } /* fall through */
  14194. fallthrough
  14195. case int32(_BT_NMSTRT):
  14196. fallthrough
  14197. case int32(_BT_HEX):
  14198. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14199. case int32(_BT_LEAD2):
  14200. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(2) {
  14201. return -int32(2)
  14202. }
  14203. 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) {
  14204. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14205. return m_XML_TOK_INVALID
  14206. }
  14207. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  14208. case int32(_BT_LEAD3):
  14209. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(3) {
  14210. return -int32(2)
  14211. }
  14212. 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) {
  14213. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14214. return m_XML_TOK_INVALID
  14215. }
  14216. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  14217. case int32(_BT_LEAD4):
  14218. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(4) {
  14219. return -int32(2)
  14220. }
  14221. 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) {
  14222. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14223. return m_XML_TOK_INVALID
  14224. }
  14225. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  14226. default:
  14227. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14228. return m_XML_TOK_INVALID
  14229. }
  14230. goto _16
  14231. _13:
  14232. ;
  14233. _12:
  14234. ;
  14235. _11:
  14236. ;
  14237. _19:
  14238. ;
  14239. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14240. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14241. return -int32(1)
  14242. }
  14243. t = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  14244. if t == int32(_BT_EQUALS) {
  14245. goto _17
  14246. }
  14247. switch t {
  14248. case int32(_BT_S):
  14249. fallthrough
  14250. case int32(_BT_LF):
  14251. fallthrough
  14252. case int32(_BT_CR):
  14253. default:
  14254. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14255. return m_XML_TOK_INVALID
  14256. }
  14257. goto _18
  14258. _18:
  14259. ;
  14260. goto _19
  14261. goto _17
  14262. _17:
  14263. ;
  14264. /* fall through */
  14265. _14:
  14266. ;
  14267. hadColon = 0
  14268. for {
  14269. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14270. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14271. return -int32(1)
  14272. }
  14273. open = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  14274. if open == int32(_BT_QUOT) || open == int32(_BT_APOS) {
  14275. break
  14276. }
  14277. switch open {
  14278. case int32(_BT_S):
  14279. fallthrough
  14280. case int32(_BT_LF):
  14281. fallthrough
  14282. case int32(_BT_CR):
  14283. default:
  14284. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14285. return m_XML_TOK_INVALID
  14286. }
  14287. goto _20
  14288. _20:
  14289. }
  14290. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14291. /* in attribute value */
  14292. for {
  14293. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14294. return -int32(1)
  14295. }
  14296. t1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  14297. if t1 == open {
  14298. break
  14299. }
  14300. switch t1 {
  14301. case int32(_BT_LEAD2):
  14302. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(2) {
  14303. return -int32(2)
  14304. }
  14305. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  14306. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14307. return m_XML_TOK_INVALID
  14308. }
  14309. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  14310. case int32(_BT_LEAD3):
  14311. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(3) {
  14312. return -int32(2)
  14313. }
  14314. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  14315. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14316. return m_XML_TOK_INVALID
  14317. }
  14318. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  14319. case int32(_BT_LEAD4):
  14320. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(4) {
  14321. return -int32(2)
  14322. }
  14323. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  14324. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14325. return m_XML_TOK_INVALID
  14326. }
  14327. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  14328. case int32(_BT_NONXML):
  14329. fallthrough
  14330. case int32(_BT_MALFORM):
  14331. fallthrough
  14332. case int32(_BT_TRAIL):
  14333. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14334. return m_XML_TOK_INVALID
  14335. case int32(_BT_AMP):
  14336. tok = _normal_scanRef(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr(1), end, bp)
  14337. if tok <= 0 {
  14338. if tok == m_XML_TOK_INVALID {
  14339. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14340. }
  14341. return tok
  14342. }
  14343. case int32(_BT_LT):
  14344. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14345. return m_XML_TOK_INVALID
  14346. default:
  14347. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14348. break
  14349. }
  14350. goto _21
  14351. _21:
  14352. }
  14353. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14354. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14355. return -int32(1)
  14356. }
  14357. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))) {
  14358. case int32(_BT_S):
  14359. fallthrough
  14360. case int32(_BT_CR):
  14361. fallthrough
  14362. case int32(_BT_LF):
  14363. case int32(_BT_SOL):
  14364. goto sol
  14365. case int32(_BT_GT):
  14366. goto gt
  14367. default:
  14368. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14369. return m_XML_TOK_INVALID
  14370. }
  14371. /* ptr points to closing quote */
  14372. _24:
  14373. ;
  14374. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14375. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14376. return -int32(1)
  14377. }
  14378. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))) {
  14379. case int32(_BT_NONASCII):
  14380. goto _25
  14381. case int32(_BT_HEX):
  14382. goto _26
  14383. case int32(_BT_NMSTRT):
  14384. goto _27
  14385. case int32(_BT_LEAD2):
  14386. goto _28
  14387. case int32(_BT_LEAD3):
  14388. goto _29
  14389. case int32(_BT_LEAD4):
  14390. goto _30
  14391. case int32(_BT_LF):
  14392. goto _31
  14393. case int32(_BT_CR):
  14394. goto _32
  14395. case int32(_BT_S):
  14396. goto _33
  14397. case int32(_BT_GT):
  14398. goto _34
  14399. case int32(_BT_SOL):
  14400. goto _35
  14401. default:
  14402. goto _36
  14403. }
  14404. goto _37
  14405. _25:
  14406. ;
  14407. if !(libc.Int32FromInt32(0) != 0) {
  14408. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14409. return m_XML_TOK_INVALID
  14410. } /* fall through */
  14411. _27:
  14412. ;
  14413. _26:
  14414. ;
  14415. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14416. goto _37
  14417. _28:
  14418. ;
  14419. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(2) {
  14420. return -int32(2)
  14421. }
  14422. 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) {
  14423. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14424. return m_XML_TOK_INVALID
  14425. }
  14426. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  14427. goto _37
  14428. _29:
  14429. ;
  14430. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(3) {
  14431. return -int32(2)
  14432. }
  14433. 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) {
  14434. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14435. return m_XML_TOK_INVALID
  14436. }
  14437. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  14438. goto _37
  14439. _30:
  14440. ;
  14441. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(4) {
  14442. return -int32(2)
  14443. }
  14444. 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) {
  14445. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14446. return m_XML_TOK_INVALID
  14447. }
  14448. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  14449. goto _37
  14450. _33:
  14451. ;
  14452. _32:
  14453. ;
  14454. _31:
  14455. ;
  14456. goto _23
  14457. _34:
  14458. ;
  14459. goto gt
  14460. gt:
  14461. ;
  14462. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(1)
  14463. return int32(m_XML_TOK_START_TAG_WITH_ATTS)
  14464. _35:
  14465. ;
  14466. goto sol
  14467. sol:
  14468. ;
  14469. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14470. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14471. return -int32(1)
  14472. }
  14473. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  14474. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14475. return m_XML_TOK_INVALID
  14476. }
  14477. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(1)
  14478. return int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS)
  14479. _36:
  14480. ;
  14481. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14482. return m_XML_TOK_INVALID
  14483. _37:
  14484. ;
  14485. goto _22
  14486. goto _23
  14487. _23:
  14488. ;
  14489. goto _24
  14490. goto _22
  14491. _22:
  14492. ;
  14493. goto _16
  14494. _15:
  14495. ;
  14496. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14497. return m_XML_TOK_INVALID
  14498. _16:
  14499. }
  14500. return -int32(1)
  14501. }
  14502. /* ptr points to character following "<" */
  14503. func _normal_scanLt(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  14504. var hadColon int32
  14505. _ = hadColon
  14506. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14507. return -int32(1)
  14508. }
  14509. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  14510. case int32(_BT_NONASCII):
  14511. if !(libc.Int32FromInt32(0) != 0) {
  14512. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14513. return m_XML_TOK_INVALID
  14514. } /* fall through */
  14515. fallthrough
  14516. case int32(_BT_NMSTRT):
  14517. fallthrough
  14518. case int32(_BT_HEX):
  14519. ptr += uintptr(1)
  14520. case int32(_BT_LEAD2):
  14521. if int32(end)-int32(ptr) < int32(2) {
  14522. return -int32(2)
  14523. }
  14524. 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) {
  14525. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14526. return m_XML_TOK_INVALID
  14527. }
  14528. ptr += uintptr(2)
  14529. case int32(_BT_LEAD3):
  14530. if int32(end)-int32(ptr) < int32(3) {
  14531. return -int32(2)
  14532. }
  14533. 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) {
  14534. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14535. return m_XML_TOK_INVALID
  14536. }
  14537. ptr += uintptr(3)
  14538. case int32(_BT_LEAD4):
  14539. if int32(end)-int32(ptr) < int32(4) {
  14540. return -int32(2)
  14541. }
  14542. 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) {
  14543. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14544. return m_XML_TOK_INVALID
  14545. }
  14546. ptr += uintptr(4)
  14547. case int32(_BT_EXCL):
  14548. ptr += uintptr(1)
  14549. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14550. return -int32(1)
  14551. }
  14552. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  14553. case int32(_BT_MINUS):
  14554. return _normal_scanComment(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14555. case int32(_BT_LSQB):
  14556. return _normal_scanCdataSection(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14557. }
  14558. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14559. return m_XML_TOK_INVALID
  14560. case int32(_BT_QUEST):
  14561. return _normal_scanPi(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14562. case int32(_BT_SOL):
  14563. return _normal_scanEndTag(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14564. default:
  14565. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14566. return m_XML_TOK_INVALID
  14567. }
  14568. hadColon = 0
  14569. /* we have a start-tag */
  14570. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  14571. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  14572. case int32(_BT_NONASCII):
  14573. goto _1
  14574. case int32(_BT_MINUS):
  14575. goto _2
  14576. case int32(_BT_NAME):
  14577. goto _3
  14578. case int32(_BT_DIGIT):
  14579. goto _4
  14580. case int32(_BT_HEX):
  14581. goto _5
  14582. case int32(_BT_NMSTRT):
  14583. goto _6
  14584. case int32(_BT_LEAD2):
  14585. goto _7
  14586. case int32(_BT_LEAD3):
  14587. goto _8
  14588. case int32(_BT_LEAD4):
  14589. goto _9
  14590. case int32(_BT_COLON):
  14591. goto _10
  14592. case int32(_BT_LF):
  14593. goto _11
  14594. case int32(_BT_CR):
  14595. goto _12
  14596. case int32(_BT_S):
  14597. goto _13
  14598. case int32(_BT_GT):
  14599. goto _14
  14600. case int32(_BT_SOL):
  14601. goto _15
  14602. default:
  14603. goto _16
  14604. }
  14605. goto _17
  14606. _1:
  14607. ;
  14608. if !(libc.Int32FromInt32(0) != 0) {
  14609. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14610. return m_XML_TOK_INVALID
  14611. } /* fall through */
  14612. _6:
  14613. ;
  14614. _5:
  14615. ;
  14616. _4:
  14617. ;
  14618. _3:
  14619. ;
  14620. _2:
  14621. ;
  14622. ptr += uintptr(1)
  14623. goto _17
  14624. _7:
  14625. ;
  14626. if int32(end)-int32(ptr) < int32(2) {
  14627. return -int32(2)
  14628. }
  14629. 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) {
  14630. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14631. return m_XML_TOK_INVALID
  14632. }
  14633. ptr += uintptr(2)
  14634. goto _17
  14635. _8:
  14636. ;
  14637. if int32(end)-int32(ptr) < int32(3) {
  14638. return -int32(2)
  14639. }
  14640. 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) {
  14641. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14642. return m_XML_TOK_INVALID
  14643. }
  14644. ptr += uintptr(3)
  14645. goto _17
  14646. _9:
  14647. ;
  14648. if int32(end)-int32(ptr) < int32(4) {
  14649. return -int32(2)
  14650. }
  14651. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  14652. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14653. return m_XML_TOK_INVALID
  14654. }
  14655. ptr += uintptr(4)
  14656. goto _17
  14657. _10:
  14658. ;
  14659. if hadColon != 0 {
  14660. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14661. return m_XML_TOK_INVALID
  14662. }
  14663. hadColon = int32(1)
  14664. ptr += uintptr(1)
  14665. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14666. return -int32(1)
  14667. }
  14668. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  14669. case int32(_BT_NONASCII):
  14670. if !(libc.Int32FromInt32(0) != 0) {
  14671. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14672. return m_XML_TOK_INVALID
  14673. } /* fall through */
  14674. fallthrough
  14675. case int32(_BT_NMSTRT):
  14676. fallthrough
  14677. case int32(_BT_HEX):
  14678. ptr += uintptr(1)
  14679. case int32(_BT_LEAD2):
  14680. if int32(end)-int32(ptr) < int32(2) {
  14681. return -int32(2)
  14682. }
  14683. 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) {
  14684. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14685. return m_XML_TOK_INVALID
  14686. }
  14687. ptr += uintptr(2)
  14688. case int32(_BT_LEAD3):
  14689. if int32(end)-int32(ptr) < int32(3) {
  14690. return -int32(2)
  14691. }
  14692. 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) {
  14693. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14694. return m_XML_TOK_INVALID
  14695. }
  14696. ptr += uintptr(3)
  14697. case int32(_BT_LEAD4):
  14698. if int32(end)-int32(ptr) < int32(4) {
  14699. return -int32(2)
  14700. }
  14701. 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) {
  14702. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14703. return m_XML_TOK_INVALID
  14704. }
  14705. ptr += uintptr(4)
  14706. default:
  14707. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14708. return m_XML_TOK_INVALID
  14709. }
  14710. goto _17
  14711. _13:
  14712. ;
  14713. _12:
  14714. ;
  14715. _11:
  14716. ;
  14717. ptr += uintptr(1)
  14718. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  14719. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  14720. case int32(_BT_NONASCII):
  14721. if !(libc.Int32FromInt32(0) != 0) {
  14722. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14723. return m_XML_TOK_INVALID
  14724. } /* fall through */
  14725. fallthrough
  14726. case int32(_BT_NMSTRT):
  14727. fallthrough
  14728. case int32(_BT_HEX):
  14729. ptr += uintptr(1)
  14730. case int32(_BT_LEAD2):
  14731. if int32(end)-int32(ptr) < int32(2) {
  14732. return -int32(2)
  14733. }
  14734. 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) {
  14735. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14736. return m_XML_TOK_INVALID
  14737. }
  14738. ptr += uintptr(2)
  14739. case int32(_BT_LEAD3):
  14740. if int32(end)-int32(ptr) < int32(3) {
  14741. return -int32(2)
  14742. }
  14743. 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) {
  14744. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14745. return m_XML_TOK_INVALID
  14746. }
  14747. ptr += uintptr(3)
  14748. case int32(_BT_LEAD4):
  14749. if int32(end)-int32(ptr) < int32(4) {
  14750. return -int32(2)
  14751. }
  14752. 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) {
  14753. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14754. return m_XML_TOK_INVALID
  14755. }
  14756. ptr += uintptr(4)
  14757. case int32(_BT_GT):
  14758. goto gt
  14759. case int32(_BT_SOL):
  14760. goto sol
  14761. case int32(_BT_S):
  14762. fallthrough
  14763. case int32(_BT_CR):
  14764. fallthrough
  14765. case int32(_BT_LF):
  14766. ptr += uintptr(1)
  14767. continue
  14768. default:
  14769. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14770. return m_XML_TOK_INVALID
  14771. }
  14772. return _normal_scanAtts(tls, enc, ptr, end, nextTokPtr)
  14773. }
  14774. return -int32(1)
  14775. _14:
  14776. ;
  14777. goto gt
  14778. gt:
  14779. ;
  14780. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14781. return int32(m_XML_TOK_START_TAG_NO_ATTS)
  14782. _15:
  14783. ;
  14784. goto sol
  14785. sol:
  14786. ;
  14787. ptr += uintptr(1)
  14788. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14789. return -int32(1)
  14790. }
  14791. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  14792. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14793. return m_XML_TOK_INVALID
  14794. }
  14795. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14796. return int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS)
  14797. _16:
  14798. ;
  14799. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14800. return m_XML_TOK_INVALID
  14801. _17:
  14802. }
  14803. return -int32(1)
  14804. }
  14805. func _normal_contentTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  14806. var n Tsize_t
  14807. _ = n
  14808. if ptr >= end {
  14809. return -int32(4)
  14810. }
  14811. if int32(1) > int32(1) {
  14812. n = libc.Uint32FromInt32(int32(end) - int32(ptr))
  14813. if n&libc.Uint32FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  14814. n &= libc.Uint32FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  14815. if n == uint32(0) {
  14816. return -int32(1)
  14817. }
  14818. end = ptr + uintptr(n)
  14819. }
  14820. }
  14821. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  14822. case int32(_BT_LT):
  14823. return _normal_scanLt(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14824. case int32(_BT_AMP):
  14825. return _normal_scanRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14826. case int32(_BT_CR):
  14827. ptr += uintptr(1)
  14828. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14829. return -int32(3)
  14830. }
  14831. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) == int32(_BT_LF) {
  14832. ptr += uintptr(1)
  14833. }
  14834. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14835. return int32(m_XML_TOK_DATA_NEWLINE)
  14836. case int32(_BT_LF):
  14837. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14838. return int32(m_XML_TOK_DATA_NEWLINE)
  14839. case int32(_BT_RSQB):
  14840. ptr += uintptr(1)
  14841. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14842. return -int32(5)
  14843. }
  14844. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_RSQB1)) {
  14845. break
  14846. }
  14847. ptr += uintptr(1)
  14848. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14849. return -int32(5)
  14850. }
  14851. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  14852. ptr -= uintptr(1)
  14853. break
  14854. }
  14855. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14856. return m_XML_TOK_INVALID
  14857. case int32(_BT_LEAD2):
  14858. if int32(end)-int32(ptr) < int32(2) {
  14859. return -int32(2)
  14860. }
  14861. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  14862. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14863. return m_XML_TOK_INVALID
  14864. }
  14865. ptr += uintptr(2)
  14866. case int32(_BT_LEAD3):
  14867. if int32(end)-int32(ptr) < int32(3) {
  14868. return -int32(2)
  14869. }
  14870. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  14871. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14872. return m_XML_TOK_INVALID
  14873. }
  14874. ptr += uintptr(3)
  14875. case int32(_BT_LEAD4):
  14876. if int32(end)-int32(ptr) < int32(4) {
  14877. return -int32(2)
  14878. }
  14879. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  14880. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14881. return m_XML_TOK_INVALID
  14882. }
  14883. ptr += uintptr(4)
  14884. case int32(_BT_NONXML):
  14885. fallthrough
  14886. case int32(_BT_MALFORM):
  14887. fallthrough
  14888. case int32(_BT_TRAIL):
  14889. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14890. return m_XML_TOK_INVALID
  14891. default:
  14892. ptr += uintptr(1)
  14893. break
  14894. }
  14895. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  14896. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  14897. case int32(_BT_LEAD2):
  14898. if int32(end)-int32(ptr) < int32(2) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  14899. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14900. return int32(m_XML_TOK_DATA_CHARS)
  14901. }
  14902. ptr += uintptr(2)
  14903. case int32(_BT_LEAD3):
  14904. if int32(end)-int32(ptr) < int32(3) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  14905. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14906. return int32(m_XML_TOK_DATA_CHARS)
  14907. }
  14908. ptr += uintptr(3)
  14909. case int32(_BT_LEAD4):
  14910. if int32(end)-int32(ptr) < int32(4) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  14911. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14912. return int32(m_XML_TOK_DATA_CHARS)
  14913. }
  14914. ptr += uintptr(4)
  14915. case int32(_BT_RSQB):
  14916. if int32(end)-int32(ptr) >= libc.Int32FromInt32(2)*libc.Int32FromInt32(1) {
  14917. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == libc.Int32FromInt32(m_ASCII_RSQB1)) {
  14918. ptr += uintptr(1)
  14919. break
  14920. }
  14921. if int32(end)-int32(ptr) >= libc.Int32FromInt32(3)*libc.Int32FromInt32(1) {
  14922. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  14923. ptr += uintptr(1)
  14924. break
  14925. }
  14926. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))
  14927. return m_XML_TOK_INVALID
  14928. }
  14929. }
  14930. /* fall through */
  14931. fallthrough
  14932. case int32(_BT_AMP):
  14933. fallthrough
  14934. case int32(_BT_LT):
  14935. fallthrough
  14936. case int32(_BT_NONXML):
  14937. fallthrough
  14938. case int32(_BT_MALFORM):
  14939. fallthrough
  14940. case int32(_BT_TRAIL):
  14941. fallthrough
  14942. case int32(_BT_CR):
  14943. fallthrough
  14944. case int32(_BT_LF):
  14945. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14946. return int32(m_XML_TOK_DATA_CHARS)
  14947. default:
  14948. ptr += uintptr(1)
  14949. break
  14950. }
  14951. }
  14952. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14953. return int32(m_XML_TOK_DATA_CHARS)
  14954. }
  14955. /* ptr points to character following "%" */
  14956. func _normal_scanPercent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  14957. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14958. return -int32(1)
  14959. }
  14960. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  14961. case int32(_BT_NONASCII):
  14962. if !(libc.Int32FromInt32(0) != 0) {
  14963. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14964. return m_XML_TOK_INVALID
  14965. } /* fall through */
  14966. fallthrough
  14967. case int32(_BT_NMSTRT):
  14968. fallthrough
  14969. case int32(_BT_HEX):
  14970. ptr += uintptr(1)
  14971. case int32(_BT_LEAD2):
  14972. if int32(end)-int32(ptr) < int32(2) {
  14973. return -int32(2)
  14974. }
  14975. 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) {
  14976. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14977. return m_XML_TOK_INVALID
  14978. }
  14979. ptr += uintptr(2)
  14980. case int32(_BT_LEAD3):
  14981. if int32(end)-int32(ptr) < int32(3) {
  14982. return -int32(2)
  14983. }
  14984. 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) {
  14985. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14986. return m_XML_TOK_INVALID
  14987. }
  14988. ptr += uintptr(3)
  14989. case int32(_BT_LEAD4):
  14990. if int32(end)-int32(ptr) < int32(4) {
  14991. return -int32(2)
  14992. }
  14993. 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) {
  14994. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14995. return m_XML_TOK_INVALID
  14996. }
  14997. ptr += uintptr(4)
  14998. case int32(_BT_S):
  14999. fallthrough
  15000. case int32(_BT_LF):
  15001. fallthrough
  15002. case int32(_BT_CR):
  15003. fallthrough
  15004. case int32(_BT_PERCNT):
  15005. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15006. return int32(m_XML_TOK_PERCENT)
  15007. default:
  15008. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15009. return m_XML_TOK_INVALID
  15010. }
  15011. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  15012. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15013. case int32(_BT_NONASCII):
  15014. if !(libc.Int32FromInt32(0) != 0) {
  15015. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15016. return m_XML_TOK_INVALID
  15017. } /* fall through */
  15018. fallthrough
  15019. case int32(_BT_NMSTRT):
  15020. fallthrough
  15021. case int32(_BT_HEX):
  15022. fallthrough
  15023. case int32(_BT_DIGIT):
  15024. fallthrough
  15025. case int32(_BT_NAME):
  15026. fallthrough
  15027. case int32(_BT_MINUS):
  15028. ptr += uintptr(1)
  15029. case int32(_BT_LEAD2):
  15030. if int32(end)-int32(ptr) < int32(2) {
  15031. return -int32(2)
  15032. }
  15033. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  15034. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15035. return m_XML_TOK_INVALID
  15036. }
  15037. ptr += uintptr(2)
  15038. case int32(_BT_LEAD3):
  15039. if int32(end)-int32(ptr) < int32(3) {
  15040. return -int32(2)
  15041. }
  15042. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  15043. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15044. return m_XML_TOK_INVALID
  15045. }
  15046. ptr += uintptr(3)
  15047. case int32(_BT_LEAD4):
  15048. if int32(end)-int32(ptr) < int32(4) {
  15049. return -int32(2)
  15050. }
  15051. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  15052. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15053. return m_XML_TOK_INVALID
  15054. }
  15055. ptr += uintptr(4)
  15056. case int32(_BT_SEMI):
  15057. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15058. return int32(m_XML_TOK_PARAM_ENTITY_REF)
  15059. default:
  15060. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15061. return m_XML_TOK_INVALID
  15062. }
  15063. }
  15064. return -int32(1)
  15065. }
  15066. func _normal_scanPoundName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15067. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15068. return -int32(1)
  15069. }
  15070. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15071. case int32(_BT_NONASCII):
  15072. if !(libc.Int32FromInt32(0) != 0) {
  15073. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15074. return m_XML_TOK_INVALID
  15075. } /* fall through */
  15076. fallthrough
  15077. case int32(_BT_NMSTRT):
  15078. fallthrough
  15079. case int32(_BT_HEX):
  15080. ptr += uintptr(1)
  15081. case int32(_BT_LEAD2):
  15082. if int32(end)-int32(ptr) < int32(2) {
  15083. return -int32(2)
  15084. }
  15085. 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) {
  15086. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15087. return m_XML_TOK_INVALID
  15088. }
  15089. ptr += uintptr(2)
  15090. case int32(_BT_LEAD3):
  15091. if int32(end)-int32(ptr) < int32(3) {
  15092. return -int32(2)
  15093. }
  15094. 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) {
  15095. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15096. return m_XML_TOK_INVALID
  15097. }
  15098. ptr += uintptr(3)
  15099. case int32(_BT_LEAD4):
  15100. if int32(end)-int32(ptr) < int32(4) {
  15101. return -int32(2)
  15102. }
  15103. 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) {
  15104. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15105. return m_XML_TOK_INVALID
  15106. }
  15107. ptr += uintptr(4)
  15108. default:
  15109. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15110. return m_XML_TOK_INVALID
  15111. }
  15112. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  15113. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15114. case int32(_BT_NONASCII):
  15115. if !(libc.Int32FromInt32(0) != 0) {
  15116. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15117. return m_XML_TOK_INVALID
  15118. } /* fall through */
  15119. fallthrough
  15120. case int32(_BT_NMSTRT):
  15121. fallthrough
  15122. case int32(_BT_HEX):
  15123. fallthrough
  15124. case int32(_BT_DIGIT):
  15125. fallthrough
  15126. case int32(_BT_NAME):
  15127. fallthrough
  15128. case int32(_BT_MINUS):
  15129. ptr += uintptr(1)
  15130. case int32(_BT_LEAD2):
  15131. if int32(end)-int32(ptr) < int32(2) {
  15132. return -int32(2)
  15133. }
  15134. 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) {
  15135. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15136. return m_XML_TOK_INVALID
  15137. }
  15138. ptr += uintptr(2)
  15139. case int32(_BT_LEAD3):
  15140. if int32(end)-int32(ptr) < int32(3) {
  15141. return -int32(2)
  15142. }
  15143. 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) {
  15144. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15145. return m_XML_TOK_INVALID
  15146. }
  15147. ptr += uintptr(3)
  15148. case int32(_BT_LEAD4):
  15149. if int32(end)-int32(ptr) < int32(4) {
  15150. return -int32(2)
  15151. }
  15152. 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) {
  15153. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15154. return m_XML_TOK_INVALID
  15155. }
  15156. ptr += uintptr(4)
  15157. case int32(_BT_CR):
  15158. fallthrough
  15159. case int32(_BT_LF):
  15160. fallthrough
  15161. case int32(_BT_S):
  15162. fallthrough
  15163. case int32(_BT_RPAR):
  15164. fallthrough
  15165. case int32(_BT_GT):
  15166. fallthrough
  15167. case int32(_BT_PERCNT):
  15168. fallthrough
  15169. case int32(_BT_VERBAR):
  15170. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15171. return int32(m_XML_TOK_POUND_NAME)
  15172. default:
  15173. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15174. return m_XML_TOK_INVALID
  15175. }
  15176. }
  15177. return -int32(m_XML_TOK_POUND_NAME)
  15178. }
  15179. func _normal_scanLit(tls *libc.TLS, open int32, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15180. var t int32
  15181. _ = t
  15182. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  15183. t = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  15184. switch t {
  15185. case int32(_BT_LEAD2):
  15186. if int32(end)-int32(ptr) < int32(2) {
  15187. return -int32(2)
  15188. }
  15189. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  15190. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15191. return m_XML_TOK_INVALID
  15192. }
  15193. ptr += uintptr(2)
  15194. case int32(_BT_LEAD3):
  15195. if int32(end)-int32(ptr) < int32(3) {
  15196. return -int32(2)
  15197. }
  15198. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  15199. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15200. return m_XML_TOK_INVALID
  15201. }
  15202. ptr += uintptr(3)
  15203. case int32(_BT_LEAD4):
  15204. if int32(end)-int32(ptr) < int32(4) {
  15205. return -int32(2)
  15206. }
  15207. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  15208. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15209. return m_XML_TOK_INVALID
  15210. }
  15211. ptr += uintptr(4)
  15212. case int32(_BT_NONXML):
  15213. fallthrough
  15214. case int32(_BT_MALFORM):
  15215. fallthrough
  15216. case int32(_BT_TRAIL):
  15217. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15218. return m_XML_TOK_INVALID
  15219. case int32(_BT_QUOT):
  15220. fallthrough
  15221. case int32(_BT_APOS):
  15222. ptr += uintptr(1)
  15223. if t != open {
  15224. break
  15225. }
  15226. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15227. return -int32(m_XML_TOK_LITERAL)
  15228. }
  15229. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15230. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15231. case int32(_BT_S):
  15232. fallthrough
  15233. case int32(_BT_CR):
  15234. fallthrough
  15235. case int32(_BT_LF):
  15236. fallthrough
  15237. case int32(_BT_GT):
  15238. fallthrough
  15239. case int32(_BT_PERCNT):
  15240. fallthrough
  15241. case int32(_BT_LSQB):
  15242. return int32(m_XML_TOK_LITERAL)
  15243. default:
  15244. return m_XML_TOK_INVALID
  15245. }
  15246. fallthrough
  15247. default:
  15248. ptr += uintptr(1)
  15249. break
  15250. }
  15251. }
  15252. return -int32(1)
  15253. }
  15254. func _normal_prologTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15255. var n Tsize_t
  15256. var tok int32
  15257. _, _ = n, tok
  15258. if ptr >= end {
  15259. return -int32(4)
  15260. }
  15261. if int32(1) > int32(1) {
  15262. n = libc.Uint32FromInt32(int32(end) - int32(ptr))
  15263. if n&libc.Uint32FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  15264. n &= libc.Uint32FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  15265. if n == uint32(0) {
  15266. return -int32(1)
  15267. }
  15268. end = ptr + uintptr(n)
  15269. }
  15270. }
  15271. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15272. case int32(_BT_QUOT):
  15273. goto _1
  15274. case int32(_BT_APOS):
  15275. goto _2
  15276. case int32(_BT_LT):
  15277. goto _3
  15278. case int32(_BT_CR):
  15279. goto _4
  15280. case int32(_BT_LF):
  15281. goto _5
  15282. case int32(_BT_S):
  15283. goto _6
  15284. case int32(_BT_PERCNT):
  15285. goto _7
  15286. case int32(_BT_COMMA):
  15287. goto _8
  15288. case int32(_BT_LSQB):
  15289. goto _9
  15290. case int32(_BT_RSQB):
  15291. goto _10
  15292. case int32(_BT_LPAR):
  15293. goto _11
  15294. case int32(_BT_RPAR):
  15295. goto _12
  15296. case int32(_BT_VERBAR):
  15297. goto _13
  15298. case int32(_BT_GT):
  15299. goto _14
  15300. case int32(_BT_NUM):
  15301. goto _15
  15302. case int32(_BT_LEAD2):
  15303. goto _16
  15304. case int32(_BT_LEAD3):
  15305. goto _17
  15306. case int32(_BT_LEAD4):
  15307. goto _18
  15308. case int32(_BT_HEX):
  15309. goto _19
  15310. case int32(_BT_NMSTRT):
  15311. goto _20
  15312. case int32(_BT_COLON):
  15313. goto _21
  15314. case int32(_BT_MINUS):
  15315. goto _22
  15316. case int32(_BT_NAME):
  15317. goto _23
  15318. case int32(_BT_DIGIT):
  15319. goto _24
  15320. case int32(_BT_NONASCII):
  15321. goto _25
  15322. default:
  15323. goto _26
  15324. }
  15325. goto _27
  15326. _1:
  15327. ;
  15328. return _normal_scanLit(tls, int32(_BT_QUOT), enc, ptr+uintptr(1), end, nextTokPtr)
  15329. _2:
  15330. ;
  15331. return _normal_scanLit(tls, int32(_BT_APOS), enc, ptr+uintptr(1), end, nextTokPtr)
  15332. _3:
  15333. ;
  15334. ptr += uintptr(1)
  15335. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15336. return -int32(1)
  15337. }
  15338. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15339. case int32(_BT_EXCL):
  15340. return _normal_scanDecl(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15341. case int32(_BT_QUEST):
  15342. return _normal_scanPi(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15343. case int32(_BT_NMSTRT):
  15344. fallthrough
  15345. case int32(_BT_HEX):
  15346. fallthrough
  15347. case int32(_BT_NONASCII):
  15348. fallthrough
  15349. case int32(_BT_LEAD2):
  15350. fallthrough
  15351. case int32(_BT_LEAD3):
  15352. fallthrough
  15353. case int32(_BT_LEAD4):
  15354. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr - uintptr(1)
  15355. return int32(m_XML_TOK_INSTANCE_START)
  15356. }
  15357. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15358. return m_XML_TOK_INVALID
  15359. _4:
  15360. ;
  15361. if ptr+uintptr(1) == end {
  15362. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = end
  15363. /* indicate that this might be part of a CR/LF pair */
  15364. return -int32(m_XML_TOK_PROLOG_S)
  15365. }
  15366. /* fall through */
  15367. _6:
  15368. ;
  15369. _5:
  15370. ;
  15371. _30:
  15372. ;
  15373. ptr += uintptr(1)
  15374. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15375. goto _28
  15376. }
  15377. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15378. case int32(_BT_S):
  15379. fallthrough
  15380. case int32(_BT_LF):
  15381. case int32(_BT_CR):
  15382. /* don't split CR/LF pair */
  15383. if ptr+uintptr(1) != end {
  15384. break
  15385. }
  15386. /* fall through */
  15387. fallthrough
  15388. default:
  15389. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15390. return int32(m_XML_TOK_PROLOG_S)
  15391. }
  15392. goto _29
  15393. _29:
  15394. ;
  15395. goto _30
  15396. goto _28
  15397. _28:
  15398. ;
  15399. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15400. return int32(m_XML_TOK_PROLOG_S)
  15401. _7:
  15402. ;
  15403. return _normal_scanPercent(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15404. _8:
  15405. ;
  15406. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15407. return int32(m_XML_TOK_COMMA)
  15408. _9:
  15409. ;
  15410. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15411. return int32(m_XML_TOK_OPEN_BRACKET)
  15412. _10:
  15413. ;
  15414. ptr += uintptr(1)
  15415. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15416. return -int32(m_XML_TOK_CLOSE_BRACKET)
  15417. }
  15418. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  15419. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(2)*libc.Int32FromInt32(1)) {
  15420. return -int32(1)
  15421. }
  15422. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == int32(m_ASCII_GT1) {
  15423. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))
  15424. return int32(m_XML_TOK_COND_SECT_CLOSE)
  15425. }
  15426. }
  15427. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15428. return int32(m_XML_TOK_CLOSE_BRACKET)
  15429. _11:
  15430. ;
  15431. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15432. return int32(m_XML_TOK_OPEN_PAREN)
  15433. _12:
  15434. ;
  15435. ptr += uintptr(1)
  15436. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15437. return -int32(m_XML_TOK_CLOSE_PAREN)
  15438. }
  15439. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15440. case int32(_BT_AST):
  15441. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15442. return int32(m_XML_TOK_CLOSE_PAREN_ASTERISK)
  15443. case int32(_BT_QUEST):
  15444. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15445. return int32(m_XML_TOK_CLOSE_PAREN_QUESTION)
  15446. case int32(_BT_PLUS):
  15447. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15448. return int32(m_XML_TOK_CLOSE_PAREN_PLUS)
  15449. case int32(_BT_CR):
  15450. fallthrough
  15451. case int32(_BT_LF):
  15452. fallthrough
  15453. case int32(_BT_S):
  15454. fallthrough
  15455. case int32(_BT_GT):
  15456. fallthrough
  15457. case int32(_BT_COMMA):
  15458. fallthrough
  15459. case int32(_BT_VERBAR):
  15460. fallthrough
  15461. case int32(_BT_RPAR):
  15462. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15463. return int32(m_XML_TOK_CLOSE_PAREN)
  15464. }
  15465. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15466. return m_XML_TOK_INVALID
  15467. _13:
  15468. ;
  15469. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15470. return int32(m_XML_TOK_OR)
  15471. _14:
  15472. ;
  15473. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15474. return int32(m_XML_TOK_DECL_CLOSE)
  15475. _15:
  15476. ;
  15477. return _normal_scanPoundName(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15478. _16:
  15479. ;
  15480. if int32(end)-int32(ptr) < int32(2) {
  15481. return -int32(2)
  15482. }
  15483. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  15484. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15485. return m_XML_TOK_INVALID
  15486. }
  15487. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0 {
  15488. ptr += uintptr(2)
  15489. tok = int32(m_XML_TOK_NAME)
  15490. goto _27
  15491. }
  15492. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0 {
  15493. ptr += uintptr(2)
  15494. tok = int32(m_XML_TOK_NMTOKEN)
  15495. goto _27
  15496. }
  15497. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15498. return m_XML_TOK_INVALID
  15499. _17:
  15500. ;
  15501. if int32(end)-int32(ptr) < int32(3) {
  15502. return -int32(2)
  15503. }
  15504. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  15505. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15506. return m_XML_TOK_INVALID
  15507. }
  15508. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0 {
  15509. ptr += uintptr(3)
  15510. tok = int32(m_XML_TOK_NAME)
  15511. goto _27
  15512. }
  15513. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0 {
  15514. ptr += uintptr(3)
  15515. tok = int32(m_XML_TOK_NMTOKEN)
  15516. goto _27
  15517. }
  15518. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15519. return m_XML_TOK_INVALID
  15520. _18:
  15521. ;
  15522. if int32(end)-int32(ptr) < int32(4) {
  15523. return -int32(2)
  15524. }
  15525. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  15526. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15527. return m_XML_TOK_INVALID
  15528. }
  15529. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0 {
  15530. ptr += uintptr(4)
  15531. tok = int32(m_XML_TOK_NAME)
  15532. goto _27
  15533. }
  15534. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0 {
  15535. ptr += uintptr(4)
  15536. tok = int32(m_XML_TOK_NMTOKEN)
  15537. goto _27
  15538. }
  15539. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15540. return m_XML_TOK_INVALID
  15541. _20:
  15542. ;
  15543. _19:
  15544. ;
  15545. tok = int32(m_XML_TOK_NAME)
  15546. ptr += uintptr(1)
  15547. goto _27
  15548. _24:
  15549. ;
  15550. _23:
  15551. ;
  15552. _22:
  15553. ;
  15554. _21:
  15555. ;
  15556. tok = int32(m_XML_TOK_NMTOKEN)
  15557. ptr += uintptr(1)
  15558. goto _27
  15559. _25:
  15560. ;
  15561. if 0 != 0 {
  15562. ptr += uintptr(1)
  15563. tok = int32(m_XML_TOK_NAME)
  15564. goto _27
  15565. }
  15566. if 0 != 0 {
  15567. ptr += uintptr(1)
  15568. tok = int32(m_XML_TOK_NMTOKEN)
  15569. goto _27
  15570. }
  15571. /* fall through */
  15572. _26:
  15573. ;
  15574. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15575. return m_XML_TOK_INVALID
  15576. _27:
  15577. ;
  15578. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  15579. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15580. case int32(_BT_NONASCII):
  15581. if !(libc.Int32FromInt32(0) != 0) {
  15582. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15583. return m_XML_TOK_INVALID
  15584. } /* fall through */
  15585. fallthrough
  15586. case int32(_BT_NMSTRT):
  15587. fallthrough
  15588. case int32(_BT_HEX):
  15589. fallthrough
  15590. case int32(_BT_DIGIT):
  15591. fallthrough
  15592. case int32(_BT_NAME):
  15593. fallthrough
  15594. case int32(_BT_MINUS):
  15595. ptr += uintptr(1)
  15596. case int32(_BT_LEAD2):
  15597. if int32(end)-int32(ptr) < int32(2) {
  15598. return -int32(2)
  15599. }
  15600. 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) {
  15601. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15602. return m_XML_TOK_INVALID
  15603. }
  15604. ptr += uintptr(2)
  15605. case int32(_BT_LEAD3):
  15606. if int32(end)-int32(ptr) < int32(3) {
  15607. return -int32(2)
  15608. }
  15609. 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) {
  15610. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15611. return m_XML_TOK_INVALID
  15612. }
  15613. ptr += uintptr(3)
  15614. case int32(_BT_LEAD4):
  15615. if int32(end)-int32(ptr) < int32(4) {
  15616. return -int32(2)
  15617. }
  15618. 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) {
  15619. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15620. return m_XML_TOK_INVALID
  15621. }
  15622. ptr += uintptr(4)
  15623. case int32(_BT_GT):
  15624. fallthrough
  15625. case int32(_BT_RPAR):
  15626. fallthrough
  15627. case int32(_BT_COMMA):
  15628. fallthrough
  15629. case int32(_BT_VERBAR):
  15630. fallthrough
  15631. case int32(_BT_LSQB):
  15632. fallthrough
  15633. case int32(_BT_PERCNT):
  15634. fallthrough
  15635. case int32(_BT_S):
  15636. fallthrough
  15637. case int32(_BT_CR):
  15638. fallthrough
  15639. case int32(_BT_LF):
  15640. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15641. return tok
  15642. case int32(_BT_COLON):
  15643. ptr += uintptr(1)
  15644. switch tok {
  15645. case int32(m_XML_TOK_NAME):
  15646. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15647. return -int32(1)
  15648. }
  15649. tok = int32(m_XML_TOK_PREFIXED_NAME)
  15650. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15651. case int32(_BT_NONASCII):
  15652. if !(libc.Int32FromInt32(0) != 0) {
  15653. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15654. return m_XML_TOK_INVALID
  15655. } /* fall through */
  15656. fallthrough
  15657. case int32(_BT_NMSTRT):
  15658. fallthrough
  15659. case int32(_BT_HEX):
  15660. fallthrough
  15661. case int32(_BT_DIGIT):
  15662. fallthrough
  15663. case int32(_BT_NAME):
  15664. fallthrough
  15665. case int32(_BT_MINUS):
  15666. ptr += uintptr(1)
  15667. case int32(_BT_LEAD2):
  15668. if int32(end)-int32(ptr) < int32(2) {
  15669. return -int32(2)
  15670. }
  15671. 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) {
  15672. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15673. return m_XML_TOK_INVALID
  15674. }
  15675. ptr += uintptr(2)
  15676. case int32(_BT_LEAD3):
  15677. if int32(end)-int32(ptr) < int32(3) {
  15678. return -int32(2)
  15679. }
  15680. 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) {
  15681. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15682. return m_XML_TOK_INVALID
  15683. }
  15684. ptr += uintptr(3)
  15685. case int32(_BT_LEAD4):
  15686. if int32(end)-int32(ptr) < int32(4) {
  15687. return -int32(2)
  15688. }
  15689. 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) {
  15690. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15691. return m_XML_TOK_INVALID
  15692. }
  15693. ptr += uintptr(4)
  15694. default:
  15695. tok = int32(m_XML_TOK_NMTOKEN)
  15696. break
  15697. }
  15698. case int32(m_XML_TOK_PREFIXED_NAME):
  15699. tok = int32(m_XML_TOK_NMTOKEN)
  15700. break
  15701. }
  15702. case int32(_BT_PLUS):
  15703. if tok == int32(m_XML_TOK_NMTOKEN) {
  15704. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15705. return m_XML_TOK_INVALID
  15706. }
  15707. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15708. return int32(m_XML_TOK_NAME_PLUS)
  15709. case int32(_BT_AST):
  15710. if tok == int32(m_XML_TOK_NMTOKEN) {
  15711. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15712. return m_XML_TOK_INVALID
  15713. }
  15714. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15715. return int32(m_XML_TOK_NAME_ASTERISK)
  15716. case int32(_BT_QUEST):
  15717. if tok == int32(m_XML_TOK_NMTOKEN) {
  15718. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15719. return m_XML_TOK_INVALID
  15720. }
  15721. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15722. return int32(m_XML_TOK_NAME_QUESTION)
  15723. default:
  15724. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15725. return m_XML_TOK_INVALID
  15726. }
  15727. }
  15728. return -tok
  15729. }
  15730. func _normal_attributeValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15731. var start uintptr
  15732. _ = start
  15733. if ptr >= end {
  15734. return -int32(4)
  15735. } else {
  15736. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15737. /* This line cannot be executed. The incoming data has already
  15738. * been tokenized once, so incomplete characters like this have
  15739. * already been eliminated from the input. Retaining the paranoia
  15740. * check is still valuable, however.
  15741. */
  15742. return -int32(1) /* LCOV_EXCL_LINE */
  15743. }
  15744. }
  15745. start = ptr
  15746. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  15747. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15748. case int32(_BT_LEAD2):
  15749. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  15750. case int32(_BT_LEAD3):
  15751. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  15752. case int32(_BT_LEAD4):
  15753. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  15754. case int32(_BT_AMP):
  15755. if ptr == start {
  15756. return _normal_scanRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15757. }
  15758. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15759. return int32(m_XML_TOK_DATA_CHARS)
  15760. case int32(_BT_LT):
  15761. /* this is for inside entity references */
  15762. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15763. return m_XML_TOK_INVALID
  15764. case int32(_BT_LF):
  15765. if ptr == start {
  15766. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15767. return int32(m_XML_TOK_DATA_NEWLINE)
  15768. }
  15769. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15770. return int32(m_XML_TOK_DATA_CHARS)
  15771. case int32(_BT_CR):
  15772. if ptr == start {
  15773. ptr += uintptr(1)
  15774. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15775. return -int32(3)
  15776. }
  15777. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) == int32(_BT_LF) {
  15778. ptr += uintptr(1)
  15779. }
  15780. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15781. return int32(m_XML_TOK_DATA_NEWLINE)
  15782. }
  15783. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15784. return int32(m_XML_TOK_DATA_CHARS)
  15785. case int32(_BT_S):
  15786. if ptr == start {
  15787. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15788. return int32(m_XML_TOK_ATTRIBUTE_VALUE_S)
  15789. }
  15790. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15791. return int32(m_XML_TOK_DATA_CHARS)
  15792. default:
  15793. ptr += uintptr(1)
  15794. break
  15795. }
  15796. }
  15797. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15798. return int32(m_XML_TOK_DATA_CHARS)
  15799. }
  15800. func _normal_entityValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15801. var start uintptr
  15802. var tok, v1 int32
  15803. _, _, _ = start, tok, v1
  15804. if ptr >= end {
  15805. return -int32(4)
  15806. } else {
  15807. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15808. /* This line cannot be executed. The incoming data has already
  15809. * been tokenized once, so incomplete characters like this have
  15810. * already been eliminated from the input. Retaining the paranoia
  15811. * check is still valuable, however.
  15812. */
  15813. return -int32(1) /* LCOV_EXCL_LINE */
  15814. }
  15815. }
  15816. start = ptr
  15817. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  15818. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15819. case int32(_BT_LEAD2):
  15820. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  15821. case int32(_BT_LEAD3):
  15822. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  15823. case int32(_BT_LEAD4):
  15824. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  15825. case int32(_BT_AMP):
  15826. if ptr == start {
  15827. return _normal_scanRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15828. }
  15829. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15830. return int32(m_XML_TOK_DATA_CHARS)
  15831. case int32(_BT_PERCNT):
  15832. if ptr == start {
  15833. tok = _normal_scanPercent(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15834. if tok == int32(m_XML_TOK_PERCENT) {
  15835. v1 = m_XML_TOK_INVALID
  15836. } else {
  15837. v1 = tok
  15838. }
  15839. return v1
  15840. }
  15841. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15842. return int32(m_XML_TOK_DATA_CHARS)
  15843. case int32(_BT_LF):
  15844. if ptr == start {
  15845. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15846. return int32(m_XML_TOK_DATA_NEWLINE)
  15847. }
  15848. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15849. return int32(m_XML_TOK_DATA_CHARS)
  15850. case int32(_BT_CR):
  15851. if ptr == start {
  15852. ptr += uintptr(1)
  15853. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15854. return -int32(3)
  15855. }
  15856. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) == int32(_BT_LF) {
  15857. ptr += uintptr(1)
  15858. }
  15859. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15860. return int32(m_XML_TOK_DATA_NEWLINE)
  15861. }
  15862. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15863. return int32(m_XML_TOK_DATA_CHARS)
  15864. default:
  15865. ptr += uintptr(1)
  15866. break
  15867. }
  15868. }
  15869. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15870. return int32(m_XML_TOK_DATA_CHARS)
  15871. }
  15872. func _normal_ignoreSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15873. var level int32
  15874. var n Tsize_t
  15875. _, _ = level, n
  15876. level = 0
  15877. if int32(1) > int32(1) {
  15878. n = libc.Uint32FromInt32(int32(end) - int32(ptr))
  15879. if n&libc.Uint32FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  15880. n &= libc.Uint32FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  15881. end = ptr + uintptr(n)
  15882. }
  15883. }
  15884. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  15885. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15886. case int32(_BT_LEAD2):
  15887. if int32(end)-int32(ptr) < int32(2) {
  15888. return -int32(2)
  15889. }
  15890. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  15891. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15892. return m_XML_TOK_INVALID
  15893. }
  15894. ptr += uintptr(2)
  15895. case int32(_BT_LEAD3):
  15896. if int32(end)-int32(ptr) < int32(3) {
  15897. return -int32(2)
  15898. }
  15899. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  15900. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15901. return m_XML_TOK_INVALID
  15902. }
  15903. ptr += uintptr(3)
  15904. case int32(_BT_LEAD4):
  15905. if int32(end)-int32(ptr) < int32(4) {
  15906. return -int32(2)
  15907. }
  15908. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  15909. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15910. return m_XML_TOK_INVALID
  15911. }
  15912. ptr += uintptr(4)
  15913. case int32(_BT_NONXML):
  15914. fallthrough
  15915. case int32(_BT_MALFORM):
  15916. fallthrough
  15917. case int32(_BT_TRAIL):
  15918. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15919. return m_XML_TOK_INVALID
  15920. case int32(_BT_LT):
  15921. ptr += uintptr(1)
  15922. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15923. return -int32(1)
  15924. }
  15925. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_EXCL2) {
  15926. ptr += uintptr(1)
  15927. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15928. return -int32(1)
  15929. }
  15930. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_LSQB1) {
  15931. level++
  15932. ptr += uintptr(1)
  15933. }
  15934. }
  15935. case int32(_BT_RSQB):
  15936. ptr += uintptr(1)
  15937. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15938. return -int32(1)
  15939. }
  15940. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  15941. ptr += uintptr(1)
  15942. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15943. return -int32(1)
  15944. }
  15945. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  15946. ptr += uintptr(1)
  15947. if level == 0 {
  15948. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15949. return int32(m_XML_TOK_IGNORE_SECT)
  15950. }
  15951. level--
  15952. }
  15953. }
  15954. default:
  15955. ptr += uintptr(1)
  15956. break
  15957. }
  15958. }
  15959. return -int32(1)
  15960. }
  15961. func _normal_isPublicId(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr) (r int32) {
  15962. ptr += uintptr(1)
  15963. end -= uintptr(1)
  15964. for {
  15965. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15966. break
  15967. }
  15968. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15969. case int32(_BT_DIGIT):
  15970. fallthrough
  15971. case int32(_BT_HEX):
  15972. fallthrough
  15973. case int32(_BT_MINUS):
  15974. fallthrough
  15975. case int32(_BT_APOS):
  15976. fallthrough
  15977. case int32(_BT_LPAR):
  15978. fallthrough
  15979. case int32(_BT_RPAR):
  15980. fallthrough
  15981. case int32(_BT_PLUS):
  15982. fallthrough
  15983. case int32(_BT_COMMA):
  15984. fallthrough
  15985. case int32(_BT_SOL):
  15986. fallthrough
  15987. case int32(_BT_EQUALS):
  15988. fallthrough
  15989. case int32(_BT_QUEST):
  15990. fallthrough
  15991. case int32(_BT_CR):
  15992. fallthrough
  15993. case int32(_BT_LF):
  15994. fallthrough
  15995. case int32(_BT_SEMI):
  15996. fallthrough
  15997. case int32(_BT_EXCL):
  15998. fallthrough
  15999. case int32(_BT_AST):
  16000. fallthrough
  16001. case int32(_BT_PERCNT):
  16002. fallthrough
  16003. case int32(_BT_NUM):
  16004. fallthrough
  16005. case int32(_BT_COLON):
  16006. case int32(_BT_S):
  16007. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_TAB1) {
  16008. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  16009. return 0
  16010. }
  16011. case int32(_BT_NAME):
  16012. fallthrough
  16013. case int32(_BT_NMSTRT):
  16014. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) & ^libc.Int32FromInt32(0x7f) != 0) {
  16015. break
  16016. }
  16017. /* fall through */
  16018. fallthrough
  16019. default:
  16020. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  16021. case int32(0x24): /* $ */
  16022. fallthrough
  16023. case int32(0x40): /* @ */
  16024. default:
  16025. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  16026. return 0
  16027. }
  16028. break
  16029. }
  16030. goto _1
  16031. _1:
  16032. ;
  16033. ptr += uintptr(1)
  16034. }
  16035. return int32(1)
  16036. }
  16037. /* This must only be called for a well-formed start-tag or empty
  16038. element tag. Returns the number of attributes. Pointers to the
  16039. first attsMax attributes are stored in atts.
  16040. */
  16041. func _normal_getAtts(tls *libc.TLS, enc uintptr, ptr uintptr, attsMax int32, atts uintptr) (r int32) {
  16042. var nAtts, open, state int32
  16043. _, _, _ = nAtts, open, state
  16044. state = 1
  16045. nAtts = 0
  16046. open = 0 /* defined when state == inValue;
  16047. initialization just to shut up compilers */
  16048. ptr += uintptr(1)
  16049. for {
  16050. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  16051. case int32(_BT_LEAD2):
  16052. if state == 0 {
  16053. if nAtts < attsMax {
  16054. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fname = ptr
  16055. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = uint8(1)
  16056. }
  16057. state = 1
  16058. }
  16059. ptr += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(1))
  16060. case int32(_BT_LEAD3):
  16061. if state == 0 {
  16062. if nAtts < attsMax {
  16063. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fname = ptr
  16064. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = uint8(1)
  16065. }
  16066. state = 1
  16067. }
  16068. ptr += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(1))
  16069. case int32(_BT_LEAD4):
  16070. if state == 0 {
  16071. if nAtts < attsMax {
  16072. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fname = ptr
  16073. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = uint8(1)
  16074. }
  16075. state = 1
  16076. }
  16077. ptr += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(1))
  16078. case int32(_BT_NONASCII):
  16079. fallthrough
  16080. case int32(_BT_NMSTRT):
  16081. fallthrough
  16082. case int32(_BT_HEX):
  16083. if state == 0 {
  16084. if nAtts < attsMax {
  16085. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fname = ptr
  16086. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = uint8(1)
  16087. }
  16088. state = 1
  16089. }
  16090. case int32(_BT_QUOT):
  16091. if state != 2 {
  16092. if nAtts < attsMax {
  16093. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).FvaluePtr = ptr + uintptr(1)
  16094. }
  16095. state = 2
  16096. open = int32(_BT_QUOT)
  16097. } else {
  16098. if open == int32(_BT_QUOT) {
  16099. state = 0
  16100. if nAtts < attsMax {
  16101. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).FvalueEnd = ptr
  16102. }
  16103. nAtts++
  16104. }
  16105. }
  16106. case int32(_BT_APOS):
  16107. if state != 2 {
  16108. if nAtts < attsMax {
  16109. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).FvaluePtr = ptr + uintptr(1)
  16110. }
  16111. state = 2
  16112. open = int32(_BT_APOS)
  16113. } else {
  16114. if open == int32(_BT_APOS) {
  16115. state = 0
  16116. if nAtts < attsMax {
  16117. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).FvalueEnd = ptr
  16118. }
  16119. nAtts++
  16120. }
  16121. }
  16122. case int32(_BT_AMP):
  16123. if nAtts < attsMax {
  16124. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = uint8(0)
  16125. }
  16126. case int32(_BT_S):
  16127. if state == 1 {
  16128. state = 0
  16129. } else {
  16130. if state == 2 && nAtts < attsMax && (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized != 0 && (ptr == (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).FvaluePtr || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) != int32(m_ASCII_SPACE1) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == int32(m_ASCII_SPACE1) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1))))))) == open) {
  16131. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = uint8(0)
  16132. }
  16133. }
  16134. case int32(_BT_CR):
  16135. fallthrough
  16136. case int32(_BT_LF):
  16137. /* This case ensures that the first attribute name is counted
  16138. Apart from that we could just change state on the quote. */
  16139. if state == 1 {
  16140. state = 0
  16141. } else {
  16142. if state == 2 && nAtts < attsMax {
  16143. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = uint8(0)
  16144. }
  16145. }
  16146. case int32(_BT_GT):
  16147. fallthrough
  16148. case int32(_BT_SOL):
  16149. if state != 2 {
  16150. return nAtts
  16151. }
  16152. default:
  16153. break
  16154. }
  16155. goto _1
  16156. _1:
  16157. ;
  16158. ptr += uintptr(1)
  16159. }
  16160. /* not reached */
  16161. return r
  16162. }
  16163. func _normal_charRefNumber(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  16164. var c, c1, result int32
  16165. _, _, _ = c, c1, result
  16166. result = 0
  16167. /* skip &# */
  16168. _ = enc
  16169. ptr += uintptr(libc.Int32FromInt32(2) * libc.Int32FromInt32(1))
  16170. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  16171. ptr += uintptr(1)
  16172. for {
  16173. if !!(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_SEMI1)) {
  16174. break
  16175. }
  16176. c = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  16177. switch c {
  16178. case int32(m_ASCII_02):
  16179. fallthrough
  16180. case int32(m_ASCII_12):
  16181. fallthrough
  16182. case int32(m_ASCII_22):
  16183. fallthrough
  16184. case int32(m_ASCII_32):
  16185. fallthrough
  16186. case int32(m_ASCII_41):
  16187. fallthrough
  16188. case int32(m_ASCII_51):
  16189. fallthrough
  16190. case int32(m_ASCII_61):
  16191. fallthrough
  16192. case int32(m_ASCII_71):
  16193. fallthrough
  16194. case int32(m_ASCII_82):
  16195. fallthrough
  16196. case int32(m_ASCII_92):
  16197. result <<= int32(4)
  16198. result |= c - int32(m_ASCII_02)
  16199. case int32(m_ASCII_A):
  16200. fallthrough
  16201. case int32(m_ASCII_B1):
  16202. fallthrough
  16203. case int32(m_ASCII_C):
  16204. fallthrough
  16205. case int32(m_ASCII_D):
  16206. fallthrough
  16207. case int32(m_ASCII_E):
  16208. fallthrough
  16209. case int32(m_ASCII_F):
  16210. result <<= int32(4)
  16211. result += int32(10) + (c - int32(m_ASCII_A))
  16212. case int32(m_ASCII_a2):
  16213. fallthrough
  16214. case int32(m_ASCII_b1):
  16215. fallthrough
  16216. case int32(m_ASCII_c2):
  16217. fallthrough
  16218. case int32(m_ASCII_d1):
  16219. fallthrough
  16220. case int32(m_ASCII_e2):
  16221. fallthrough
  16222. case int32(m_ASCII_f1):
  16223. result <<= int32(4)
  16224. result += int32(10) + (c - int32(m_ASCII_a2))
  16225. break
  16226. }
  16227. if result >= int32(0x110000) {
  16228. return -int32(1)
  16229. }
  16230. goto _1
  16231. _1:
  16232. ;
  16233. ptr += uintptr(1)
  16234. }
  16235. } else {
  16236. for {
  16237. if !!(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_SEMI1)) {
  16238. break
  16239. }
  16240. c1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  16241. result *= int32(10)
  16242. result += c1 - int32(m_ASCII_02)
  16243. if result >= int32(0x110000) {
  16244. return -int32(1)
  16245. }
  16246. goto _2
  16247. _2:
  16248. ;
  16249. ptr += uintptr(1)
  16250. }
  16251. }
  16252. return _checkCharRefNumber(tls, result)
  16253. }
  16254. func _normal_predefinedEntityName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr) (r int32) {
  16255. _ = enc
  16256. switch (int32(end) - int32(ptr)) / libc.Int32FromInt32(1) {
  16257. case int32(2):
  16258. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == int32(m_ASCII_t2) {
  16259. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  16260. case int32(m_ASCII_l2):
  16261. return int32(m_ASCII_LT1)
  16262. case int32(m_ASCII_g2):
  16263. return int32(m_ASCII_GT1)
  16264. }
  16265. }
  16266. case int32(3):
  16267. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_a2) {
  16268. ptr += uintptr(1)
  16269. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_m2) {
  16270. ptr += uintptr(1)
  16271. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  16272. return int32(m_ASCII_AMP1)
  16273. }
  16274. }
  16275. }
  16276. case int32(4):
  16277. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  16278. case int32(m_ASCII_q1):
  16279. ptr += uintptr(1)
  16280. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_u1) {
  16281. ptr += uintptr(1)
  16282. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  16283. ptr += uintptr(1)
  16284. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_t2) {
  16285. return int32(m_ASCII_QUOT1)
  16286. }
  16287. }
  16288. }
  16289. case int32(m_ASCII_a2):
  16290. ptr += uintptr(1)
  16291. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  16292. ptr += uintptr(1)
  16293. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  16294. ptr += uintptr(1)
  16295. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_s2) {
  16296. return int32(m_ASCII_APOS1)
  16297. }
  16298. }
  16299. }
  16300. break
  16301. }
  16302. }
  16303. return 0
  16304. }
  16305. func _normal_nameMatchesAscii(tls *libc.TLS, enc uintptr, ptr1 uintptr, end1 uintptr, ptr2 uintptr) (r int32) {
  16306. _ = enc
  16307. for {
  16308. if !(*(*uint8)(unsafe.Pointer(ptr2)) != 0) {
  16309. break
  16310. }
  16311. if int32(end1)-int32(ptr1) < int32(1) {
  16312. /* This line cannot be executed. The incoming data has already
  16313. * been tokenized once, so incomplete characters like this have
  16314. * already been eliminated from the input. Retaining the
  16315. * paranoia check is still valuable, however.
  16316. */
  16317. return 0 /* LCOV_EXCL_LINE */
  16318. }
  16319. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr1))) == libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr2)))) {
  16320. return 0
  16321. }
  16322. goto _1
  16323. _1:
  16324. ;
  16325. ptr1 += uintptr(1)
  16326. ptr2++
  16327. }
  16328. return libc.BoolInt32(ptr1 == end1)
  16329. }
  16330. func _normal_nameLength(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  16331. var start uintptr
  16332. _ = start
  16333. start = ptr
  16334. for {
  16335. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  16336. case int32(_BT_LEAD2):
  16337. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  16338. case int32(_BT_LEAD3):
  16339. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  16340. case int32(_BT_LEAD4):
  16341. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  16342. case int32(_BT_NONASCII):
  16343. fallthrough
  16344. case int32(_BT_NMSTRT):
  16345. fallthrough
  16346. case int32(_BT_COLON):
  16347. fallthrough
  16348. case int32(_BT_HEX):
  16349. fallthrough
  16350. case int32(_BT_DIGIT):
  16351. fallthrough
  16352. case int32(_BT_NAME):
  16353. fallthrough
  16354. case int32(_BT_MINUS):
  16355. ptr += uintptr(1)
  16356. default:
  16357. return int32(ptr) - int32(start)
  16358. }
  16359. goto _1
  16360. _1:
  16361. }
  16362. return r
  16363. }
  16364. func _normal_skipS(tls *libc.TLS, enc uintptr, ptr uintptr) (r uintptr) {
  16365. for {
  16366. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  16367. case int32(_BT_LF):
  16368. fallthrough
  16369. case int32(_BT_CR):
  16370. fallthrough
  16371. case int32(_BT_S):
  16372. ptr += uintptr(1)
  16373. default:
  16374. return ptr
  16375. }
  16376. goto _1
  16377. _1:
  16378. }
  16379. return r
  16380. }
  16381. func _normal_updatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  16382. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  16383. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  16384. case int32(_BT_LEAD2):
  16385. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  16386. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  16387. case int32(_BT_LEAD3):
  16388. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  16389. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  16390. case int32(_BT_LEAD4):
  16391. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  16392. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  16393. case int32(_BT_LF):
  16394. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint32(0)
  16395. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  16396. ptr += uintptr(1)
  16397. case int32(_BT_CR):
  16398. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  16399. ptr += uintptr(1)
  16400. if int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) == int32(_BT_LF) {
  16401. ptr += uintptr(1)
  16402. }
  16403. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint32(0)
  16404. default:
  16405. ptr += uintptr(1)
  16406. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  16407. break
  16408. }
  16409. }
  16410. }
  16411. const /* UTF8_cvalN is value of masked first byte of N byte sequence */
  16412. _UTF8_cval1 = 0
  16413. const _UTF8_cval2 = 192
  16414. const _UTF8_cval3 = 224
  16415. const _UTF8_cval4 = 240
  16416. func X_INTERNAL_trim_to_complete_utf8_characters(tls *libc.TLS, from uintptr, fromLimRef uintptr) {
  16417. var fromLim uintptr
  16418. var prev uint8
  16419. var walked Tsize_t
  16420. _, _, _ = fromLim, prev, walked
  16421. fromLim = *(*uintptr)(unsafe.Pointer(fromLimRef))
  16422. walked = uint32(0)
  16423. for {
  16424. if !(fromLim > from) {
  16425. break
  16426. }
  16427. prev = *(*uint8)(unsafe.Pointer(fromLim + uintptr(-libc.Int32FromInt32(1))))
  16428. if uint32(prev)&uint32(0xf8) == uint32(0xf0) { /* 4-byte character, lead by 0b11110xxx byte */
  16429. if walked+uint32(1) >= uint32(4) {
  16430. fromLim += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(1))
  16431. break
  16432. } else {
  16433. walked = uint32(0)
  16434. }
  16435. } else {
  16436. if uint32(prev)&uint32(0xf0) == uint32(0xe0) { /* 3-byte character, lead by 0b1110xxxx byte */
  16437. if walked+uint32(1) >= uint32(3) {
  16438. fromLim += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(1))
  16439. break
  16440. } else {
  16441. walked = uint32(0)
  16442. }
  16443. } else {
  16444. if uint32(prev)&uint32(0xe0) == uint32(0xc0) { /* 2-byte character, lead by 0b110xxxxx byte */
  16445. if walked+uint32(1) >= uint32(2) {
  16446. fromLim += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(1))
  16447. break
  16448. } else {
  16449. walked = uint32(0)
  16450. }
  16451. } else {
  16452. if uint32(prev)&uint32(0x80) == 0x00 { /* 1-byte character, matching 0b0xxxxxxx */
  16453. break
  16454. }
  16455. }
  16456. }
  16457. }
  16458. goto _1
  16459. _1:
  16460. ;
  16461. fromLim--
  16462. walked++
  16463. }
  16464. *(*uintptr)(unsafe.Pointer(fromLimRef)) = fromLim
  16465. }
  16466. func _utf8_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, _fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  16467. bp := tls.Alloc(16)
  16468. defer tls.Free(16)
  16469. *(*uintptr)(unsafe.Pointer(bp)) = _fromLim
  16470. var bytesAvailable, bytesStorable, bytesToCopy Tptrdiff_t
  16471. var fromLimBefore uintptr
  16472. var input_incomplete, output_exhausted uint8
  16473. _, _, _, _, _, _ = bytesAvailable, bytesStorable, bytesToCopy, fromLimBefore, input_incomplete, output_exhausted
  16474. input_incomplete = uint8(m_false)
  16475. output_exhausted = uint8(m_false)
  16476. /* Avoid copying partial characters (due to limited space). */
  16477. bytesAvailable = int32(*(*uintptr)(unsafe.Pointer(bp))) - int32(*(*uintptr)(unsafe.Pointer(fromP)))
  16478. bytesStorable = int32(toLim) - int32(*(*uintptr)(unsafe.Pointer(toP)))
  16479. _ = enc
  16480. if bytesAvailable > bytesStorable {
  16481. *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(fromP)) + uintptr(bytesStorable)
  16482. output_exhausted = uint8(m_true)
  16483. }
  16484. /* Avoid copying partial characters (from incomplete input). */
  16485. fromLimBefore = *(*uintptr)(unsafe.Pointer(bp))
  16486. X_INTERNAL_trim_to_complete_utf8_characters(tls, *(*uintptr)(unsafe.Pointer(fromP)), bp)
  16487. if *(*uintptr)(unsafe.Pointer(bp)) < fromLimBefore {
  16488. input_incomplete = uint8(m_true)
  16489. }
  16490. bytesToCopy = int32(*(*uintptr)(unsafe.Pointer(bp))) - int32(*(*uintptr)(unsafe.Pointer(fromP)))
  16491. libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(toP)), *(*uintptr)(unsafe.Pointer(fromP)), libc.Uint32FromInt32(bytesToCopy))
  16492. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(bytesToCopy)
  16493. *(*uintptr)(unsafe.Pointer(toP)) += uintptr(bytesToCopy)
  16494. if output_exhausted != 0 { /* needs to go first */
  16495. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  16496. } else {
  16497. if input_incomplete != 0 {
  16498. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16499. } else {
  16500. return int32(_XML_CONVERT_COMPLETED)
  16501. }
  16502. }
  16503. return r
  16504. }
  16505. func _utf8_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  16506. var from, to, v1, v2, v3, v4 uintptr
  16507. var n uint32
  16508. var res _XML_Convert_Result
  16509. _, _, _, _, _, _, _, _ = from, n, res, to, v1, v2, v3, v4
  16510. res = int32(_XML_CONVERT_COMPLETED)
  16511. to = *(*uintptr)(unsafe.Pointer(toP))
  16512. from = *(*uintptr)(unsafe.Pointer(fromP))
  16513. for from < fromLim && to < toLim {
  16514. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(from)))))) {
  16515. case int32(_BT_LEAD2):
  16516. if int32(fromLim)-int32(from) < int32(2) {
  16517. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16518. goto after
  16519. }
  16520. v1 = to
  16521. to += 2
  16522. *(*uint16)(unsafe.Pointer(v1)) = libc.Uint16FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from)))&libc.Int32FromInt32(0x1f)<<libc.Int32FromInt32(6) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from + 1)))&libc.Int32FromInt32(0x3f))
  16523. from += uintptr(2)
  16524. case int32(_BT_LEAD3):
  16525. if int32(fromLim)-int32(from) < int32(3) {
  16526. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16527. goto after
  16528. }
  16529. v2 = to
  16530. to += 2
  16531. *(*uint16)(unsafe.Pointer(v2)) = libc.Uint16FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from)))&libc.Int32FromInt32(0xf)<<libc.Int32FromInt32(12) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from + 1)))&libc.Int32FromInt32(0x3f)<<libc.Int32FromInt32(6) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from + 2)))&libc.Int32FromInt32(0x3f))
  16532. from += uintptr(3)
  16533. case int32(_BT_LEAD4):
  16534. if (int32(toLim)-int32(to))/2 < int32(2) {
  16535. res = int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  16536. goto after
  16537. }
  16538. if int32(fromLim)-int32(from) < int32(4) {
  16539. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16540. goto after
  16541. }
  16542. n = libc.Uint32FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from)))&int32(0x7)<<int32(18) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from + 1)))&int32(0x3f)<<int32(12) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from + 2)))&int32(0x3f)<<int32(6) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from + 3)))&int32(0x3f))
  16543. n -= uint32(0x10000)
  16544. *(*uint16)(unsafe.Pointer(to)) = uint16(n>>libc.Int32FromInt32(10) | libc.Uint32FromInt32(0xD800))
  16545. *(*uint16)(unsafe.Pointer(to + 1*2)) = uint16(n&libc.Uint32FromInt32(0x3FF) | libc.Uint32FromInt32(0xDC00))
  16546. to += uintptr(2) * 2
  16547. from += uintptr(4)
  16548. default:
  16549. v3 = to
  16550. to += 2
  16551. v4 = from
  16552. from++
  16553. *(*uint16)(unsafe.Pointer(v3)) = uint16(*(*uint8)(unsafe.Pointer(v4)))
  16554. break
  16555. }
  16556. }
  16557. if from < fromLim {
  16558. res = int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  16559. }
  16560. goto after
  16561. after:
  16562. ;
  16563. *(*uintptr)(unsafe.Pointer(fromP)) = from
  16564. *(*uintptr)(unsafe.Pointer(toP)) = to
  16565. return res
  16566. }
  16567. var _utf8_encoding_ns = Tnormal_encoding{
  16568. Fenc: TENCODING{
  16569. Fscanners: [4]TSCANNER{},
  16570. FliteralScanners: [2]TSCANNER{},
  16571. FminBytesPerChar: int32(1),
  16572. FisUtf8: uint8(1),
  16573. },
  16574. Ftype1: [256]uint8{
  16575. 9: uint8(_BT_S),
  16576. 10: uint8(_BT_LF),
  16577. 13: uint8(_BT_CR),
  16578. 32: uint8(_BT_S),
  16579. 33: uint8(_BT_EXCL),
  16580. 34: uint8(_BT_QUOT),
  16581. 35: uint8(_BT_NUM),
  16582. 36: uint8(_BT_OTHER),
  16583. 37: uint8(_BT_PERCNT),
  16584. 38: uint8(_BT_AMP),
  16585. 39: uint8(_BT_APOS),
  16586. 40: uint8(_BT_LPAR),
  16587. 41: uint8(_BT_RPAR),
  16588. 42: uint8(_BT_AST),
  16589. 43: uint8(_BT_PLUS),
  16590. 44: uint8(_BT_COMMA),
  16591. 45: uint8(_BT_MINUS),
  16592. 46: uint8(_BT_NAME),
  16593. 47: uint8(_BT_SOL),
  16594. 48: uint8(_BT_DIGIT),
  16595. 49: uint8(_BT_DIGIT),
  16596. 50: uint8(_BT_DIGIT),
  16597. 51: uint8(_BT_DIGIT),
  16598. 52: uint8(_BT_DIGIT),
  16599. 53: uint8(_BT_DIGIT),
  16600. 54: uint8(_BT_DIGIT),
  16601. 55: uint8(_BT_DIGIT),
  16602. 56: uint8(_BT_DIGIT),
  16603. 57: uint8(_BT_DIGIT),
  16604. 58: uint8(_BT_COLON),
  16605. 59: uint8(_BT_SEMI),
  16606. 60: uint8(_BT_LT),
  16607. 61: uint8(_BT_EQUALS),
  16608. 62: uint8(_BT_GT),
  16609. 63: uint8(_BT_QUEST),
  16610. 64: uint8(_BT_OTHER),
  16611. 65: uint8(_BT_HEX),
  16612. 66: uint8(_BT_HEX),
  16613. 67: uint8(_BT_HEX),
  16614. 68: uint8(_BT_HEX),
  16615. 69: uint8(_BT_HEX),
  16616. 70: uint8(_BT_HEX),
  16617. 71: uint8(_BT_NMSTRT),
  16618. 72: uint8(_BT_NMSTRT),
  16619. 73: uint8(_BT_NMSTRT),
  16620. 74: uint8(_BT_NMSTRT),
  16621. 75: uint8(_BT_NMSTRT),
  16622. 76: uint8(_BT_NMSTRT),
  16623. 77: uint8(_BT_NMSTRT),
  16624. 78: uint8(_BT_NMSTRT),
  16625. 79: uint8(_BT_NMSTRT),
  16626. 80: uint8(_BT_NMSTRT),
  16627. 81: uint8(_BT_NMSTRT),
  16628. 82: uint8(_BT_NMSTRT),
  16629. 83: uint8(_BT_NMSTRT),
  16630. 84: uint8(_BT_NMSTRT),
  16631. 85: uint8(_BT_NMSTRT),
  16632. 86: uint8(_BT_NMSTRT),
  16633. 87: uint8(_BT_NMSTRT),
  16634. 88: uint8(_BT_NMSTRT),
  16635. 89: uint8(_BT_NMSTRT),
  16636. 90: uint8(_BT_NMSTRT),
  16637. 91: uint8(_BT_LSQB),
  16638. 92: uint8(_BT_OTHER),
  16639. 93: uint8(_BT_RSQB),
  16640. 94: uint8(_BT_OTHER),
  16641. 95: uint8(_BT_NMSTRT),
  16642. 96: uint8(_BT_OTHER),
  16643. 97: uint8(_BT_HEX),
  16644. 98: uint8(_BT_HEX),
  16645. 99: uint8(_BT_HEX),
  16646. 100: uint8(_BT_HEX),
  16647. 101: uint8(_BT_HEX),
  16648. 102: uint8(_BT_HEX),
  16649. 103: uint8(_BT_NMSTRT),
  16650. 104: uint8(_BT_NMSTRT),
  16651. 105: uint8(_BT_NMSTRT),
  16652. 106: uint8(_BT_NMSTRT),
  16653. 107: uint8(_BT_NMSTRT),
  16654. 108: uint8(_BT_NMSTRT),
  16655. 109: uint8(_BT_NMSTRT),
  16656. 110: uint8(_BT_NMSTRT),
  16657. 111: uint8(_BT_NMSTRT),
  16658. 112: uint8(_BT_NMSTRT),
  16659. 113: uint8(_BT_NMSTRT),
  16660. 114: uint8(_BT_NMSTRT),
  16661. 115: uint8(_BT_NMSTRT),
  16662. 116: uint8(_BT_NMSTRT),
  16663. 117: uint8(_BT_NMSTRT),
  16664. 118: uint8(_BT_NMSTRT),
  16665. 119: uint8(_BT_NMSTRT),
  16666. 120: uint8(_BT_NMSTRT),
  16667. 121: uint8(_BT_NMSTRT),
  16668. 122: uint8(_BT_NMSTRT),
  16669. 123: uint8(_BT_OTHER),
  16670. 124: uint8(_BT_VERBAR),
  16671. 125: uint8(_BT_OTHER),
  16672. 126: uint8(_BT_OTHER),
  16673. 127: uint8(_BT_OTHER),
  16674. 128: uint8(_BT_TRAIL),
  16675. 129: uint8(_BT_TRAIL),
  16676. 130: uint8(_BT_TRAIL),
  16677. 131: uint8(_BT_TRAIL),
  16678. 132: uint8(_BT_TRAIL),
  16679. 133: uint8(_BT_TRAIL),
  16680. 134: uint8(_BT_TRAIL),
  16681. 135: uint8(_BT_TRAIL),
  16682. 136: uint8(_BT_TRAIL),
  16683. 137: uint8(_BT_TRAIL),
  16684. 138: uint8(_BT_TRAIL),
  16685. 139: uint8(_BT_TRAIL),
  16686. 140: uint8(_BT_TRAIL),
  16687. 141: uint8(_BT_TRAIL),
  16688. 142: uint8(_BT_TRAIL),
  16689. 143: uint8(_BT_TRAIL),
  16690. 144: uint8(_BT_TRAIL),
  16691. 145: uint8(_BT_TRAIL),
  16692. 146: uint8(_BT_TRAIL),
  16693. 147: uint8(_BT_TRAIL),
  16694. 148: uint8(_BT_TRAIL),
  16695. 149: uint8(_BT_TRAIL),
  16696. 150: uint8(_BT_TRAIL),
  16697. 151: uint8(_BT_TRAIL),
  16698. 152: uint8(_BT_TRAIL),
  16699. 153: uint8(_BT_TRAIL),
  16700. 154: uint8(_BT_TRAIL),
  16701. 155: uint8(_BT_TRAIL),
  16702. 156: uint8(_BT_TRAIL),
  16703. 157: uint8(_BT_TRAIL),
  16704. 158: uint8(_BT_TRAIL),
  16705. 159: uint8(_BT_TRAIL),
  16706. 160: uint8(_BT_TRAIL),
  16707. 161: uint8(_BT_TRAIL),
  16708. 162: uint8(_BT_TRAIL),
  16709. 163: uint8(_BT_TRAIL),
  16710. 164: uint8(_BT_TRAIL),
  16711. 165: uint8(_BT_TRAIL),
  16712. 166: uint8(_BT_TRAIL),
  16713. 167: uint8(_BT_TRAIL),
  16714. 168: uint8(_BT_TRAIL),
  16715. 169: uint8(_BT_TRAIL),
  16716. 170: uint8(_BT_TRAIL),
  16717. 171: uint8(_BT_TRAIL),
  16718. 172: uint8(_BT_TRAIL),
  16719. 173: uint8(_BT_TRAIL),
  16720. 174: uint8(_BT_TRAIL),
  16721. 175: uint8(_BT_TRAIL),
  16722. 176: uint8(_BT_TRAIL),
  16723. 177: uint8(_BT_TRAIL),
  16724. 178: uint8(_BT_TRAIL),
  16725. 179: uint8(_BT_TRAIL),
  16726. 180: uint8(_BT_TRAIL),
  16727. 181: uint8(_BT_TRAIL),
  16728. 182: uint8(_BT_TRAIL),
  16729. 183: uint8(_BT_TRAIL),
  16730. 184: uint8(_BT_TRAIL),
  16731. 185: uint8(_BT_TRAIL),
  16732. 186: uint8(_BT_TRAIL),
  16733. 187: uint8(_BT_TRAIL),
  16734. 188: uint8(_BT_TRAIL),
  16735. 189: uint8(_BT_TRAIL),
  16736. 190: uint8(_BT_TRAIL),
  16737. 191: uint8(_BT_TRAIL),
  16738. 192: uint8(_BT_LEAD2),
  16739. 193: uint8(_BT_LEAD2),
  16740. 194: uint8(_BT_LEAD2),
  16741. 195: uint8(_BT_LEAD2),
  16742. 196: uint8(_BT_LEAD2),
  16743. 197: uint8(_BT_LEAD2),
  16744. 198: uint8(_BT_LEAD2),
  16745. 199: uint8(_BT_LEAD2),
  16746. 200: uint8(_BT_LEAD2),
  16747. 201: uint8(_BT_LEAD2),
  16748. 202: uint8(_BT_LEAD2),
  16749. 203: uint8(_BT_LEAD2),
  16750. 204: uint8(_BT_LEAD2),
  16751. 205: uint8(_BT_LEAD2),
  16752. 206: uint8(_BT_LEAD2),
  16753. 207: uint8(_BT_LEAD2),
  16754. 208: uint8(_BT_LEAD2),
  16755. 209: uint8(_BT_LEAD2),
  16756. 210: uint8(_BT_LEAD2),
  16757. 211: uint8(_BT_LEAD2),
  16758. 212: uint8(_BT_LEAD2),
  16759. 213: uint8(_BT_LEAD2),
  16760. 214: uint8(_BT_LEAD2),
  16761. 215: uint8(_BT_LEAD2),
  16762. 216: uint8(_BT_LEAD2),
  16763. 217: uint8(_BT_LEAD2),
  16764. 218: uint8(_BT_LEAD2),
  16765. 219: uint8(_BT_LEAD2),
  16766. 220: uint8(_BT_LEAD2),
  16767. 221: uint8(_BT_LEAD2),
  16768. 222: uint8(_BT_LEAD2),
  16769. 223: uint8(_BT_LEAD2),
  16770. 224: uint8(_BT_LEAD3),
  16771. 225: uint8(_BT_LEAD3),
  16772. 226: uint8(_BT_LEAD3),
  16773. 227: uint8(_BT_LEAD3),
  16774. 228: uint8(_BT_LEAD3),
  16775. 229: uint8(_BT_LEAD3),
  16776. 230: uint8(_BT_LEAD3),
  16777. 231: uint8(_BT_LEAD3),
  16778. 232: uint8(_BT_LEAD3),
  16779. 233: uint8(_BT_LEAD3),
  16780. 234: uint8(_BT_LEAD3),
  16781. 235: uint8(_BT_LEAD3),
  16782. 236: uint8(_BT_LEAD3),
  16783. 237: uint8(_BT_LEAD3),
  16784. 238: uint8(_BT_LEAD3),
  16785. 239: uint8(_BT_LEAD3),
  16786. 240: uint8(_BT_LEAD4),
  16787. 241: uint8(_BT_LEAD4),
  16788. 242: uint8(_BT_LEAD4),
  16789. 243: uint8(_BT_LEAD4),
  16790. 244: uint8(_BT_LEAD4),
  16791. 254: uint8(_BT_MALFORM),
  16792. 255: uint8(_BT_MALFORM),
  16793. },
  16794. }
  16795. func init() {
  16796. p := unsafe.Pointer(&_utf8_encoding_ns)
  16797. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  16798. *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_normal_contentTok)
  16799. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_cdataSectionTok)
  16800. *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_normal_ignoreSectionTok)
  16801. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_attributeValueTok)
  16802. *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_normal_entityValueTok)
  16803. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_nameMatchesAscii)
  16804. *(*uintptr)(unsafe.Add(p, 28)) = __ccgo_fp(_normal_nameLength)
  16805. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_skipS)
  16806. *(*uintptr)(unsafe.Add(p, 36)) = __ccgo_fp(_normal_getAtts)
  16807. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_charRefNumber)
  16808. *(*uintptr)(unsafe.Add(p, 44)) = __ccgo_fp(_normal_predefinedEntityName)
  16809. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_updatePosition)
  16810. *(*uintptr)(unsafe.Add(p, 52)) = __ccgo_fp(_normal_isPublicId)
  16811. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_utf8_toUtf8)
  16812. *(*uintptr)(unsafe.Add(p, 60)) = __ccgo_fp(_utf8_toUtf16)
  16813. *(*uintptr)(unsafe.Add(p, 328)) = __ccgo_fp(_utf8_isName2)
  16814. *(*uintptr)(unsafe.Add(p, 332)) = __ccgo_fp(_utf8_isName3)
  16815. *(*uintptr)(unsafe.Add(p, 336)) = __ccgo_fp(_isNever)
  16816. *(*uintptr)(unsafe.Add(p, 340)) = __ccgo_fp(_utf8_isNmstrt2)
  16817. *(*uintptr)(unsafe.Add(p, 344)) = __ccgo_fp(_utf8_isNmstrt3)
  16818. *(*uintptr)(unsafe.Add(p, 348)) = __ccgo_fp(_isNever)
  16819. *(*uintptr)(unsafe.Add(p, 352)) = __ccgo_fp(_utf8_isInvalid2)
  16820. *(*uintptr)(unsafe.Add(p, 356)) = __ccgo_fp(_utf8_isInvalid3)
  16821. *(*uintptr)(unsafe.Add(p, 360)) = __ccgo_fp(_utf8_isInvalid4)
  16822. }
  16823. var _utf8_encoding = Tnormal_encoding{
  16824. Fenc: TENCODING{
  16825. Fscanners: [4]TSCANNER{},
  16826. FliteralScanners: [2]TSCANNER{},
  16827. FminBytesPerChar: int32(1),
  16828. FisUtf8: uint8(1),
  16829. },
  16830. Ftype1: [256]uint8{
  16831. 9: uint8(_BT_S),
  16832. 10: uint8(_BT_LF),
  16833. 13: uint8(_BT_CR),
  16834. 32: uint8(_BT_S),
  16835. 33: uint8(_BT_EXCL),
  16836. 34: uint8(_BT_QUOT),
  16837. 35: uint8(_BT_NUM),
  16838. 36: uint8(_BT_OTHER),
  16839. 37: uint8(_BT_PERCNT),
  16840. 38: uint8(_BT_AMP),
  16841. 39: uint8(_BT_APOS),
  16842. 40: uint8(_BT_LPAR),
  16843. 41: uint8(_BT_RPAR),
  16844. 42: uint8(_BT_AST),
  16845. 43: uint8(_BT_PLUS),
  16846. 44: uint8(_BT_COMMA),
  16847. 45: uint8(_BT_MINUS),
  16848. 46: uint8(_BT_NAME),
  16849. 47: uint8(_BT_SOL),
  16850. 48: uint8(_BT_DIGIT),
  16851. 49: uint8(_BT_DIGIT),
  16852. 50: uint8(_BT_DIGIT),
  16853. 51: uint8(_BT_DIGIT),
  16854. 52: uint8(_BT_DIGIT),
  16855. 53: uint8(_BT_DIGIT),
  16856. 54: uint8(_BT_DIGIT),
  16857. 55: uint8(_BT_DIGIT),
  16858. 56: uint8(_BT_DIGIT),
  16859. 57: uint8(_BT_DIGIT),
  16860. 58: uint8(_BT_NMSTRT),
  16861. 59: uint8(_BT_SEMI),
  16862. 60: uint8(_BT_LT),
  16863. 61: uint8(_BT_EQUALS),
  16864. 62: uint8(_BT_GT),
  16865. 63: uint8(_BT_QUEST),
  16866. 64: uint8(_BT_OTHER),
  16867. 65: uint8(_BT_HEX),
  16868. 66: uint8(_BT_HEX),
  16869. 67: uint8(_BT_HEX),
  16870. 68: uint8(_BT_HEX),
  16871. 69: uint8(_BT_HEX),
  16872. 70: uint8(_BT_HEX),
  16873. 71: uint8(_BT_NMSTRT),
  16874. 72: uint8(_BT_NMSTRT),
  16875. 73: uint8(_BT_NMSTRT),
  16876. 74: uint8(_BT_NMSTRT),
  16877. 75: uint8(_BT_NMSTRT),
  16878. 76: uint8(_BT_NMSTRT),
  16879. 77: uint8(_BT_NMSTRT),
  16880. 78: uint8(_BT_NMSTRT),
  16881. 79: uint8(_BT_NMSTRT),
  16882. 80: uint8(_BT_NMSTRT),
  16883. 81: uint8(_BT_NMSTRT),
  16884. 82: uint8(_BT_NMSTRT),
  16885. 83: uint8(_BT_NMSTRT),
  16886. 84: uint8(_BT_NMSTRT),
  16887. 85: uint8(_BT_NMSTRT),
  16888. 86: uint8(_BT_NMSTRT),
  16889. 87: uint8(_BT_NMSTRT),
  16890. 88: uint8(_BT_NMSTRT),
  16891. 89: uint8(_BT_NMSTRT),
  16892. 90: uint8(_BT_NMSTRT),
  16893. 91: uint8(_BT_LSQB),
  16894. 92: uint8(_BT_OTHER),
  16895. 93: uint8(_BT_RSQB),
  16896. 94: uint8(_BT_OTHER),
  16897. 95: uint8(_BT_NMSTRT),
  16898. 96: uint8(_BT_OTHER),
  16899. 97: uint8(_BT_HEX),
  16900. 98: uint8(_BT_HEX),
  16901. 99: uint8(_BT_HEX),
  16902. 100: uint8(_BT_HEX),
  16903. 101: uint8(_BT_HEX),
  16904. 102: uint8(_BT_HEX),
  16905. 103: uint8(_BT_NMSTRT),
  16906. 104: uint8(_BT_NMSTRT),
  16907. 105: uint8(_BT_NMSTRT),
  16908. 106: uint8(_BT_NMSTRT),
  16909. 107: uint8(_BT_NMSTRT),
  16910. 108: uint8(_BT_NMSTRT),
  16911. 109: uint8(_BT_NMSTRT),
  16912. 110: uint8(_BT_NMSTRT),
  16913. 111: uint8(_BT_NMSTRT),
  16914. 112: uint8(_BT_NMSTRT),
  16915. 113: uint8(_BT_NMSTRT),
  16916. 114: uint8(_BT_NMSTRT),
  16917. 115: uint8(_BT_NMSTRT),
  16918. 116: uint8(_BT_NMSTRT),
  16919. 117: uint8(_BT_NMSTRT),
  16920. 118: uint8(_BT_NMSTRT),
  16921. 119: uint8(_BT_NMSTRT),
  16922. 120: uint8(_BT_NMSTRT),
  16923. 121: uint8(_BT_NMSTRT),
  16924. 122: uint8(_BT_NMSTRT),
  16925. 123: uint8(_BT_OTHER),
  16926. 124: uint8(_BT_VERBAR),
  16927. 125: uint8(_BT_OTHER),
  16928. 126: uint8(_BT_OTHER),
  16929. 127: uint8(_BT_OTHER),
  16930. 128: uint8(_BT_TRAIL),
  16931. 129: uint8(_BT_TRAIL),
  16932. 130: uint8(_BT_TRAIL),
  16933. 131: uint8(_BT_TRAIL),
  16934. 132: uint8(_BT_TRAIL),
  16935. 133: uint8(_BT_TRAIL),
  16936. 134: uint8(_BT_TRAIL),
  16937. 135: uint8(_BT_TRAIL),
  16938. 136: uint8(_BT_TRAIL),
  16939. 137: uint8(_BT_TRAIL),
  16940. 138: uint8(_BT_TRAIL),
  16941. 139: uint8(_BT_TRAIL),
  16942. 140: uint8(_BT_TRAIL),
  16943. 141: uint8(_BT_TRAIL),
  16944. 142: uint8(_BT_TRAIL),
  16945. 143: uint8(_BT_TRAIL),
  16946. 144: uint8(_BT_TRAIL),
  16947. 145: uint8(_BT_TRAIL),
  16948. 146: uint8(_BT_TRAIL),
  16949. 147: uint8(_BT_TRAIL),
  16950. 148: uint8(_BT_TRAIL),
  16951. 149: uint8(_BT_TRAIL),
  16952. 150: uint8(_BT_TRAIL),
  16953. 151: uint8(_BT_TRAIL),
  16954. 152: uint8(_BT_TRAIL),
  16955. 153: uint8(_BT_TRAIL),
  16956. 154: uint8(_BT_TRAIL),
  16957. 155: uint8(_BT_TRAIL),
  16958. 156: uint8(_BT_TRAIL),
  16959. 157: uint8(_BT_TRAIL),
  16960. 158: uint8(_BT_TRAIL),
  16961. 159: uint8(_BT_TRAIL),
  16962. 160: uint8(_BT_TRAIL),
  16963. 161: uint8(_BT_TRAIL),
  16964. 162: uint8(_BT_TRAIL),
  16965. 163: uint8(_BT_TRAIL),
  16966. 164: uint8(_BT_TRAIL),
  16967. 165: uint8(_BT_TRAIL),
  16968. 166: uint8(_BT_TRAIL),
  16969. 167: uint8(_BT_TRAIL),
  16970. 168: uint8(_BT_TRAIL),
  16971. 169: uint8(_BT_TRAIL),
  16972. 170: uint8(_BT_TRAIL),
  16973. 171: uint8(_BT_TRAIL),
  16974. 172: uint8(_BT_TRAIL),
  16975. 173: uint8(_BT_TRAIL),
  16976. 174: uint8(_BT_TRAIL),
  16977. 175: uint8(_BT_TRAIL),
  16978. 176: uint8(_BT_TRAIL),
  16979. 177: uint8(_BT_TRAIL),
  16980. 178: uint8(_BT_TRAIL),
  16981. 179: uint8(_BT_TRAIL),
  16982. 180: uint8(_BT_TRAIL),
  16983. 181: uint8(_BT_TRAIL),
  16984. 182: uint8(_BT_TRAIL),
  16985. 183: uint8(_BT_TRAIL),
  16986. 184: uint8(_BT_TRAIL),
  16987. 185: uint8(_BT_TRAIL),
  16988. 186: uint8(_BT_TRAIL),
  16989. 187: uint8(_BT_TRAIL),
  16990. 188: uint8(_BT_TRAIL),
  16991. 189: uint8(_BT_TRAIL),
  16992. 190: uint8(_BT_TRAIL),
  16993. 191: uint8(_BT_TRAIL),
  16994. 192: uint8(_BT_LEAD2),
  16995. 193: uint8(_BT_LEAD2),
  16996. 194: uint8(_BT_LEAD2),
  16997. 195: uint8(_BT_LEAD2),
  16998. 196: uint8(_BT_LEAD2),
  16999. 197: uint8(_BT_LEAD2),
  17000. 198: uint8(_BT_LEAD2),
  17001. 199: uint8(_BT_LEAD2),
  17002. 200: uint8(_BT_LEAD2),
  17003. 201: uint8(_BT_LEAD2),
  17004. 202: uint8(_BT_LEAD2),
  17005. 203: uint8(_BT_LEAD2),
  17006. 204: uint8(_BT_LEAD2),
  17007. 205: uint8(_BT_LEAD2),
  17008. 206: uint8(_BT_LEAD2),
  17009. 207: uint8(_BT_LEAD2),
  17010. 208: uint8(_BT_LEAD2),
  17011. 209: uint8(_BT_LEAD2),
  17012. 210: uint8(_BT_LEAD2),
  17013. 211: uint8(_BT_LEAD2),
  17014. 212: uint8(_BT_LEAD2),
  17015. 213: uint8(_BT_LEAD2),
  17016. 214: uint8(_BT_LEAD2),
  17017. 215: uint8(_BT_LEAD2),
  17018. 216: uint8(_BT_LEAD2),
  17019. 217: uint8(_BT_LEAD2),
  17020. 218: uint8(_BT_LEAD2),
  17021. 219: uint8(_BT_LEAD2),
  17022. 220: uint8(_BT_LEAD2),
  17023. 221: uint8(_BT_LEAD2),
  17024. 222: uint8(_BT_LEAD2),
  17025. 223: uint8(_BT_LEAD2),
  17026. 224: uint8(_BT_LEAD3),
  17027. 225: uint8(_BT_LEAD3),
  17028. 226: uint8(_BT_LEAD3),
  17029. 227: uint8(_BT_LEAD3),
  17030. 228: uint8(_BT_LEAD3),
  17031. 229: uint8(_BT_LEAD3),
  17032. 230: uint8(_BT_LEAD3),
  17033. 231: uint8(_BT_LEAD3),
  17034. 232: uint8(_BT_LEAD3),
  17035. 233: uint8(_BT_LEAD3),
  17036. 234: uint8(_BT_LEAD3),
  17037. 235: uint8(_BT_LEAD3),
  17038. 236: uint8(_BT_LEAD3),
  17039. 237: uint8(_BT_LEAD3),
  17040. 238: uint8(_BT_LEAD3),
  17041. 239: uint8(_BT_LEAD3),
  17042. 240: uint8(_BT_LEAD4),
  17043. 241: uint8(_BT_LEAD4),
  17044. 242: uint8(_BT_LEAD4),
  17045. 243: uint8(_BT_LEAD4),
  17046. 244: uint8(_BT_LEAD4),
  17047. 254: uint8(_BT_MALFORM),
  17048. 255: uint8(_BT_MALFORM),
  17049. },
  17050. }
  17051. func init() {
  17052. p := unsafe.Pointer(&_utf8_encoding)
  17053. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  17054. *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_normal_contentTok)
  17055. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_cdataSectionTok)
  17056. *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_normal_ignoreSectionTok)
  17057. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_attributeValueTok)
  17058. *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_normal_entityValueTok)
  17059. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_nameMatchesAscii)
  17060. *(*uintptr)(unsafe.Add(p, 28)) = __ccgo_fp(_normal_nameLength)
  17061. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_skipS)
  17062. *(*uintptr)(unsafe.Add(p, 36)) = __ccgo_fp(_normal_getAtts)
  17063. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_charRefNumber)
  17064. *(*uintptr)(unsafe.Add(p, 44)) = __ccgo_fp(_normal_predefinedEntityName)
  17065. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_updatePosition)
  17066. *(*uintptr)(unsafe.Add(p, 52)) = __ccgo_fp(_normal_isPublicId)
  17067. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_utf8_toUtf8)
  17068. *(*uintptr)(unsafe.Add(p, 60)) = __ccgo_fp(_utf8_toUtf16)
  17069. *(*uintptr)(unsafe.Add(p, 328)) = __ccgo_fp(_utf8_isName2)
  17070. *(*uintptr)(unsafe.Add(p, 332)) = __ccgo_fp(_utf8_isName3)
  17071. *(*uintptr)(unsafe.Add(p, 336)) = __ccgo_fp(_isNever)
  17072. *(*uintptr)(unsafe.Add(p, 340)) = __ccgo_fp(_utf8_isNmstrt2)
  17073. *(*uintptr)(unsafe.Add(p, 344)) = __ccgo_fp(_utf8_isNmstrt3)
  17074. *(*uintptr)(unsafe.Add(p, 348)) = __ccgo_fp(_isNever)
  17075. *(*uintptr)(unsafe.Add(p, 352)) = __ccgo_fp(_utf8_isInvalid2)
  17076. *(*uintptr)(unsafe.Add(p, 356)) = __ccgo_fp(_utf8_isInvalid3)
  17077. *(*uintptr)(unsafe.Add(p, 360)) = __ccgo_fp(_utf8_isInvalid4)
  17078. }
  17079. var _internal_utf8_encoding_ns = Tnormal_encoding{
  17080. Fenc: TENCODING{
  17081. Fscanners: [4]TSCANNER{},
  17082. FliteralScanners: [2]TSCANNER{},
  17083. FminBytesPerChar: int32(1),
  17084. FisUtf8: uint8(1),
  17085. },
  17086. Ftype1: [256]uint8{
  17087. 9: uint8(_BT_S),
  17088. 10: uint8(_BT_LF),
  17089. 13: uint8(_BT_S),
  17090. 32: uint8(_BT_S),
  17091. 33: uint8(_BT_EXCL),
  17092. 34: uint8(_BT_QUOT),
  17093. 35: uint8(_BT_NUM),
  17094. 36: uint8(_BT_OTHER),
  17095. 37: uint8(_BT_PERCNT),
  17096. 38: uint8(_BT_AMP),
  17097. 39: uint8(_BT_APOS),
  17098. 40: uint8(_BT_LPAR),
  17099. 41: uint8(_BT_RPAR),
  17100. 42: uint8(_BT_AST),
  17101. 43: uint8(_BT_PLUS),
  17102. 44: uint8(_BT_COMMA),
  17103. 45: uint8(_BT_MINUS),
  17104. 46: uint8(_BT_NAME),
  17105. 47: uint8(_BT_SOL),
  17106. 48: uint8(_BT_DIGIT),
  17107. 49: uint8(_BT_DIGIT),
  17108. 50: uint8(_BT_DIGIT),
  17109. 51: uint8(_BT_DIGIT),
  17110. 52: uint8(_BT_DIGIT),
  17111. 53: uint8(_BT_DIGIT),
  17112. 54: uint8(_BT_DIGIT),
  17113. 55: uint8(_BT_DIGIT),
  17114. 56: uint8(_BT_DIGIT),
  17115. 57: uint8(_BT_DIGIT),
  17116. 58: uint8(_BT_COLON),
  17117. 59: uint8(_BT_SEMI),
  17118. 60: uint8(_BT_LT),
  17119. 61: uint8(_BT_EQUALS),
  17120. 62: uint8(_BT_GT),
  17121. 63: uint8(_BT_QUEST),
  17122. 64: uint8(_BT_OTHER),
  17123. 65: uint8(_BT_HEX),
  17124. 66: uint8(_BT_HEX),
  17125. 67: uint8(_BT_HEX),
  17126. 68: uint8(_BT_HEX),
  17127. 69: uint8(_BT_HEX),
  17128. 70: uint8(_BT_HEX),
  17129. 71: uint8(_BT_NMSTRT),
  17130. 72: uint8(_BT_NMSTRT),
  17131. 73: uint8(_BT_NMSTRT),
  17132. 74: uint8(_BT_NMSTRT),
  17133. 75: uint8(_BT_NMSTRT),
  17134. 76: uint8(_BT_NMSTRT),
  17135. 77: uint8(_BT_NMSTRT),
  17136. 78: uint8(_BT_NMSTRT),
  17137. 79: uint8(_BT_NMSTRT),
  17138. 80: uint8(_BT_NMSTRT),
  17139. 81: uint8(_BT_NMSTRT),
  17140. 82: uint8(_BT_NMSTRT),
  17141. 83: uint8(_BT_NMSTRT),
  17142. 84: uint8(_BT_NMSTRT),
  17143. 85: uint8(_BT_NMSTRT),
  17144. 86: uint8(_BT_NMSTRT),
  17145. 87: uint8(_BT_NMSTRT),
  17146. 88: uint8(_BT_NMSTRT),
  17147. 89: uint8(_BT_NMSTRT),
  17148. 90: uint8(_BT_NMSTRT),
  17149. 91: uint8(_BT_LSQB),
  17150. 92: uint8(_BT_OTHER),
  17151. 93: uint8(_BT_RSQB),
  17152. 94: uint8(_BT_OTHER),
  17153. 95: uint8(_BT_NMSTRT),
  17154. 96: uint8(_BT_OTHER),
  17155. 97: uint8(_BT_HEX),
  17156. 98: uint8(_BT_HEX),
  17157. 99: uint8(_BT_HEX),
  17158. 100: uint8(_BT_HEX),
  17159. 101: uint8(_BT_HEX),
  17160. 102: uint8(_BT_HEX),
  17161. 103: uint8(_BT_NMSTRT),
  17162. 104: uint8(_BT_NMSTRT),
  17163. 105: uint8(_BT_NMSTRT),
  17164. 106: uint8(_BT_NMSTRT),
  17165. 107: uint8(_BT_NMSTRT),
  17166. 108: uint8(_BT_NMSTRT),
  17167. 109: uint8(_BT_NMSTRT),
  17168. 110: uint8(_BT_NMSTRT),
  17169. 111: uint8(_BT_NMSTRT),
  17170. 112: uint8(_BT_NMSTRT),
  17171. 113: uint8(_BT_NMSTRT),
  17172. 114: uint8(_BT_NMSTRT),
  17173. 115: uint8(_BT_NMSTRT),
  17174. 116: uint8(_BT_NMSTRT),
  17175. 117: uint8(_BT_NMSTRT),
  17176. 118: uint8(_BT_NMSTRT),
  17177. 119: uint8(_BT_NMSTRT),
  17178. 120: uint8(_BT_NMSTRT),
  17179. 121: uint8(_BT_NMSTRT),
  17180. 122: uint8(_BT_NMSTRT),
  17181. 123: uint8(_BT_OTHER),
  17182. 124: uint8(_BT_VERBAR),
  17183. 125: uint8(_BT_OTHER),
  17184. 126: uint8(_BT_OTHER),
  17185. 127: uint8(_BT_OTHER),
  17186. 128: uint8(_BT_TRAIL),
  17187. 129: uint8(_BT_TRAIL),
  17188. 130: uint8(_BT_TRAIL),
  17189. 131: uint8(_BT_TRAIL),
  17190. 132: uint8(_BT_TRAIL),
  17191. 133: uint8(_BT_TRAIL),
  17192. 134: uint8(_BT_TRAIL),
  17193. 135: uint8(_BT_TRAIL),
  17194. 136: uint8(_BT_TRAIL),
  17195. 137: uint8(_BT_TRAIL),
  17196. 138: uint8(_BT_TRAIL),
  17197. 139: uint8(_BT_TRAIL),
  17198. 140: uint8(_BT_TRAIL),
  17199. 141: uint8(_BT_TRAIL),
  17200. 142: uint8(_BT_TRAIL),
  17201. 143: uint8(_BT_TRAIL),
  17202. 144: uint8(_BT_TRAIL),
  17203. 145: uint8(_BT_TRAIL),
  17204. 146: uint8(_BT_TRAIL),
  17205. 147: uint8(_BT_TRAIL),
  17206. 148: uint8(_BT_TRAIL),
  17207. 149: uint8(_BT_TRAIL),
  17208. 150: uint8(_BT_TRAIL),
  17209. 151: uint8(_BT_TRAIL),
  17210. 152: uint8(_BT_TRAIL),
  17211. 153: uint8(_BT_TRAIL),
  17212. 154: uint8(_BT_TRAIL),
  17213. 155: uint8(_BT_TRAIL),
  17214. 156: uint8(_BT_TRAIL),
  17215. 157: uint8(_BT_TRAIL),
  17216. 158: uint8(_BT_TRAIL),
  17217. 159: uint8(_BT_TRAIL),
  17218. 160: uint8(_BT_TRAIL),
  17219. 161: uint8(_BT_TRAIL),
  17220. 162: uint8(_BT_TRAIL),
  17221. 163: uint8(_BT_TRAIL),
  17222. 164: uint8(_BT_TRAIL),
  17223. 165: uint8(_BT_TRAIL),
  17224. 166: uint8(_BT_TRAIL),
  17225. 167: uint8(_BT_TRAIL),
  17226. 168: uint8(_BT_TRAIL),
  17227. 169: uint8(_BT_TRAIL),
  17228. 170: uint8(_BT_TRAIL),
  17229. 171: uint8(_BT_TRAIL),
  17230. 172: uint8(_BT_TRAIL),
  17231. 173: uint8(_BT_TRAIL),
  17232. 174: uint8(_BT_TRAIL),
  17233. 175: uint8(_BT_TRAIL),
  17234. 176: uint8(_BT_TRAIL),
  17235. 177: uint8(_BT_TRAIL),
  17236. 178: uint8(_BT_TRAIL),
  17237. 179: uint8(_BT_TRAIL),
  17238. 180: uint8(_BT_TRAIL),
  17239. 181: uint8(_BT_TRAIL),
  17240. 182: uint8(_BT_TRAIL),
  17241. 183: uint8(_BT_TRAIL),
  17242. 184: uint8(_BT_TRAIL),
  17243. 185: uint8(_BT_TRAIL),
  17244. 186: uint8(_BT_TRAIL),
  17245. 187: uint8(_BT_TRAIL),
  17246. 188: uint8(_BT_TRAIL),
  17247. 189: uint8(_BT_TRAIL),
  17248. 190: uint8(_BT_TRAIL),
  17249. 191: uint8(_BT_TRAIL),
  17250. 192: uint8(_BT_LEAD2),
  17251. 193: uint8(_BT_LEAD2),
  17252. 194: uint8(_BT_LEAD2),
  17253. 195: uint8(_BT_LEAD2),
  17254. 196: uint8(_BT_LEAD2),
  17255. 197: uint8(_BT_LEAD2),
  17256. 198: uint8(_BT_LEAD2),
  17257. 199: uint8(_BT_LEAD2),
  17258. 200: uint8(_BT_LEAD2),
  17259. 201: uint8(_BT_LEAD2),
  17260. 202: uint8(_BT_LEAD2),
  17261. 203: uint8(_BT_LEAD2),
  17262. 204: uint8(_BT_LEAD2),
  17263. 205: uint8(_BT_LEAD2),
  17264. 206: uint8(_BT_LEAD2),
  17265. 207: uint8(_BT_LEAD2),
  17266. 208: uint8(_BT_LEAD2),
  17267. 209: uint8(_BT_LEAD2),
  17268. 210: uint8(_BT_LEAD2),
  17269. 211: uint8(_BT_LEAD2),
  17270. 212: uint8(_BT_LEAD2),
  17271. 213: uint8(_BT_LEAD2),
  17272. 214: uint8(_BT_LEAD2),
  17273. 215: uint8(_BT_LEAD2),
  17274. 216: uint8(_BT_LEAD2),
  17275. 217: uint8(_BT_LEAD2),
  17276. 218: uint8(_BT_LEAD2),
  17277. 219: uint8(_BT_LEAD2),
  17278. 220: uint8(_BT_LEAD2),
  17279. 221: uint8(_BT_LEAD2),
  17280. 222: uint8(_BT_LEAD2),
  17281. 223: uint8(_BT_LEAD2),
  17282. 224: uint8(_BT_LEAD3),
  17283. 225: uint8(_BT_LEAD3),
  17284. 226: uint8(_BT_LEAD3),
  17285. 227: uint8(_BT_LEAD3),
  17286. 228: uint8(_BT_LEAD3),
  17287. 229: uint8(_BT_LEAD3),
  17288. 230: uint8(_BT_LEAD3),
  17289. 231: uint8(_BT_LEAD3),
  17290. 232: uint8(_BT_LEAD3),
  17291. 233: uint8(_BT_LEAD3),
  17292. 234: uint8(_BT_LEAD3),
  17293. 235: uint8(_BT_LEAD3),
  17294. 236: uint8(_BT_LEAD3),
  17295. 237: uint8(_BT_LEAD3),
  17296. 238: uint8(_BT_LEAD3),
  17297. 239: uint8(_BT_LEAD3),
  17298. 240: uint8(_BT_LEAD4),
  17299. 241: uint8(_BT_LEAD4),
  17300. 242: uint8(_BT_LEAD4),
  17301. 243: uint8(_BT_LEAD4),
  17302. 244: uint8(_BT_LEAD4),
  17303. 254: uint8(_BT_MALFORM),
  17304. 255: uint8(_BT_MALFORM),
  17305. },
  17306. }
  17307. func init() {
  17308. p := unsafe.Pointer(&_internal_utf8_encoding_ns)
  17309. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  17310. *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_normal_contentTok)
  17311. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_cdataSectionTok)
  17312. *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_normal_ignoreSectionTok)
  17313. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_attributeValueTok)
  17314. *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_normal_entityValueTok)
  17315. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_nameMatchesAscii)
  17316. *(*uintptr)(unsafe.Add(p, 28)) = __ccgo_fp(_normal_nameLength)
  17317. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_skipS)
  17318. *(*uintptr)(unsafe.Add(p, 36)) = __ccgo_fp(_normal_getAtts)
  17319. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_charRefNumber)
  17320. *(*uintptr)(unsafe.Add(p, 44)) = __ccgo_fp(_normal_predefinedEntityName)
  17321. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_updatePosition)
  17322. *(*uintptr)(unsafe.Add(p, 52)) = __ccgo_fp(_normal_isPublicId)
  17323. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_utf8_toUtf8)
  17324. *(*uintptr)(unsafe.Add(p, 60)) = __ccgo_fp(_utf8_toUtf16)
  17325. *(*uintptr)(unsafe.Add(p, 328)) = __ccgo_fp(_utf8_isName2)
  17326. *(*uintptr)(unsafe.Add(p, 332)) = __ccgo_fp(_utf8_isName3)
  17327. *(*uintptr)(unsafe.Add(p, 336)) = __ccgo_fp(_isNever)
  17328. *(*uintptr)(unsafe.Add(p, 340)) = __ccgo_fp(_utf8_isNmstrt2)
  17329. *(*uintptr)(unsafe.Add(p, 344)) = __ccgo_fp(_utf8_isNmstrt3)
  17330. *(*uintptr)(unsafe.Add(p, 348)) = __ccgo_fp(_isNever)
  17331. *(*uintptr)(unsafe.Add(p, 352)) = __ccgo_fp(_utf8_isInvalid2)
  17332. *(*uintptr)(unsafe.Add(p, 356)) = __ccgo_fp(_utf8_isInvalid3)
  17333. *(*uintptr)(unsafe.Add(p, 360)) = __ccgo_fp(_utf8_isInvalid4)
  17334. }
  17335. var _internal_utf8_encoding = Tnormal_encoding{
  17336. Fenc: TENCODING{
  17337. Fscanners: [4]TSCANNER{},
  17338. FliteralScanners: [2]TSCANNER{},
  17339. FminBytesPerChar: int32(1),
  17340. FisUtf8: uint8(1),
  17341. },
  17342. Ftype1: [256]uint8{
  17343. 9: uint8(_BT_S),
  17344. 10: uint8(_BT_LF),
  17345. 13: uint8(_BT_S),
  17346. 32: uint8(_BT_S),
  17347. 33: uint8(_BT_EXCL),
  17348. 34: uint8(_BT_QUOT),
  17349. 35: uint8(_BT_NUM),
  17350. 36: uint8(_BT_OTHER),
  17351. 37: uint8(_BT_PERCNT),
  17352. 38: uint8(_BT_AMP),
  17353. 39: uint8(_BT_APOS),
  17354. 40: uint8(_BT_LPAR),
  17355. 41: uint8(_BT_RPAR),
  17356. 42: uint8(_BT_AST),
  17357. 43: uint8(_BT_PLUS),
  17358. 44: uint8(_BT_COMMA),
  17359. 45: uint8(_BT_MINUS),
  17360. 46: uint8(_BT_NAME),
  17361. 47: uint8(_BT_SOL),
  17362. 48: uint8(_BT_DIGIT),
  17363. 49: uint8(_BT_DIGIT),
  17364. 50: uint8(_BT_DIGIT),
  17365. 51: uint8(_BT_DIGIT),
  17366. 52: uint8(_BT_DIGIT),
  17367. 53: uint8(_BT_DIGIT),
  17368. 54: uint8(_BT_DIGIT),
  17369. 55: uint8(_BT_DIGIT),
  17370. 56: uint8(_BT_DIGIT),
  17371. 57: uint8(_BT_DIGIT),
  17372. 58: uint8(_BT_NMSTRT),
  17373. 59: uint8(_BT_SEMI),
  17374. 60: uint8(_BT_LT),
  17375. 61: uint8(_BT_EQUALS),
  17376. 62: uint8(_BT_GT),
  17377. 63: uint8(_BT_QUEST),
  17378. 64: uint8(_BT_OTHER),
  17379. 65: uint8(_BT_HEX),
  17380. 66: uint8(_BT_HEX),
  17381. 67: uint8(_BT_HEX),
  17382. 68: uint8(_BT_HEX),
  17383. 69: uint8(_BT_HEX),
  17384. 70: uint8(_BT_HEX),
  17385. 71: uint8(_BT_NMSTRT),
  17386. 72: uint8(_BT_NMSTRT),
  17387. 73: uint8(_BT_NMSTRT),
  17388. 74: uint8(_BT_NMSTRT),
  17389. 75: uint8(_BT_NMSTRT),
  17390. 76: uint8(_BT_NMSTRT),
  17391. 77: uint8(_BT_NMSTRT),
  17392. 78: uint8(_BT_NMSTRT),
  17393. 79: uint8(_BT_NMSTRT),
  17394. 80: uint8(_BT_NMSTRT),
  17395. 81: uint8(_BT_NMSTRT),
  17396. 82: uint8(_BT_NMSTRT),
  17397. 83: uint8(_BT_NMSTRT),
  17398. 84: uint8(_BT_NMSTRT),
  17399. 85: uint8(_BT_NMSTRT),
  17400. 86: uint8(_BT_NMSTRT),
  17401. 87: uint8(_BT_NMSTRT),
  17402. 88: uint8(_BT_NMSTRT),
  17403. 89: uint8(_BT_NMSTRT),
  17404. 90: uint8(_BT_NMSTRT),
  17405. 91: uint8(_BT_LSQB),
  17406. 92: uint8(_BT_OTHER),
  17407. 93: uint8(_BT_RSQB),
  17408. 94: uint8(_BT_OTHER),
  17409. 95: uint8(_BT_NMSTRT),
  17410. 96: uint8(_BT_OTHER),
  17411. 97: uint8(_BT_HEX),
  17412. 98: uint8(_BT_HEX),
  17413. 99: uint8(_BT_HEX),
  17414. 100: uint8(_BT_HEX),
  17415. 101: uint8(_BT_HEX),
  17416. 102: uint8(_BT_HEX),
  17417. 103: uint8(_BT_NMSTRT),
  17418. 104: uint8(_BT_NMSTRT),
  17419. 105: uint8(_BT_NMSTRT),
  17420. 106: uint8(_BT_NMSTRT),
  17421. 107: uint8(_BT_NMSTRT),
  17422. 108: uint8(_BT_NMSTRT),
  17423. 109: uint8(_BT_NMSTRT),
  17424. 110: uint8(_BT_NMSTRT),
  17425. 111: uint8(_BT_NMSTRT),
  17426. 112: uint8(_BT_NMSTRT),
  17427. 113: uint8(_BT_NMSTRT),
  17428. 114: uint8(_BT_NMSTRT),
  17429. 115: uint8(_BT_NMSTRT),
  17430. 116: uint8(_BT_NMSTRT),
  17431. 117: uint8(_BT_NMSTRT),
  17432. 118: uint8(_BT_NMSTRT),
  17433. 119: uint8(_BT_NMSTRT),
  17434. 120: uint8(_BT_NMSTRT),
  17435. 121: uint8(_BT_NMSTRT),
  17436. 122: uint8(_BT_NMSTRT),
  17437. 123: uint8(_BT_OTHER),
  17438. 124: uint8(_BT_VERBAR),
  17439. 125: uint8(_BT_OTHER),
  17440. 126: uint8(_BT_OTHER),
  17441. 127: uint8(_BT_OTHER),
  17442. 128: uint8(_BT_TRAIL),
  17443. 129: uint8(_BT_TRAIL),
  17444. 130: uint8(_BT_TRAIL),
  17445. 131: uint8(_BT_TRAIL),
  17446. 132: uint8(_BT_TRAIL),
  17447. 133: uint8(_BT_TRAIL),
  17448. 134: uint8(_BT_TRAIL),
  17449. 135: uint8(_BT_TRAIL),
  17450. 136: uint8(_BT_TRAIL),
  17451. 137: uint8(_BT_TRAIL),
  17452. 138: uint8(_BT_TRAIL),
  17453. 139: uint8(_BT_TRAIL),
  17454. 140: uint8(_BT_TRAIL),
  17455. 141: uint8(_BT_TRAIL),
  17456. 142: uint8(_BT_TRAIL),
  17457. 143: uint8(_BT_TRAIL),
  17458. 144: uint8(_BT_TRAIL),
  17459. 145: uint8(_BT_TRAIL),
  17460. 146: uint8(_BT_TRAIL),
  17461. 147: uint8(_BT_TRAIL),
  17462. 148: uint8(_BT_TRAIL),
  17463. 149: uint8(_BT_TRAIL),
  17464. 150: uint8(_BT_TRAIL),
  17465. 151: uint8(_BT_TRAIL),
  17466. 152: uint8(_BT_TRAIL),
  17467. 153: uint8(_BT_TRAIL),
  17468. 154: uint8(_BT_TRAIL),
  17469. 155: uint8(_BT_TRAIL),
  17470. 156: uint8(_BT_TRAIL),
  17471. 157: uint8(_BT_TRAIL),
  17472. 158: uint8(_BT_TRAIL),
  17473. 159: uint8(_BT_TRAIL),
  17474. 160: uint8(_BT_TRAIL),
  17475. 161: uint8(_BT_TRAIL),
  17476. 162: uint8(_BT_TRAIL),
  17477. 163: uint8(_BT_TRAIL),
  17478. 164: uint8(_BT_TRAIL),
  17479. 165: uint8(_BT_TRAIL),
  17480. 166: uint8(_BT_TRAIL),
  17481. 167: uint8(_BT_TRAIL),
  17482. 168: uint8(_BT_TRAIL),
  17483. 169: uint8(_BT_TRAIL),
  17484. 170: uint8(_BT_TRAIL),
  17485. 171: uint8(_BT_TRAIL),
  17486. 172: uint8(_BT_TRAIL),
  17487. 173: uint8(_BT_TRAIL),
  17488. 174: uint8(_BT_TRAIL),
  17489. 175: uint8(_BT_TRAIL),
  17490. 176: uint8(_BT_TRAIL),
  17491. 177: uint8(_BT_TRAIL),
  17492. 178: uint8(_BT_TRAIL),
  17493. 179: uint8(_BT_TRAIL),
  17494. 180: uint8(_BT_TRAIL),
  17495. 181: uint8(_BT_TRAIL),
  17496. 182: uint8(_BT_TRAIL),
  17497. 183: uint8(_BT_TRAIL),
  17498. 184: uint8(_BT_TRAIL),
  17499. 185: uint8(_BT_TRAIL),
  17500. 186: uint8(_BT_TRAIL),
  17501. 187: uint8(_BT_TRAIL),
  17502. 188: uint8(_BT_TRAIL),
  17503. 189: uint8(_BT_TRAIL),
  17504. 190: uint8(_BT_TRAIL),
  17505. 191: uint8(_BT_TRAIL),
  17506. 192: uint8(_BT_LEAD2),
  17507. 193: uint8(_BT_LEAD2),
  17508. 194: uint8(_BT_LEAD2),
  17509. 195: uint8(_BT_LEAD2),
  17510. 196: uint8(_BT_LEAD2),
  17511. 197: uint8(_BT_LEAD2),
  17512. 198: uint8(_BT_LEAD2),
  17513. 199: uint8(_BT_LEAD2),
  17514. 200: uint8(_BT_LEAD2),
  17515. 201: uint8(_BT_LEAD2),
  17516. 202: uint8(_BT_LEAD2),
  17517. 203: uint8(_BT_LEAD2),
  17518. 204: uint8(_BT_LEAD2),
  17519. 205: uint8(_BT_LEAD2),
  17520. 206: uint8(_BT_LEAD2),
  17521. 207: uint8(_BT_LEAD2),
  17522. 208: uint8(_BT_LEAD2),
  17523. 209: uint8(_BT_LEAD2),
  17524. 210: uint8(_BT_LEAD2),
  17525. 211: uint8(_BT_LEAD2),
  17526. 212: uint8(_BT_LEAD2),
  17527. 213: uint8(_BT_LEAD2),
  17528. 214: uint8(_BT_LEAD2),
  17529. 215: uint8(_BT_LEAD2),
  17530. 216: uint8(_BT_LEAD2),
  17531. 217: uint8(_BT_LEAD2),
  17532. 218: uint8(_BT_LEAD2),
  17533. 219: uint8(_BT_LEAD2),
  17534. 220: uint8(_BT_LEAD2),
  17535. 221: uint8(_BT_LEAD2),
  17536. 222: uint8(_BT_LEAD2),
  17537. 223: uint8(_BT_LEAD2),
  17538. 224: uint8(_BT_LEAD3),
  17539. 225: uint8(_BT_LEAD3),
  17540. 226: uint8(_BT_LEAD3),
  17541. 227: uint8(_BT_LEAD3),
  17542. 228: uint8(_BT_LEAD3),
  17543. 229: uint8(_BT_LEAD3),
  17544. 230: uint8(_BT_LEAD3),
  17545. 231: uint8(_BT_LEAD3),
  17546. 232: uint8(_BT_LEAD3),
  17547. 233: uint8(_BT_LEAD3),
  17548. 234: uint8(_BT_LEAD3),
  17549. 235: uint8(_BT_LEAD3),
  17550. 236: uint8(_BT_LEAD3),
  17551. 237: uint8(_BT_LEAD3),
  17552. 238: uint8(_BT_LEAD3),
  17553. 239: uint8(_BT_LEAD3),
  17554. 240: uint8(_BT_LEAD4),
  17555. 241: uint8(_BT_LEAD4),
  17556. 242: uint8(_BT_LEAD4),
  17557. 243: uint8(_BT_LEAD4),
  17558. 244: uint8(_BT_LEAD4),
  17559. 254: uint8(_BT_MALFORM),
  17560. 255: uint8(_BT_MALFORM),
  17561. },
  17562. }
  17563. func init() {
  17564. p := unsafe.Pointer(&_internal_utf8_encoding)
  17565. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  17566. *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_normal_contentTok)
  17567. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_cdataSectionTok)
  17568. *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_normal_ignoreSectionTok)
  17569. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_attributeValueTok)
  17570. *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_normal_entityValueTok)
  17571. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_nameMatchesAscii)
  17572. *(*uintptr)(unsafe.Add(p, 28)) = __ccgo_fp(_normal_nameLength)
  17573. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_skipS)
  17574. *(*uintptr)(unsafe.Add(p, 36)) = __ccgo_fp(_normal_getAtts)
  17575. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_charRefNumber)
  17576. *(*uintptr)(unsafe.Add(p, 44)) = __ccgo_fp(_normal_predefinedEntityName)
  17577. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_updatePosition)
  17578. *(*uintptr)(unsafe.Add(p, 52)) = __ccgo_fp(_normal_isPublicId)
  17579. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_utf8_toUtf8)
  17580. *(*uintptr)(unsafe.Add(p, 60)) = __ccgo_fp(_utf8_toUtf16)
  17581. *(*uintptr)(unsafe.Add(p, 328)) = __ccgo_fp(_utf8_isName2)
  17582. *(*uintptr)(unsafe.Add(p, 332)) = __ccgo_fp(_utf8_isName3)
  17583. *(*uintptr)(unsafe.Add(p, 336)) = __ccgo_fp(_isNever)
  17584. *(*uintptr)(unsafe.Add(p, 340)) = __ccgo_fp(_utf8_isNmstrt2)
  17585. *(*uintptr)(unsafe.Add(p, 344)) = __ccgo_fp(_utf8_isNmstrt3)
  17586. *(*uintptr)(unsafe.Add(p, 348)) = __ccgo_fp(_isNever)
  17587. *(*uintptr)(unsafe.Add(p, 352)) = __ccgo_fp(_utf8_isInvalid2)
  17588. *(*uintptr)(unsafe.Add(p, 356)) = __ccgo_fp(_utf8_isInvalid3)
  17589. *(*uintptr)(unsafe.Add(p, 360)) = __ccgo_fp(_utf8_isInvalid4)
  17590. }
  17591. func _latin1_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  17592. var c uint8
  17593. var v2, v3, v4, v5, v6, v7, v8, v9 uintptr
  17594. _, _, _, _, _, _, _, _, _ = c, v2, v3, v4, v5, v6, v7, v8, v9
  17595. _ = enc
  17596. for {
  17597. if *(*uintptr)(unsafe.Pointer(fromP)) == fromLim {
  17598. return int32(_XML_CONVERT_COMPLETED)
  17599. }
  17600. c = *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP))))
  17601. if libc.Int32FromUint8(c)&int32(0x80) != 0 {
  17602. if int32(toLim)-int32(*(*uintptr)(unsafe.Pointer(toP))) < int32(2) {
  17603. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  17604. }
  17605. v3 = toP
  17606. v2 = *(*uintptr)(unsafe.Pointer(v3))
  17607. *(*uintptr)(unsafe.Pointer(v3))++
  17608. *(*uint8)(unsafe.Pointer(v2)) = libc.Uint8FromInt32(libc.Int32FromUint8(c)>>libc.Int32FromInt32(6) | int32(_UTF8_cval2))
  17609. v5 = toP
  17610. v4 = *(*uintptr)(unsafe.Pointer(v5))
  17611. *(*uintptr)(unsafe.Pointer(v5))++
  17612. *(*uint8)(unsafe.Pointer(v4)) = libc.Uint8FromInt32(libc.Int32FromUint8(c)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  17613. *(*uintptr)(unsafe.Pointer(fromP))++
  17614. } else {
  17615. if *(*uintptr)(unsafe.Pointer(toP)) == toLim {
  17616. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  17617. }
  17618. v7 = toP
  17619. v6 = *(*uintptr)(unsafe.Pointer(v7))
  17620. *(*uintptr)(unsafe.Pointer(v7))++
  17621. v9 = fromP
  17622. v8 = *(*uintptr)(unsafe.Pointer(v9))
  17623. *(*uintptr)(unsafe.Pointer(v9))++
  17624. *(*uint8)(unsafe.Pointer(v6)) = *(*uint8)(unsafe.Pointer(v8))
  17625. }
  17626. goto _1
  17627. _1:
  17628. }
  17629. return r
  17630. }
  17631. func _latin1_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  17632. var v1, v2, v3, v4 uintptr
  17633. _, _, _, _ = v1, v2, v3, v4
  17634. _ = enc
  17635. for *(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim {
  17636. v2 = toP
  17637. v1 = *(*uintptr)(unsafe.Pointer(v2))
  17638. *(*uintptr)(unsafe.Pointer(v2)) += 2
  17639. v4 = fromP
  17640. v3 = *(*uintptr)(unsafe.Pointer(v4))
  17641. *(*uintptr)(unsafe.Pointer(v4))++
  17642. *(*uint16)(unsafe.Pointer(v1)) = uint16(*(*uint8)(unsafe.Pointer(v3)))
  17643. }
  17644. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  17645. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  17646. } else {
  17647. return int32(_XML_CONVERT_COMPLETED)
  17648. }
  17649. return r
  17650. }
  17651. var _latin1_encoding_ns = Tnormal_encoding{
  17652. Fenc: TENCODING{
  17653. Fscanners: [4]TSCANNER{},
  17654. FliteralScanners: [2]TSCANNER{},
  17655. FminBytesPerChar: int32(1),
  17656. },
  17657. Ftype1: [256]uint8{
  17658. 9: uint8(_BT_S),
  17659. 10: uint8(_BT_LF),
  17660. 13: uint8(_BT_CR),
  17661. 32: uint8(_BT_S),
  17662. 33: uint8(_BT_EXCL),
  17663. 34: uint8(_BT_QUOT),
  17664. 35: uint8(_BT_NUM),
  17665. 36: uint8(_BT_OTHER),
  17666. 37: uint8(_BT_PERCNT),
  17667. 38: uint8(_BT_AMP),
  17668. 39: uint8(_BT_APOS),
  17669. 40: uint8(_BT_LPAR),
  17670. 41: uint8(_BT_RPAR),
  17671. 42: uint8(_BT_AST),
  17672. 43: uint8(_BT_PLUS),
  17673. 44: uint8(_BT_COMMA),
  17674. 45: uint8(_BT_MINUS),
  17675. 46: uint8(_BT_NAME),
  17676. 47: uint8(_BT_SOL),
  17677. 48: uint8(_BT_DIGIT),
  17678. 49: uint8(_BT_DIGIT),
  17679. 50: uint8(_BT_DIGIT),
  17680. 51: uint8(_BT_DIGIT),
  17681. 52: uint8(_BT_DIGIT),
  17682. 53: uint8(_BT_DIGIT),
  17683. 54: uint8(_BT_DIGIT),
  17684. 55: uint8(_BT_DIGIT),
  17685. 56: uint8(_BT_DIGIT),
  17686. 57: uint8(_BT_DIGIT),
  17687. 58: uint8(_BT_COLON),
  17688. 59: uint8(_BT_SEMI),
  17689. 60: uint8(_BT_LT),
  17690. 61: uint8(_BT_EQUALS),
  17691. 62: uint8(_BT_GT),
  17692. 63: uint8(_BT_QUEST),
  17693. 64: uint8(_BT_OTHER),
  17694. 65: uint8(_BT_HEX),
  17695. 66: uint8(_BT_HEX),
  17696. 67: uint8(_BT_HEX),
  17697. 68: uint8(_BT_HEX),
  17698. 69: uint8(_BT_HEX),
  17699. 70: uint8(_BT_HEX),
  17700. 71: uint8(_BT_NMSTRT),
  17701. 72: uint8(_BT_NMSTRT),
  17702. 73: uint8(_BT_NMSTRT),
  17703. 74: uint8(_BT_NMSTRT),
  17704. 75: uint8(_BT_NMSTRT),
  17705. 76: uint8(_BT_NMSTRT),
  17706. 77: uint8(_BT_NMSTRT),
  17707. 78: uint8(_BT_NMSTRT),
  17708. 79: uint8(_BT_NMSTRT),
  17709. 80: uint8(_BT_NMSTRT),
  17710. 81: uint8(_BT_NMSTRT),
  17711. 82: uint8(_BT_NMSTRT),
  17712. 83: uint8(_BT_NMSTRT),
  17713. 84: uint8(_BT_NMSTRT),
  17714. 85: uint8(_BT_NMSTRT),
  17715. 86: uint8(_BT_NMSTRT),
  17716. 87: uint8(_BT_NMSTRT),
  17717. 88: uint8(_BT_NMSTRT),
  17718. 89: uint8(_BT_NMSTRT),
  17719. 90: uint8(_BT_NMSTRT),
  17720. 91: uint8(_BT_LSQB),
  17721. 92: uint8(_BT_OTHER),
  17722. 93: uint8(_BT_RSQB),
  17723. 94: uint8(_BT_OTHER),
  17724. 95: uint8(_BT_NMSTRT),
  17725. 96: uint8(_BT_OTHER),
  17726. 97: uint8(_BT_HEX),
  17727. 98: uint8(_BT_HEX),
  17728. 99: uint8(_BT_HEX),
  17729. 100: uint8(_BT_HEX),
  17730. 101: uint8(_BT_HEX),
  17731. 102: uint8(_BT_HEX),
  17732. 103: uint8(_BT_NMSTRT),
  17733. 104: uint8(_BT_NMSTRT),
  17734. 105: uint8(_BT_NMSTRT),
  17735. 106: uint8(_BT_NMSTRT),
  17736. 107: uint8(_BT_NMSTRT),
  17737. 108: uint8(_BT_NMSTRT),
  17738. 109: uint8(_BT_NMSTRT),
  17739. 110: uint8(_BT_NMSTRT),
  17740. 111: uint8(_BT_NMSTRT),
  17741. 112: uint8(_BT_NMSTRT),
  17742. 113: uint8(_BT_NMSTRT),
  17743. 114: uint8(_BT_NMSTRT),
  17744. 115: uint8(_BT_NMSTRT),
  17745. 116: uint8(_BT_NMSTRT),
  17746. 117: uint8(_BT_NMSTRT),
  17747. 118: uint8(_BT_NMSTRT),
  17748. 119: uint8(_BT_NMSTRT),
  17749. 120: uint8(_BT_NMSTRT),
  17750. 121: uint8(_BT_NMSTRT),
  17751. 122: uint8(_BT_NMSTRT),
  17752. 123: uint8(_BT_OTHER),
  17753. 124: uint8(_BT_VERBAR),
  17754. 125: uint8(_BT_OTHER),
  17755. 126: uint8(_BT_OTHER),
  17756. 127: uint8(_BT_OTHER),
  17757. 128: uint8(_BT_OTHER),
  17758. 129: uint8(_BT_OTHER),
  17759. 130: uint8(_BT_OTHER),
  17760. 131: uint8(_BT_OTHER),
  17761. 132: uint8(_BT_OTHER),
  17762. 133: uint8(_BT_OTHER),
  17763. 134: uint8(_BT_OTHER),
  17764. 135: uint8(_BT_OTHER),
  17765. 136: uint8(_BT_OTHER),
  17766. 137: uint8(_BT_OTHER),
  17767. 138: uint8(_BT_OTHER),
  17768. 139: uint8(_BT_OTHER),
  17769. 140: uint8(_BT_OTHER),
  17770. 141: uint8(_BT_OTHER),
  17771. 142: uint8(_BT_OTHER),
  17772. 143: uint8(_BT_OTHER),
  17773. 144: uint8(_BT_OTHER),
  17774. 145: uint8(_BT_OTHER),
  17775. 146: uint8(_BT_OTHER),
  17776. 147: uint8(_BT_OTHER),
  17777. 148: uint8(_BT_OTHER),
  17778. 149: uint8(_BT_OTHER),
  17779. 150: uint8(_BT_OTHER),
  17780. 151: uint8(_BT_OTHER),
  17781. 152: uint8(_BT_OTHER),
  17782. 153: uint8(_BT_OTHER),
  17783. 154: uint8(_BT_OTHER),
  17784. 155: uint8(_BT_OTHER),
  17785. 156: uint8(_BT_OTHER),
  17786. 157: uint8(_BT_OTHER),
  17787. 158: uint8(_BT_OTHER),
  17788. 159: uint8(_BT_OTHER),
  17789. 160: uint8(_BT_OTHER),
  17790. 161: uint8(_BT_OTHER),
  17791. 162: uint8(_BT_OTHER),
  17792. 163: uint8(_BT_OTHER),
  17793. 164: uint8(_BT_OTHER),
  17794. 165: uint8(_BT_OTHER),
  17795. 166: uint8(_BT_OTHER),
  17796. 167: uint8(_BT_OTHER),
  17797. 168: uint8(_BT_OTHER),
  17798. 169: uint8(_BT_OTHER),
  17799. 170: uint8(_BT_NMSTRT),
  17800. 171: uint8(_BT_OTHER),
  17801. 172: uint8(_BT_OTHER),
  17802. 173: uint8(_BT_OTHER),
  17803. 174: uint8(_BT_OTHER),
  17804. 175: uint8(_BT_OTHER),
  17805. 176: uint8(_BT_OTHER),
  17806. 177: uint8(_BT_OTHER),
  17807. 178: uint8(_BT_OTHER),
  17808. 179: uint8(_BT_OTHER),
  17809. 180: uint8(_BT_OTHER),
  17810. 181: uint8(_BT_NMSTRT),
  17811. 182: uint8(_BT_OTHER),
  17812. 183: uint8(_BT_NAME),
  17813. 184: uint8(_BT_OTHER),
  17814. 185: uint8(_BT_OTHER),
  17815. 186: uint8(_BT_NMSTRT),
  17816. 187: uint8(_BT_OTHER),
  17817. 188: uint8(_BT_OTHER),
  17818. 189: uint8(_BT_OTHER),
  17819. 190: uint8(_BT_OTHER),
  17820. 191: uint8(_BT_OTHER),
  17821. 192: uint8(_BT_NMSTRT),
  17822. 193: uint8(_BT_NMSTRT),
  17823. 194: uint8(_BT_NMSTRT),
  17824. 195: uint8(_BT_NMSTRT),
  17825. 196: uint8(_BT_NMSTRT),
  17826. 197: uint8(_BT_NMSTRT),
  17827. 198: uint8(_BT_NMSTRT),
  17828. 199: uint8(_BT_NMSTRT),
  17829. 200: uint8(_BT_NMSTRT),
  17830. 201: uint8(_BT_NMSTRT),
  17831. 202: uint8(_BT_NMSTRT),
  17832. 203: uint8(_BT_NMSTRT),
  17833. 204: uint8(_BT_NMSTRT),
  17834. 205: uint8(_BT_NMSTRT),
  17835. 206: uint8(_BT_NMSTRT),
  17836. 207: uint8(_BT_NMSTRT),
  17837. 208: uint8(_BT_NMSTRT),
  17838. 209: uint8(_BT_NMSTRT),
  17839. 210: uint8(_BT_NMSTRT),
  17840. 211: uint8(_BT_NMSTRT),
  17841. 212: uint8(_BT_NMSTRT),
  17842. 213: uint8(_BT_NMSTRT),
  17843. 214: uint8(_BT_NMSTRT),
  17844. 215: uint8(_BT_OTHER),
  17845. 216: uint8(_BT_NMSTRT),
  17846. 217: uint8(_BT_NMSTRT),
  17847. 218: uint8(_BT_NMSTRT),
  17848. 219: uint8(_BT_NMSTRT),
  17849. 220: uint8(_BT_NMSTRT),
  17850. 221: uint8(_BT_NMSTRT),
  17851. 222: uint8(_BT_NMSTRT),
  17852. 223: uint8(_BT_NMSTRT),
  17853. 224: uint8(_BT_NMSTRT),
  17854. 225: uint8(_BT_NMSTRT),
  17855. 226: uint8(_BT_NMSTRT),
  17856. 227: uint8(_BT_NMSTRT),
  17857. 228: uint8(_BT_NMSTRT),
  17858. 229: uint8(_BT_NMSTRT),
  17859. 230: uint8(_BT_NMSTRT),
  17860. 231: uint8(_BT_NMSTRT),
  17861. 232: uint8(_BT_NMSTRT),
  17862. 233: uint8(_BT_NMSTRT),
  17863. 234: uint8(_BT_NMSTRT),
  17864. 235: uint8(_BT_NMSTRT),
  17865. 236: uint8(_BT_NMSTRT),
  17866. 237: uint8(_BT_NMSTRT),
  17867. 238: uint8(_BT_NMSTRT),
  17868. 239: uint8(_BT_NMSTRT),
  17869. 240: uint8(_BT_NMSTRT),
  17870. 241: uint8(_BT_NMSTRT),
  17871. 242: uint8(_BT_NMSTRT),
  17872. 243: uint8(_BT_NMSTRT),
  17873. 244: uint8(_BT_NMSTRT),
  17874. 245: uint8(_BT_NMSTRT),
  17875. 246: uint8(_BT_NMSTRT),
  17876. 247: uint8(_BT_OTHER),
  17877. 248: uint8(_BT_NMSTRT),
  17878. 249: uint8(_BT_NMSTRT),
  17879. 250: uint8(_BT_NMSTRT),
  17880. 251: uint8(_BT_NMSTRT),
  17881. 252: uint8(_BT_NMSTRT),
  17882. 253: uint8(_BT_NMSTRT),
  17883. 254: uint8(_BT_NMSTRT),
  17884. 255: uint8(_BT_NMSTRT),
  17885. },
  17886. }
  17887. func init() {
  17888. p := unsafe.Pointer(&_latin1_encoding_ns)
  17889. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  17890. *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_normal_contentTok)
  17891. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_cdataSectionTok)
  17892. *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_normal_ignoreSectionTok)
  17893. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_attributeValueTok)
  17894. *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_normal_entityValueTok)
  17895. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_nameMatchesAscii)
  17896. *(*uintptr)(unsafe.Add(p, 28)) = __ccgo_fp(_normal_nameLength)
  17897. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_skipS)
  17898. *(*uintptr)(unsafe.Add(p, 36)) = __ccgo_fp(_normal_getAtts)
  17899. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_charRefNumber)
  17900. *(*uintptr)(unsafe.Add(p, 44)) = __ccgo_fp(_normal_predefinedEntityName)
  17901. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_updatePosition)
  17902. *(*uintptr)(unsafe.Add(p, 52)) = __ccgo_fp(_normal_isPublicId)
  17903. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_latin1_toUtf8)
  17904. *(*uintptr)(unsafe.Add(p, 60)) = __ccgo_fp(_latin1_toUtf16)
  17905. }
  17906. var _latin1_encoding = Tnormal_encoding{
  17907. Fenc: TENCODING{
  17908. Fscanners: [4]TSCANNER{},
  17909. FliteralScanners: [2]TSCANNER{},
  17910. FminBytesPerChar: int32(1),
  17911. },
  17912. Ftype1: [256]uint8{
  17913. 9: uint8(_BT_S),
  17914. 10: uint8(_BT_LF),
  17915. 13: uint8(_BT_CR),
  17916. 32: uint8(_BT_S),
  17917. 33: uint8(_BT_EXCL),
  17918. 34: uint8(_BT_QUOT),
  17919. 35: uint8(_BT_NUM),
  17920. 36: uint8(_BT_OTHER),
  17921. 37: uint8(_BT_PERCNT),
  17922. 38: uint8(_BT_AMP),
  17923. 39: uint8(_BT_APOS),
  17924. 40: uint8(_BT_LPAR),
  17925. 41: uint8(_BT_RPAR),
  17926. 42: uint8(_BT_AST),
  17927. 43: uint8(_BT_PLUS),
  17928. 44: uint8(_BT_COMMA),
  17929. 45: uint8(_BT_MINUS),
  17930. 46: uint8(_BT_NAME),
  17931. 47: uint8(_BT_SOL),
  17932. 48: uint8(_BT_DIGIT),
  17933. 49: uint8(_BT_DIGIT),
  17934. 50: uint8(_BT_DIGIT),
  17935. 51: uint8(_BT_DIGIT),
  17936. 52: uint8(_BT_DIGIT),
  17937. 53: uint8(_BT_DIGIT),
  17938. 54: uint8(_BT_DIGIT),
  17939. 55: uint8(_BT_DIGIT),
  17940. 56: uint8(_BT_DIGIT),
  17941. 57: uint8(_BT_DIGIT),
  17942. 58: uint8(_BT_NMSTRT),
  17943. 59: uint8(_BT_SEMI),
  17944. 60: uint8(_BT_LT),
  17945. 61: uint8(_BT_EQUALS),
  17946. 62: uint8(_BT_GT),
  17947. 63: uint8(_BT_QUEST),
  17948. 64: uint8(_BT_OTHER),
  17949. 65: uint8(_BT_HEX),
  17950. 66: uint8(_BT_HEX),
  17951. 67: uint8(_BT_HEX),
  17952. 68: uint8(_BT_HEX),
  17953. 69: uint8(_BT_HEX),
  17954. 70: uint8(_BT_HEX),
  17955. 71: uint8(_BT_NMSTRT),
  17956. 72: uint8(_BT_NMSTRT),
  17957. 73: uint8(_BT_NMSTRT),
  17958. 74: uint8(_BT_NMSTRT),
  17959. 75: uint8(_BT_NMSTRT),
  17960. 76: uint8(_BT_NMSTRT),
  17961. 77: uint8(_BT_NMSTRT),
  17962. 78: uint8(_BT_NMSTRT),
  17963. 79: uint8(_BT_NMSTRT),
  17964. 80: uint8(_BT_NMSTRT),
  17965. 81: uint8(_BT_NMSTRT),
  17966. 82: uint8(_BT_NMSTRT),
  17967. 83: uint8(_BT_NMSTRT),
  17968. 84: uint8(_BT_NMSTRT),
  17969. 85: uint8(_BT_NMSTRT),
  17970. 86: uint8(_BT_NMSTRT),
  17971. 87: uint8(_BT_NMSTRT),
  17972. 88: uint8(_BT_NMSTRT),
  17973. 89: uint8(_BT_NMSTRT),
  17974. 90: uint8(_BT_NMSTRT),
  17975. 91: uint8(_BT_LSQB),
  17976. 92: uint8(_BT_OTHER),
  17977. 93: uint8(_BT_RSQB),
  17978. 94: uint8(_BT_OTHER),
  17979. 95: uint8(_BT_NMSTRT),
  17980. 96: uint8(_BT_OTHER),
  17981. 97: uint8(_BT_HEX),
  17982. 98: uint8(_BT_HEX),
  17983. 99: uint8(_BT_HEX),
  17984. 100: uint8(_BT_HEX),
  17985. 101: uint8(_BT_HEX),
  17986. 102: uint8(_BT_HEX),
  17987. 103: uint8(_BT_NMSTRT),
  17988. 104: uint8(_BT_NMSTRT),
  17989. 105: uint8(_BT_NMSTRT),
  17990. 106: uint8(_BT_NMSTRT),
  17991. 107: uint8(_BT_NMSTRT),
  17992. 108: uint8(_BT_NMSTRT),
  17993. 109: uint8(_BT_NMSTRT),
  17994. 110: uint8(_BT_NMSTRT),
  17995. 111: uint8(_BT_NMSTRT),
  17996. 112: uint8(_BT_NMSTRT),
  17997. 113: uint8(_BT_NMSTRT),
  17998. 114: uint8(_BT_NMSTRT),
  17999. 115: uint8(_BT_NMSTRT),
  18000. 116: uint8(_BT_NMSTRT),
  18001. 117: uint8(_BT_NMSTRT),
  18002. 118: uint8(_BT_NMSTRT),
  18003. 119: uint8(_BT_NMSTRT),
  18004. 120: uint8(_BT_NMSTRT),
  18005. 121: uint8(_BT_NMSTRT),
  18006. 122: uint8(_BT_NMSTRT),
  18007. 123: uint8(_BT_OTHER),
  18008. 124: uint8(_BT_VERBAR),
  18009. 125: uint8(_BT_OTHER),
  18010. 126: uint8(_BT_OTHER),
  18011. 127: uint8(_BT_OTHER),
  18012. 128: uint8(_BT_OTHER),
  18013. 129: uint8(_BT_OTHER),
  18014. 130: uint8(_BT_OTHER),
  18015. 131: uint8(_BT_OTHER),
  18016. 132: uint8(_BT_OTHER),
  18017. 133: uint8(_BT_OTHER),
  18018. 134: uint8(_BT_OTHER),
  18019. 135: uint8(_BT_OTHER),
  18020. 136: uint8(_BT_OTHER),
  18021. 137: uint8(_BT_OTHER),
  18022. 138: uint8(_BT_OTHER),
  18023. 139: uint8(_BT_OTHER),
  18024. 140: uint8(_BT_OTHER),
  18025. 141: uint8(_BT_OTHER),
  18026. 142: uint8(_BT_OTHER),
  18027. 143: uint8(_BT_OTHER),
  18028. 144: uint8(_BT_OTHER),
  18029. 145: uint8(_BT_OTHER),
  18030. 146: uint8(_BT_OTHER),
  18031. 147: uint8(_BT_OTHER),
  18032. 148: uint8(_BT_OTHER),
  18033. 149: uint8(_BT_OTHER),
  18034. 150: uint8(_BT_OTHER),
  18035. 151: uint8(_BT_OTHER),
  18036. 152: uint8(_BT_OTHER),
  18037. 153: uint8(_BT_OTHER),
  18038. 154: uint8(_BT_OTHER),
  18039. 155: uint8(_BT_OTHER),
  18040. 156: uint8(_BT_OTHER),
  18041. 157: uint8(_BT_OTHER),
  18042. 158: uint8(_BT_OTHER),
  18043. 159: uint8(_BT_OTHER),
  18044. 160: uint8(_BT_OTHER),
  18045. 161: uint8(_BT_OTHER),
  18046. 162: uint8(_BT_OTHER),
  18047. 163: uint8(_BT_OTHER),
  18048. 164: uint8(_BT_OTHER),
  18049. 165: uint8(_BT_OTHER),
  18050. 166: uint8(_BT_OTHER),
  18051. 167: uint8(_BT_OTHER),
  18052. 168: uint8(_BT_OTHER),
  18053. 169: uint8(_BT_OTHER),
  18054. 170: uint8(_BT_NMSTRT),
  18055. 171: uint8(_BT_OTHER),
  18056. 172: uint8(_BT_OTHER),
  18057. 173: uint8(_BT_OTHER),
  18058. 174: uint8(_BT_OTHER),
  18059. 175: uint8(_BT_OTHER),
  18060. 176: uint8(_BT_OTHER),
  18061. 177: uint8(_BT_OTHER),
  18062. 178: uint8(_BT_OTHER),
  18063. 179: uint8(_BT_OTHER),
  18064. 180: uint8(_BT_OTHER),
  18065. 181: uint8(_BT_NMSTRT),
  18066. 182: uint8(_BT_OTHER),
  18067. 183: uint8(_BT_NAME),
  18068. 184: uint8(_BT_OTHER),
  18069. 185: uint8(_BT_OTHER),
  18070. 186: uint8(_BT_NMSTRT),
  18071. 187: uint8(_BT_OTHER),
  18072. 188: uint8(_BT_OTHER),
  18073. 189: uint8(_BT_OTHER),
  18074. 190: uint8(_BT_OTHER),
  18075. 191: uint8(_BT_OTHER),
  18076. 192: uint8(_BT_NMSTRT),
  18077. 193: uint8(_BT_NMSTRT),
  18078. 194: uint8(_BT_NMSTRT),
  18079. 195: uint8(_BT_NMSTRT),
  18080. 196: uint8(_BT_NMSTRT),
  18081. 197: uint8(_BT_NMSTRT),
  18082. 198: uint8(_BT_NMSTRT),
  18083. 199: uint8(_BT_NMSTRT),
  18084. 200: uint8(_BT_NMSTRT),
  18085. 201: uint8(_BT_NMSTRT),
  18086. 202: uint8(_BT_NMSTRT),
  18087. 203: uint8(_BT_NMSTRT),
  18088. 204: uint8(_BT_NMSTRT),
  18089. 205: uint8(_BT_NMSTRT),
  18090. 206: uint8(_BT_NMSTRT),
  18091. 207: uint8(_BT_NMSTRT),
  18092. 208: uint8(_BT_NMSTRT),
  18093. 209: uint8(_BT_NMSTRT),
  18094. 210: uint8(_BT_NMSTRT),
  18095. 211: uint8(_BT_NMSTRT),
  18096. 212: uint8(_BT_NMSTRT),
  18097. 213: uint8(_BT_NMSTRT),
  18098. 214: uint8(_BT_NMSTRT),
  18099. 215: uint8(_BT_OTHER),
  18100. 216: uint8(_BT_NMSTRT),
  18101. 217: uint8(_BT_NMSTRT),
  18102. 218: uint8(_BT_NMSTRT),
  18103. 219: uint8(_BT_NMSTRT),
  18104. 220: uint8(_BT_NMSTRT),
  18105. 221: uint8(_BT_NMSTRT),
  18106. 222: uint8(_BT_NMSTRT),
  18107. 223: uint8(_BT_NMSTRT),
  18108. 224: uint8(_BT_NMSTRT),
  18109. 225: uint8(_BT_NMSTRT),
  18110. 226: uint8(_BT_NMSTRT),
  18111. 227: uint8(_BT_NMSTRT),
  18112. 228: uint8(_BT_NMSTRT),
  18113. 229: uint8(_BT_NMSTRT),
  18114. 230: uint8(_BT_NMSTRT),
  18115. 231: uint8(_BT_NMSTRT),
  18116. 232: uint8(_BT_NMSTRT),
  18117. 233: uint8(_BT_NMSTRT),
  18118. 234: uint8(_BT_NMSTRT),
  18119. 235: uint8(_BT_NMSTRT),
  18120. 236: uint8(_BT_NMSTRT),
  18121. 237: uint8(_BT_NMSTRT),
  18122. 238: uint8(_BT_NMSTRT),
  18123. 239: uint8(_BT_NMSTRT),
  18124. 240: uint8(_BT_NMSTRT),
  18125. 241: uint8(_BT_NMSTRT),
  18126. 242: uint8(_BT_NMSTRT),
  18127. 243: uint8(_BT_NMSTRT),
  18128. 244: uint8(_BT_NMSTRT),
  18129. 245: uint8(_BT_NMSTRT),
  18130. 246: uint8(_BT_NMSTRT),
  18131. 247: uint8(_BT_OTHER),
  18132. 248: uint8(_BT_NMSTRT),
  18133. 249: uint8(_BT_NMSTRT),
  18134. 250: uint8(_BT_NMSTRT),
  18135. 251: uint8(_BT_NMSTRT),
  18136. 252: uint8(_BT_NMSTRT),
  18137. 253: uint8(_BT_NMSTRT),
  18138. 254: uint8(_BT_NMSTRT),
  18139. 255: uint8(_BT_NMSTRT),
  18140. },
  18141. }
  18142. func init() {
  18143. p := unsafe.Pointer(&_latin1_encoding)
  18144. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  18145. *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_normal_contentTok)
  18146. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_cdataSectionTok)
  18147. *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_normal_ignoreSectionTok)
  18148. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_attributeValueTok)
  18149. *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_normal_entityValueTok)
  18150. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_nameMatchesAscii)
  18151. *(*uintptr)(unsafe.Add(p, 28)) = __ccgo_fp(_normal_nameLength)
  18152. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_skipS)
  18153. *(*uintptr)(unsafe.Add(p, 36)) = __ccgo_fp(_normal_getAtts)
  18154. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_charRefNumber)
  18155. *(*uintptr)(unsafe.Add(p, 44)) = __ccgo_fp(_normal_predefinedEntityName)
  18156. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_updatePosition)
  18157. *(*uintptr)(unsafe.Add(p, 52)) = __ccgo_fp(_normal_isPublicId)
  18158. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_latin1_toUtf8)
  18159. *(*uintptr)(unsafe.Add(p, 60)) = __ccgo_fp(_latin1_toUtf16)
  18160. }
  18161. func _ascii_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18162. var v1, v2, v3, v4 uintptr
  18163. _, _, _, _ = v1, v2, v3, v4
  18164. _ = enc
  18165. for *(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim {
  18166. v2 = toP
  18167. v1 = *(*uintptr)(unsafe.Pointer(v2))
  18168. *(*uintptr)(unsafe.Pointer(v2))++
  18169. v4 = fromP
  18170. v3 = *(*uintptr)(unsafe.Pointer(v4))
  18171. *(*uintptr)(unsafe.Pointer(v4))++
  18172. *(*uint8)(unsafe.Pointer(v1)) = *(*uint8)(unsafe.Pointer(v3))
  18173. }
  18174. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  18175. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18176. } else {
  18177. return int32(_XML_CONVERT_COMPLETED)
  18178. }
  18179. return r
  18180. }
  18181. var _ascii_encoding_ns = Tnormal_encoding{
  18182. Fenc: TENCODING{
  18183. Fscanners: [4]TSCANNER{},
  18184. FliteralScanners: [2]TSCANNER{},
  18185. FminBytesPerChar: int32(1),
  18186. FisUtf8: uint8(1),
  18187. },
  18188. Ftype1: [256]uint8{
  18189. 9: uint8(_BT_S),
  18190. 10: uint8(_BT_LF),
  18191. 13: uint8(_BT_CR),
  18192. 32: uint8(_BT_S),
  18193. 33: uint8(_BT_EXCL),
  18194. 34: uint8(_BT_QUOT),
  18195. 35: uint8(_BT_NUM),
  18196. 36: uint8(_BT_OTHER),
  18197. 37: uint8(_BT_PERCNT),
  18198. 38: uint8(_BT_AMP),
  18199. 39: uint8(_BT_APOS),
  18200. 40: uint8(_BT_LPAR),
  18201. 41: uint8(_BT_RPAR),
  18202. 42: uint8(_BT_AST),
  18203. 43: uint8(_BT_PLUS),
  18204. 44: uint8(_BT_COMMA),
  18205. 45: uint8(_BT_MINUS),
  18206. 46: uint8(_BT_NAME),
  18207. 47: uint8(_BT_SOL),
  18208. 48: uint8(_BT_DIGIT),
  18209. 49: uint8(_BT_DIGIT),
  18210. 50: uint8(_BT_DIGIT),
  18211. 51: uint8(_BT_DIGIT),
  18212. 52: uint8(_BT_DIGIT),
  18213. 53: uint8(_BT_DIGIT),
  18214. 54: uint8(_BT_DIGIT),
  18215. 55: uint8(_BT_DIGIT),
  18216. 56: uint8(_BT_DIGIT),
  18217. 57: uint8(_BT_DIGIT),
  18218. 58: uint8(_BT_COLON),
  18219. 59: uint8(_BT_SEMI),
  18220. 60: uint8(_BT_LT),
  18221. 61: uint8(_BT_EQUALS),
  18222. 62: uint8(_BT_GT),
  18223. 63: uint8(_BT_QUEST),
  18224. 64: uint8(_BT_OTHER),
  18225. 65: uint8(_BT_HEX),
  18226. 66: uint8(_BT_HEX),
  18227. 67: uint8(_BT_HEX),
  18228. 68: uint8(_BT_HEX),
  18229. 69: uint8(_BT_HEX),
  18230. 70: uint8(_BT_HEX),
  18231. 71: uint8(_BT_NMSTRT),
  18232. 72: uint8(_BT_NMSTRT),
  18233. 73: uint8(_BT_NMSTRT),
  18234. 74: uint8(_BT_NMSTRT),
  18235. 75: uint8(_BT_NMSTRT),
  18236. 76: uint8(_BT_NMSTRT),
  18237. 77: uint8(_BT_NMSTRT),
  18238. 78: uint8(_BT_NMSTRT),
  18239. 79: uint8(_BT_NMSTRT),
  18240. 80: uint8(_BT_NMSTRT),
  18241. 81: uint8(_BT_NMSTRT),
  18242. 82: uint8(_BT_NMSTRT),
  18243. 83: uint8(_BT_NMSTRT),
  18244. 84: uint8(_BT_NMSTRT),
  18245. 85: uint8(_BT_NMSTRT),
  18246. 86: uint8(_BT_NMSTRT),
  18247. 87: uint8(_BT_NMSTRT),
  18248. 88: uint8(_BT_NMSTRT),
  18249. 89: uint8(_BT_NMSTRT),
  18250. 90: uint8(_BT_NMSTRT),
  18251. 91: uint8(_BT_LSQB),
  18252. 92: uint8(_BT_OTHER),
  18253. 93: uint8(_BT_RSQB),
  18254. 94: uint8(_BT_OTHER),
  18255. 95: uint8(_BT_NMSTRT),
  18256. 96: uint8(_BT_OTHER),
  18257. 97: uint8(_BT_HEX),
  18258. 98: uint8(_BT_HEX),
  18259. 99: uint8(_BT_HEX),
  18260. 100: uint8(_BT_HEX),
  18261. 101: uint8(_BT_HEX),
  18262. 102: uint8(_BT_HEX),
  18263. 103: uint8(_BT_NMSTRT),
  18264. 104: uint8(_BT_NMSTRT),
  18265. 105: uint8(_BT_NMSTRT),
  18266. 106: uint8(_BT_NMSTRT),
  18267. 107: uint8(_BT_NMSTRT),
  18268. 108: uint8(_BT_NMSTRT),
  18269. 109: uint8(_BT_NMSTRT),
  18270. 110: uint8(_BT_NMSTRT),
  18271. 111: uint8(_BT_NMSTRT),
  18272. 112: uint8(_BT_NMSTRT),
  18273. 113: uint8(_BT_NMSTRT),
  18274. 114: uint8(_BT_NMSTRT),
  18275. 115: uint8(_BT_NMSTRT),
  18276. 116: uint8(_BT_NMSTRT),
  18277. 117: uint8(_BT_NMSTRT),
  18278. 118: uint8(_BT_NMSTRT),
  18279. 119: uint8(_BT_NMSTRT),
  18280. 120: uint8(_BT_NMSTRT),
  18281. 121: uint8(_BT_NMSTRT),
  18282. 122: uint8(_BT_NMSTRT),
  18283. 123: uint8(_BT_OTHER),
  18284. 124: uint8(_BT_VERBAR),
  18285. 125: uint8(_BT_OTHER),
  18286. 126: uint8(_BT_OTHER),
  18287. 127: uint8(_BT_OTHER),
  18288. },
  18289. }
  18290. func init() {
  18291. p := unsafe.Pointer(&_ascii_encoding_ns)
  18292. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  18293. *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_normal_contentTok)
  18294. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_cdataSectionTok)
  18295. *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_normal_ignoreSectionTok)
  18296. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_attributeValueTok)
  18297. *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_normal_entityValueTok)
  18298. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_nameMatchesAscii)
  18299. *(*uintptr)(unsafe.Add(p, 28)) = __ccgo_fp(_normal_nameLength)
  18300. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_skipS)
  18301. *(*uintptr)(unsafe.Add(p, 36)) = __ccgo_fp(_normal_getAtts)
  18302. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_charRefNumber)
  18303. *(*uintptr)(unsafe.Add(p, 44)) = __ccgo_fp(_normal_predefinedEntityName)
  18304. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_updatePosition)
  18305. *(*uintptr)(unsafe.Add(p, 52)) = __ccgo_fp(_normal_isPublicId)
  18306. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_ascii_toUtf8)
  18307. *(*uintptr)(unsafe.Add(p, 60)) = __ccgo_fp(_latin1_toUtf16)
  18308. }
  18309. var _ascii_encoding = Tnormal_encoding{
  18310. Fenc: TENCODING{
  18311. Fscanners: [4]TSCANNER{},
  18312. FliteralScanners: [2]TSCANNER{},
  18313. FminBytesPerChar: int32(1),
  18314. FisUtf8: uint8(1),
  18315. },
  18316. Ftype1: [256]uint8{
  18317. 9: uint8(_BT_S),
  18318. 10: uint8(_BT_LF),
  18319. 13: uint8(_BT_CR),
  18320. 32: uint8(_BT_S),
  18321. 33: uint8(_BT_EXCL),
  18322. 34: uint8(_BT_QUOT),
  18323. 35: uint8(_BT_NUM),
  18324. 36: uint8(_BT_OTHER),
  18325. 37: uint8(_BT_PERCNT),
  18326. 38: uint8(_BT_AMP),
  18327. 39: uint8(_BT_APOS),
  18328. 40: uint8(_BT_LPAR),
  18329. 41: uint8(_BT_RPAR),
  18330. 42: uint8(_BT_AST),
  18331. 43: uint8(_BT_PLUS),
  18332. 44: uint8(_BT_COMMA),
  18333. 45: uint8(_BT_MINUS),
  18334. 46: uint8(_BT_NAME),
  18335. 47: uint8(_BT_SOL),
  18336. 48: uint8(_BT_DIGIT),
  18337. 49: uint8(_BT_DIGIT),
  18338. 50: uint8(_BT_DIGIT),
  18339. 51: uint8(_BT_DIGIT),
  18340. 52: uint8(_BT_DIGIT),
  18341. 53: uint8(_BT_DIGIT),
  18342. 54: uint8(_BT_DIGIT),
  18343. 55: uint8(_BT_DIGIT),
  18344. 56: uint8(_BT_DIGIT),
  18345. 57: uint8(_BT_DIGIT),
  18346. 58: uint8(_BT_NMSTRT),
  18347. 59: uint8(_BT_SEMI),
  18348. 60: uint8(_BT_LT),
  18349. 61: uint8(_BT_EQUALS),
  18350. 62: uint8(_BT_GT),
  18351. 63: uint8(_BT_QUEST),
  18352. 64: uint8(_BT_OTHER),
  18353. 65: uint8(_BT_HEX),
  18354. 66: uint8(_BT_HEX),
  18355. 67: uint8(_BT_HEX),
  18356. 68: uint8(_BT_HEX),
  18357. 69: uint8(_BT_HEX),
  18358. 70: uint8(_BT_HEX),
  18359. 71: uint8(_BT_NMSTRT),
  18360. 72: uint8(_BT_NMSTRT),
  18361. 73: uint8(_BT_NMSTRT),
  18362. 74: uint8(_BT_NMSTRT),
  18363. 75: uint8(_BT_NMSTRT),
  18364. 76: uint8(_BT_NMSTRT),
  18365. 77: uint8(_BT_NMSTRT),
  18366. 78: uint8(_BT_NMSTRT),
  18367. 79: uint8(_BT_NMSTRT),
  18368. 80: uint8(_BT_NMSTRT),
  18369. 81: uint8(_BT_NMSTRT),
  18370. 82: uint8(_BT_NMSTRT),
  18371. 83: uint8(_BT_NMSTRT),
  18372. 84: uint8(_BT_NMSTRT),
  18373. 85: uint8(_BT_NMSTRT),
  18374. 86: uint8(_BT_NMSTRT),
  18375. 87: uint8(_BT_NMSTRT),
  18376. 88: uint8(_BT_NMSTRT),
  18377. 89: uint8(_BT_NMSTRT),
  18378. 90: uint8(_BT_NMSTRT),
  18379. 91: uint8(_BT_LSQB),
  18380. 92: uint8(_BT_OTHER),
  18381. 93: uint8(_BT_RSQB),
  18382. 94: uint8(_BT_OTHER),
  18383. 95: uint8(_BT_NMSTRT),
  18384. 96: uint8(_BT_OTHER),
  18385. 97: uint8(_BT_HEX),
  18386. 98: uint8(_BT_HEX),
  18387. 99: uint8(_BT_HEX),
  18388. 100: uint8(_BT_HEX),
  18389. 101: uint8(_BT_HEX),
  18390. 102: uint8(_BT_HEX),
  18391. 103: uint8(_BT_NMSTRT),
  18392. 104: uint8(_BT_NMSTRT),
  18393. 105: uint8(_BT_NMSTRT),
  18394. 106: uint8(_BT_NMSTRT),
  18395. 107: uint8(_BT_NMSTRT),
  18396. 108: uint8(_BT_NMSTRT),
  18397. 109: uint8(_BT_NMSTRT),
  18398. 110: uint8(_BT_NMSTRT),
  18399. 111: uint8(_BT_NMSTRT),
  18400. 112: uint8(_BT_NMSTRT),
  18401. 113: uint8(_BT_NMSTRT),
  18402. 114: uint8(_BT_NMSTRT),
  18403. 115: uint8(_BT_NMSTRT),
  18404. 116: uint8(_BT_NMSTRT),
  18405. 117: uint8(_BT_NMSTRT),
  18406. 118: uint8(_BT_NMSTRT),
  18407. 119: uint8(_BT_NMSTRT),
  18408. 120: uint8(_BT_NMSTRT),
  18409. 121: uint8(_BT_NMSTRT),
  18410. 122: uint8(_BT_NMSTRT),
  18411. 123: uint8(_BT_OTHER),
  18412. 124: uint8(_BT_VERBAR),
  18413. 125: uint8(_BT_OTHER),
  18414. 126: uint8(_BT_OTHER),
  18415. 127: uint8(_BT_OTHER),
  18416. },
  18417. }
  18418. func init() {
  18419. p := unsafe.Pointer(&_ascii_encoding)
  18420. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  18421. *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_normal_contentTok)
  18422. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_cdataSectionTok)
  18423. *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_normal_ignoreSectionTok)
  18424. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_attributeValueTok)
  18425. *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_normal_entityValueTok)
  18426. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_nameMatchesAscii)
  18427. *(*uintptr)(unsafe.Add(p, 28)) = __ccgo_fp(_normal_nameLength)
  18428. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_skipS)
  18429. *(*uintptr)(unsafe.Add(p, 36)) = __ccgo_fp(_normal_getAtts)
  18430. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_charRefNumber)
  18431. *(*uintptr)(unsafe.Add(p, 44)) = __ccgo_fp(_normal_predefinedEntityName)
  18432. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_updatePosition)
  18433. *(*uintptr)(unsafe.Add(p, 52)) = __ccgo_fp(_normal_isPublicId)
  18434. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_ascii_toUtf8)
  18435. *(*uintptr)(unsafe.Add(p, 60)) = __ccgo_fp(_latin1_toUtf16)
  18436. }
  18437. func _unicode_byte_type(tls *libc.TLS, hi uint8, lo uint8) (r int32) {
  18438. switch libc.Int32FromUint8(hi) {
  18439. /* 0xD800-0xDBFF first 16-bit code unit or high surrogate (W1) */
  18440. case int32(0xD8):
  18441. fallthrough
  18442. case int32(0xD9):
  18443. fallthrough
  18444. case int32(0xDA):
  18445. fallthrough
  18446. case int32(0xDB):
  18447. return int32(_BT_LEAD4)
  18448. /* 0xDC00-0xDFFF second 16-bit code unit or low surrogate (W2) */
  18449. fallthrough
  18450. case int32(0xDC):
  18451. fallthrough
  18452. case int32(0xDD):
  18453. fallthrough
  18454. case int32(0xDE):
  18455. fallthrough
  18456. case int32(0xDF):
  18457. return int32(_BT_TRAIL)
  18458. case int32(0xFF):
  18459. switch libc.Int32FromUint8(lo) {
  18460. case int32(0xFF): /* noncharacter-FFFF */
  18461. fallthrough
  18462. case int32(0xFE): /* noncharacter-FFFE */
  18463. return int32(_BT_NONXML)
  18464. }
  18465. break
  18466. }
  18467. return int32(_BT_NONASCII)
  18468. }
  18469. func _little2_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18470. var from, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v3, v4, v5, v6, v7, v8, v9 uintptr
  18471. var hi, lo, lo2 uint8
  18472. var plane int32
  18473. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  18474. from = *(*uintptr)(unsafe.Pointer(fromP))
  18475. _ = enc
  18476. fromLim = from + uintptr((int32(fromLim)-int32(from))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */
  18477. for {
  18478. if !(from < fromLim) {
  18479. break
  18480. }
  18481. lo = *(*uint8)(unsafe.Pointer(from))
  18482. hi = *(*uint8)(unsafe.Pointer(from + 1))
  18483. switch libc.Int32FromUint8(hi) {
  18484. case 0:
  18485. if libc.Int32FromUint8(lo) < int32(0x80) {
  18486. if *(*uintptr)(unsafe.Pointer(toP)) == toLim {
  18487. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18488. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18489. }
  18490. v3 = toP
  18491. v2 = *(*uintptr)(unsafe.Pointer(v3))
  18492. *(*uintptr)(unsafe.Pointer(v3))++
  18493. *(*uint8)(unsafe.Pointer(v2)) = lo
  18494. break
  18495. } /* fall through */
  18496. fallthrough
  18497. case int32(0x1):
  18498. fallthrough
  18499. case int32(0x2):
  18500. fallthrough
  18501. case int32(0x3):
  18502. fallthrough
  18503. case int32(0x4):
  18504. fallthrough
  18505. case int32(0x5):
  18506. fallthrough
  18507. case int32(0x6):
  18508. fallthrough
  18509. case int32(0x7):
  18510. if int32(toLim)-int32(*(*uintptr)(unsafe.Pointer(toP))) < int32(2) {
  18511. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18512. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18513. }
  18514. v5 = toP
  18515. v4 = *(*uintptr)(unsafe.Pointer(v5))
  18516. *(*uintptr)(unsafe.Pointer(v5))++
  18517. *(*uint8)(unsafe.Pointer(v4)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromUint8(hi)<<libc.Int32FromInt32(2) | int32(_UTF8_cval2))
  18518. v7 = toP
  18519. v6 = *(*uintptr)(unsafe.Pointer(v7))
  18520. *(*uintptr)(unsafe.Pointer(v7))++
  18521. *(*uint8)(unsafe.Pointer(v6)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18522. default:
  18523. if int32(toLim)-int32(*(*uintptr)(unsafe.Pointer(toP))) < int32(3) {
  18524. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18525. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18526. } /* 16 bits divided 4, 6, 6 amongst 3 bytes */
  18527. v9 = toP
  18528. v8 = *(*uintptr)(unsafe.Pointer(v9))
  18529. *(*uintptr)(unsafe.Pointer(v9))++
  18530. *(*uint8)(unsafe.Pointer(v8)) = libc.Uint8FromInt32(libc.Int32FromUint8(hi)>>libc.Int32FromInt32(4) | int32(_UTF8_cval3))
  18531. v11 = toP
  18532. v10 = *(*uintptr)(unsafe.Pointer(v11))
  18533. *(*uintptr)(unsafe.Pointer(v11))++
  18534. *(*uint8)(unsafe.Pointer(v10)) = libc.Uint8FromInt32(libc.Int32FromUint8(hi)&libc.Int32FromInt32(0xf)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  18535. v13 = toP
  18536. v12 = *(*uintptr)(unsafe.Pointer(v13))
  18537. *(*uintptr)(unsafe.Pointer(v13))++
  18538. *(*uint8)(unsafe.Pointer(v12)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18539. case int32(0xD8):
  18540. fallthrough
  18541. case int32(0xD9):
  18542. fallthrough
  18543. case int32(0xDA):
  18544. fallthrough
  18545. case int32(0xDB):
  18546. if int32(toLim)-int32(*(*uintptr)(unsafe.Pointer(toP))) < int32(4) {
  18547. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18548. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18549. }
  18550. if int32(fromLim)-int32(from) < int32(4) {
  18551. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18552. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18553. }
  18554. plane = libc.Int32FromUint8(hi)&int32(0x3)<<int32(2) | libc.Int32FromUint8(lo)>>int32(6)&int32(0x3) + int32(1)
  18555. v15 = toP
  18556. v14 = *(*uintptr)(unsafe.Pointer(v15))
  18557. *(*uintptr)(unsafe.Pointer(v15))++
  18558. *(*uint8)(unsafe.Pointer(v14)) = libc.Uint8FromInt32(plane>>libc.Int32FromInt32(2) | int32(_UTF8_cval4))
  18559. v17 = toP
  18560. v16 = *(*uintptr)(unsafe.Pointer(v17))
  18561. *(*uintptr)(unsafe.Pointer(v17))++
  18562. *(*uint8)(unsafe.Pointer(v16)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(2)&libc.Int32FromInt32(0xF) | plane&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromInt32(0x80))
  18563. from += uintptr(2)
  18564. lo2 = *(*uint8)(unsafe.Pointer(from))
  18565. v19 = toP
  18566. v18 = *(*uintptr)(unsafe.Pointer(v19))
  18567. *(*uintptr)(unsafe.Pointer(v19))++
  18568. *(*uint8)(unsafe.Pointer(v18)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from + 1)))&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo2)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  18569. v21 = toP
  18570. v20 = *(*uintptr)(unsafe.Pointer(v21))
  18571. *(*uintptr)(unsafe.Pointer(v21))++
  18572. *(*uint8)(unsafe.Pointer(v20)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo2)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18573. break
  18574. }
  18575. goto _1
  18576. _1:
  18577. ;
  18578. from += uintptr(2)
  18579. }
  18580. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18581. if from < fromLim {
  18582. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18583. } else {
  18584. return int32(_XML_CONVERT_COMPLETED)
  18585. }
  18586. return r
  18587. }
  18588. func _little2_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18589. var res _XML_Convert_Result
  18590. var v2, v3 uintptr
  18591. _, _, _ = res, v2, v3
  18592. res = int32(_XML_CONVERT_COMPLETED)
  18593. _ = enc
  18594. fromLim = *(*uintptr)(unsafe.Pointer(fromP)) + uintptr((int32(fromLim)-int32(*(*uintptr)(unsafe.Pointer(fromP))))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */ /* Avoid copying first half only of surrogate */
  18595. if int32(fromLim)-int32(*(*uintptr)(unsafe.Pointer(fromP))) > (int32(toLim)-int32(*(*uintptr)(unsafe.Pointer(toP))))/2<<libc.Int32FromInt32(1) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(fromLim - libc.UintptrFromInt32(2) + 1)))&int32(0xF8) == int32(0xD8) {
  18596. fromLim -= uintptr(2)
  18597. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18598. }
  18599. for {
  18600. if !(*(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim) {
  18601. break
  18602. }
  18603. v3 = toP
  18604. v2 = *(*uintptr)(unsafe.Pointer(v3))
  18605. *(*uintptr)(unsafe.Pointer(v3)) += 2
  18606. *(*uint16)(unsafe.Pointer(v2)) = libc.Uint16FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)) + 1)))<<int32(8) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP))))))
  18607. goto _1
  18608. _1:
  18609. ;
  18610. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(2)
  18611. }
  18612. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  18613. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18614. } else {
  18615. return res
  18616. }
  18617. return r
  18618. }
  18619. func _big2_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18620. var from, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v3, v4, v5, v6, v7, v8, v9 uintptr
  18621. var hi, lo, lo2 uint8
  18622. var plane int32
  18623. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  18624. from = *(*uintptr)(unsafe.Pointer(fromP))
  18625. _ = enc
  18626. fromLim = from + uintptr((int32(fromLim)-int32(from))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */
  18627. for {
  18628. if !(from < fromLim) {
  18629. break
  18630. }
  18631. lo = *(*uint8)(unsafe.Pointer(from + 1))
  18632. hi = *(*uint8)(unsafe.Pointer(from))
  18633. switch libc.Int32FromUint8(hi) {
  18634. case 0:
  18635. if libc.Int32FromUint8(lo) < int32(0x80) {
  18636. if *(*uintptr)(unsafe.Pointer(toP)) == toLim {
  18637. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18638. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18639. }
  18640. v3 = toP
  18641. v2 = *(*uintptr)(unsafe.Pointer(v3))
  18642. *(*uintptr)(unsafe.Pointer(v3))++
  18643. *(*uint8)(unsafe.Pointer(v2)) = lo
  18644. break
  18645. } /* fall through */
  18646. fallthrough
  18647. case int32(0x1):
  18648. fallthrough
  18649. case int32(0x2):
  18650. fallthrough
  18651. case int32(0x3):
  18652. fallthrough
  18653. case int32(0x4):
  18654. fallthrough
  18655. case int32(0x5):
  18656. fallthrough
  18657. case int32(0x6):
  18658. fallthrough
  18659. case int32(0x7):
  18660. if int32(toLim)-int32(*(*uintptr)(unsafe.Pointer(toP))) < int32(2) {
  18661. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18662. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18663. }
  18664. v5 = toP
  18665. v4 = *(*uintptr)(unsafe.Pointer(v5))
  18666. *(*uintptr)(unsafe.Pointer(v5))++
  18667. *(*uint8)(unsafe.Pointer(v4)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromUint8(hi)<<libc.Int32FromInt32(2) | int32(_UTF8_cval2))
  18668. v7 = toP
  18669. v6 = *(*uintptr)(unsafe.Pointer(v7))
  18670. *(*uintptr)(unsafe.Pointer(v7))++
  18671. *(*uint8)(unsafe.Pointer(v6)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18672. default:
  18673. if int32(toLim)-int32(*(*uintptr)(unsafe.Pointer(toP))) < int32(3) {
  18674. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18675. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18676. } /* 16 bits divided 4, 6, 6 amongst 3 bytes */
  18677. v9 = toP
  18678. v8 = *(*uintptr)(unsafe.Pointer(v9))
  18679. *(*uintptr)(unsafe.Pointer(v9))++
  18680. *(*uint8)(unsafe.Pointer(v8)) = libc.Uint8FromInt32(libc.Int32FromUint8(hi)>>libc.Int32FromInt32(4) | int32(_UTF8_cval3))
  18681. v11 = toP
  18682. v10 = *(*uintptr)(unsafe.Pointer(v11))
  18683. *(*uintptr)(unsafe.Pointer(v11))++
  18684. *(*uint8)(unsafe.Pointer(v10)) = libc.Uint8FromInt32(libc.Int32FromUint8(hi)&libc.Int32FromInt32(0xf)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  18685. v13 = toP
  18686. v12 = *(*uintptr)(unsafe.Pointer(v13))
  18687. *(*uintptr)(unsafe.Pointer(v13))++
  18688. *(*uint8)(unsafe.Pointer(v12)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18689. case int32(0xD8):
  18690. fallthrough
  18691. case int32(0xD9):
  18692. fallthrough
  18693. case int32(0xDA):
  18694. fallthrough
  18695. case int32(0xDB):
  18696. if int32(toLim)-int32(*(*uintptr)(unsafe.Pointer(toP))) < int32(4) {
  18697. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18698. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18699. }
  18700. if int32(fromLim)-int32(from) < int32(4) {
  18701. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18702. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18703. }
  18704. plane = libc.Int32FromUint8(hi)&int32(0x3)<<int32(2) | libc.Int32FromUint8(lo)>>int32(6)&int32(0x3) + int32(1)
  18705. v15 = toP
  18706. v14 = *(*uintptr)(unsafe.Pointer(v15))
  18707. *(*uintptr)(unsafe.Pointer(v15))++
  18708. *(*uint8)(unsafe.Pointer(v14)) = libc.Uint8FromInt32(plane>>libc.Int32FromInt32(2) | int32(_UTF8_cval4))
  18709. v17 = toP
  18710. v16 = *(*uintptr)(unsafe.Pointer(v17))
  18711. *(*uintptr)(unsafe.Pointer(v17))++
  18712. *(*uint8)(unsafe.Pointer(v16)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(2)&libc.Int32FromInt32(0xF) | plane&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromInt32(0x80))
  18713. from += uintptr(2)
  18714. lo2 = *(*uint8)(unsafe.Pointer(from + 1))
  18715. v19 = toP
  18716. v18 = *(*uintptr)(unsafe.Pointer(v19))
  18717. *(*uintptr)(unsafe.Pointer(v19))++
  18718. *(*uint8)(unsafe.Pointer(v18)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from)))&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo2)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  18719. v21 = toP
  18720. v20 = *(*uintptr)(unsafe.Pointer(v21))
  18721. *(*uintptr)(unsafe.Pointer(v21))++
  18722. *(*uint8)(unsafe.Pointer(v20)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo2)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18723. break
  18724. }
  18725. goto _1
  18726. _1:
  18727. ;
  18728. from += uintptr(2)
  18729. }
  18730. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18731. if from < fromLim {
  18732. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18733. } else {
  18734. return int32(_XML_CONVERT_COMPLETED)
  18735. }
  18736. return r
  18737. }
  18738. func _big2_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18739. var res _XML_Convert_Result
  18740. var v2, v3 uintptr
  18741. _, _, _ = res, v2, v3
  18742. res = int32(_XML_CONVERT_COMPLETED)
  18743. _ = enc
  18744. fromLim = *(*uintptr)(unsafe.Pointer(fromP)) + uintptr((int32(fromLim)-int32(*(*uintptr)(unsafe.Pointer(fromP))))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */ /* Avoid copying first half only of surrogate */
  18745. if int32(fromLim)-int32(*(*uintptr)(unsafe.Pointer(fromP))) > (int32(toLim)-int32(*(*uintptr)(unsafe.Pointer(toP))))/2<<libc.Int32FromInt32(1) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(fromLim - libc.UintptrFromInt32(2))))&int32(0xF8) == int32(0xD8) {
  18746. fromLim -= uintptr(2)
  18747. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18748. }
  18749. for {
  18750. if !(*(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim) {
  18751. break
  18752. }
  18753. v3 = toP
  18754. v2 = *(*uintptr)(unsafe.Pointer(v3))
  18755. *(*uintptr)(unsafe.Pointer(v3)) += 2
  18756. *(*uint16)(unsafe.Pointer(v2)) = libc.Uint16FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)))))<<int32(8) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)) + 1))))
  18757. goto _1
  18758. _1:
  18759. ;
  18760. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(2)
  18761. }
  18762. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  18763. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18764. } else {
  18765. return res
  18766. }
  18767. return r
  18768. }
  18769. /* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
  18770. /* This file is included (from xmltok.c, 1-3 times depending on XML_MIN_SIZE)!
  18771. __ __ _
  18772. ___\ \/ /_ __ __ _| |_
  18773. / _ \\ /| '_ \ / _` | __|
  18774. | __// \| |_) | (_| | |_
  18775. \___/_/\_\ .__/ \__,_|\__|
  18776. |_| XML parser
  18777. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  18778. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  18779. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  18780. Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
  18781. Copyright (c) 2016-2022 Sebastian Pipping <sebastian@pipping.org>
  18782. Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
  18783. Copyright (c) 2018 Benjamin Peterson <benjamin@python.org>
  18784. Copyright (c) 2018 Anton Maklakov <antmak.pub@gmail.com>
  18785. Copyright (c) 2019 David Loffredo <loffredo@steptools.com>
  18786. Copyright (c) 2020 Boris Kolpackov <boris@codesynthesis.com>
  18787. Copyright (c) 2022 Martin Ettl <ettl.martin78@googlemail.com>
  18788. Licensed under the MIT license:
  18789. Permission is hereby granted, free of charge, to any person obtaining
  18790. a copy of this software and associated documentation files (the
  18791. "Software"), to deal in the Software without restriction, including
  18792. without limitation the rights to use, copy, modify, merge, publish,
  18793. distribute, sublicense, and/or sell copies of the Software, and to permit
  18794. persons to whom the Software is furnished to do so, subject to the
  18795. following conditions:
  18796. The above copyright notice and this permission notice shall be included
  18797. in all copies or substantial portions of the Software.
  18798. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  18799. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  18800. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  18801. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  18802. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  18803. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  18804. USE OR OTHER DEALINGS IN THE SOFTWARE.
  18805. */
  18806. /* ptr points to character following "<!-" */
  18807. func _little2_scanComment(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  18808. var v1 int32
  18809. _ = v1
  18810. if int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  18811. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_MINUS1)) {
  18812. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18813. return m_XML_TOK_INVALID
  18814. }
  18815. ptr += uintptr(2)
  18816. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  18817. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18818. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18819. } else {
  18820. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18821. }
  18822. switch v1 {
  18823. case int32(_BT_LEAD2):
  18824. if int32(end)-int32(ptr) < int32(2) {
  18825. return -int32(2)
  18826. }
  18827. if 0 != 0 {
  18828. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18829. return m_XML_TOK_INVALID
  18830. }
  18831. ptr += uintptr(2)
  18832. case int32(_BT_LEAD3):
  18833. if int32(end)-int32(ptr) < int32(3) {
  18834. return -int32(2)
  18835. }
  18836. if 0 != 0 {
  18837. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18838. return m_XML_TOK_INVALID
  18839. }
  18840. ptr += uintptr(3)
  18841. case int32(_BT_LEAD4):
  18842. if int32(end)-int32(ptr) < int32(4) {
  18843. return -int32(2)
  18844. }
  18845. if 0 != 0 {
  18846. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18847. return m_XML_TOK_INVALID
  18848. }
  18849. ptr += uintptr(4)
  18850. case int32(_BT_NONXML):
  18851. fallthrough
  18852. case int32(_BT_MALFORM):
  18853. fallthrough
  18854. case int32(_BT_TRAIL):
  18855. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18856. return m_XML_TOK_INVALID
  18857. case int32(_BT_MINUS):
  18858. ptr += uintptr(2)
  18859. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18860. return -int32(1)
  18861. }
  18862. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_MINUS1) {
  18863. ptr += uintptr(2)
  18864. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18865. return -int32(1)
  18866. }
  18867. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  18868. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18869. return m_XML_TOK_INVALID
  18870. }
  18871. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18872. return int32(m_XML_TOK_COMMENT)
  18873. }
  18874. default:
  18875. ptr += uintptr(2)
  18876. break
  18877. }
  18878. }
  18879. }
  18880. return -int32(1)
  18881. }
  18882. /* ptr points to character following "<!" */
  18883. func _little2_scanDecl(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  18884. var v1, v2, v3 int32
  18885. _, _, _ = v1, v2, v3
  18886. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18887. return -int32(1)
  18888. }
  18889. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18890. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18891. } else {
  18892. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18893. }
  18894. switch v1 {
  18895. case int32(_BT_MINUS):
  18896. return _little2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  18897. case int32(_BT_LSQB):
  18898. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18899. return int32(m_XML_TOK_COND_SECT_OPEN)
  18900. case int32(_BT_NMSTRT):
  18901. fallthrough
  18902. case int32(_BT_HEX):
  18903. ptr += uintptr(2)
  18904. default:
  18905. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18906. return m_XML_TOK_INVALID
  18907. }
  18908. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  18909. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18910. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18911. } else {
  18912. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18913. }
  18914. switch v2 {
  18915. case int32(_BT_PERCNT):
  18916. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) {
  18917. return -int32(1)
  18918. }
  18919. /* don't allow <!ENTITY% foo "whatever"> */
  18920. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 {
  18921. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))))))
  18922. } else {
  18923. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)), *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))
  18924. }
  18925. switch v3 {
  18926. case int32(_BT_S):
  18927. fallthrough
  18928. case int32(_BT_CR):
  18929. fallthrough
  18930. case int32(_BT_LF):
  18931. fallthrough
  18932. case int32(_BT_PERCNT):
  18933. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18934. return m_XML_TOK_INVALID
  18935. }
  18936. /* fall through */
  18937. fallthrough
  18938. case int32(_BT_S):
  18939. fallthrough
  18940. case int32(_BT_CR):
  18941. fallthrough
  18942. case int32(_BT_LF):
  18943. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18944. return int32(m_XML_TOK_DECL_OPEN)
  18945. case int32(_BT_NMSTRT):
  18946. fallthrough
  18947. case int32(_BT_HEX):
  18948. ptr += uintptr(2)
  18949. default:
  18950. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18951. return m_XML_TOK_INVALID
  18952. }
  18953. }
  18954. return -int32(1)
  18955. }
  18956. func _little2_checkPiTarget(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, tokPtr uintptr) (r int32) {
  18957. var upper, v1, v2, v3 int32
  18958. _, _, _, _ = upper, v1, v2, v3
  18959. upper = 0
  18960. _ = enc
  18961. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_PI)
  18962. if int32(end)-int32(ptr) != libc.Int32FromInt32(2)*libc.Int32FromInt32(3) {
  18963. return int32(1)
  18964. }
  18965. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18966. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  18967. } else {
  18968. v1 = -int32(1)
  18969. }
  18970. switch v1 {
  18971. case int32(m_ASCII_x2):
  18972. case int32(m_ASCII_X):
  18973. upper = int32(1)
  18974. default:
  18975. return int32(1)
  18976. }
  18977. ptr += uintptr(2)
  18978. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18979. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  18980. } else {
  18981. v2 = -int32(1)
  18982. }
  18983. switch v2 {
  18984. case int32(m_ASCII_m2):
  18985. case int32(m_ASCII_M):
  18986. upper = int32(1)
  18987. default:
  18988. return int32(1)
  18989. }
  18990. ptr += uintptr(2)
  18991. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18992. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  18993. } else {
  18994. v3 = -int32(1)
  18995. }
  18996. switch v3 {
  18997. case int32(m_ASCII_l2):
  18998. case int32(m_ASCII_L):
  18999. upper = int32(1)
  19000. default:
  19001. return int32(1)
  19002. }
  19003. if upper != 0 {
  19004. return 0
  19005. }
  19006. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_XML_DECL)
  19007. return int32(1)
  19008. }
  19009. /* ptr points to character following "<?" */
  19010. func _little2_scanPi(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19011. bp := tls.Alloc(16)
  19012. defer tls.Free(16)
  19013. var target uintptr
  19014. var v1, v2, v3 int32
  19015. var _ /* tok at bp+0 */ int32
  19016. _, _, _, _ = target, v1, v2, v3
  19017. target = ptr
  19018. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19019. return -int32(1)
  19020. }
  19021. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19022. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19023. } else {
  19024. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19025. }
  19026. switch v1 {
  19027. case int32(_BT_NONASCII):
  19028. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  19029. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19030. return m_XML_TOK_INVALID
  19031. } /* fall through */
  19032. fallthrough
  19033. case int32(_BT_NMSTRT):
  19034. fallthrough
  19035. case int32(_BT_HEX):
  19036. ptr += uintptr(2)
  19037. case int32(_BT_LEAD2):
  19038. if int32(end)-int32(ptr) < int32(2) {
  19039. return -int32(2)
  19040. }
  19041. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19042. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19043. return m_XML_TOK_INVALID
  19044. }
  19045. ptr += uintptr(2)
  19046. case int32(_BT_LEAD3):
  19047. if int32(end)-int32(ptr) < int32(3) {
  19048. return -int32(2)
  19049. }
  19050. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19051. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19052. return m_XML_TOK_INVALID
  19053. }
  19054. ptr += uintptr(3)
  19055. case int32(_BT_LEAD4):
  19056. if int32(end)-int32(ptr) < int32(4) {
  19057. return -int32(2)
  19058. }
  19059. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19060. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19061. return m_XML_TOK_INVALID
  19062. }
  19063. ptr += uintptr(4)
  19064. default:
  19065. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19066. return m_XML_TOK_INVALID
  19067. }
  19068. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  19069. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19070. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19071. } else {
  19072. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19073. }
  19074. switch v2 {
  19075. case int32(_BT_NONASCII):
  19076. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  19077. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19078. return m_XML_TOK_INVALID
  19079. } /* fall through */
  19080. fallthrough
  19081. case int32(_BT_NMSTRT):
  19082. fallthrough
  19083. case int32(_BT_HEX):
  19084. fallthrough
  19085. case int32(_BT_DIGIT):
  19086. fallthrough
  19087. case int32(_BT_NAME):
  19088. fallthrough
  19089. case int32(_BT_MINUS):
  19090. ptr += uintptr(2)
  19091. case int32(_BT_LEAD2):
  19092. if int32(end)-int32(ptr) < int32(2) {
  19093. return -int32(2)
  19094. }
  19095. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19096. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19097. return m_XML_TOK_INVALID
  19098. }
  19099. ptr += uintptr(2)
  19100. case int32(_BT_LEAD3):
  19101. if int32(end)-int32(ptr) < int32(3) {
  19102. return -int32(2)
  19103. }
  19104. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19105. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19106. return m_XML_TOK_INVALID
  19107. }
  19108. ptr += uintptr(3)
  19109. case int32(_BT_LEAD4):
  19110. if int32(end)-int32(ptr) < int32(4) {
  19111. return -int32(2)
  19112. }
  19113. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19114. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19115. return m_XML_TOK_INVALID
  19116. }
  19117. ptr += uintptr(4)
  19118. case int32(_BT_S):
  19119. fallthrough
  19120. case int32(_BT_CR):
  19121. fallthrough
  19122. case int32(_BT_LF):
  19123. if !(_little2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  19124. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19125. return m_XML_TOK_INVALID
  19126. }
  19127. ptr += uintptr(2)
  19128. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  19129. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19130. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19131. } else {
  19132. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19133. }
  19134. switch v3 {
  19135. case int32(_BT_LEAD2):
  19136. if int32(end)-int32(ptr) < int32(2) {
  19137. return -int32(2)
  19138. }
  19139. if 0 != 0 {
  19140. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19141. return m_XML_TOK_INVALID
  19142. }
  19143. ptr += uintptr(2)
  19144. case int32(_BT_LEAD3):
  19145. if int32(end)-int32(ptr) < int32(3) {
  19146. return -int32(2)
  19147. }
  19148. if 0 != 0 {
  19149. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19150. return m_XML_TOK_INVALID
  19151. }
  19152. ptr += uintptr(3)
  19153. case int32(_BT_LEAD4):
  19154. if int32(end)-int32(ptr) < int32(4) {
  19155. return -int32(2)
  19156. }
  19157. if 0 != 0 {
  19158. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19159. return m_XML_TOK_INVALID
  19160. }
  19161. ptr += uintptr(4)
  19162. case int32(_BT_NONXML):
  19163. fallthrough
  19164. case int32(_BT_MALFORM):
  19165. fallthrough
  19166. case int32(_BT_TRAIL):
  19167. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19168. return m_XML_TOK_INVALID
  19169. case int32(_BT_QUEST):
  19170. ptr += uintptr(2)
  19171. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19172. return -int32(1)
  19173. }
  19174. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  19175. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19176. return *(*int32)(unsafe.Pointer(bp))
  19177. }
  19178. default:
  19179. ptr += uintptr(2)
  19180. break
  19181. }
  19182. }
  19183. return -int32(1)
  19184. case int32(_BT_QUEST):
  19185. if !(_little2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  19186. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19187. return m_XML_TOK_INVALID
  19188. }
  19189. ptr += uintptr(2)
  19190. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19191. return -int32(1)
  19192. }
  19193. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  19194. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19195. return *(*int32)(unsafe.Pointer(bp))
  19196. }
  19197. /* fall through */
  19198. fallthrough
  19199. default:
  19200. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19201. return m_XML_TOK_INVALID
  19202. }
  19203. }
  19204. return -int32(1)
  19205. }
  19206. func _little2_scanCdataSection(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19207. var i int32
  19208. _ = i
  19209. _ = enc
  19210. /* CDATA[ */
  19211. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(6)*libc.Int32FromInt32(2)) {
  19212. return -int32(1)
  19213. }
  19214. i = 0
  19215. for {
  19216. if !(i < int32(6)) {
  19217. break
  19218. }
  19219. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromUint8(_CDATA_LSQB1[i])) {
  19220. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19221. return m_XML_TOK_INVALID
  19222. }
  19223. goto _1
  19224. _1:
  19225. ;
  19226. i++
  19227. ptr += uintptr(2)
  19228. }
  19229. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19230. return int32(m_XML_TOK_CDATA_SECT_OPEN)
  19231. }
  19232. var _CDATA_LSQB1 = [6]uint8{
  19233. 0: uint8(m_ASCII_C),
  19234. 1: uint8(m_ASCII_D),
  19235. 2: uint8(m_ASCII_A),
  19236. 3: uint8(m_ASCII_T),
  19237. 4: uint8(m_ASCII_A),
  19238. 5: uint8(m_ASCII_LSQB1),
  19239. }
  19240. func _little2_cdataSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19241. var n Tsize_t
  19242. var v1, v2, v3 int32
  19243. _, _, _, _ = n, v1, v2, v3
  19244. if ptr >= end {
  19245. return -int32(4)
  19246. }
  19247. if int32(2) > int32(1) {
  19248. n = libc.Uint32FromInt32(int32(end) - int32(ptr))
  19249. if n&libc.Uint32FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  19250. n &= libc.Uint32FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  19251. if n == uint32(0) {
  19252. return -int32(1)
  19253. }
  19254. end = ptr + uintptr(n)
  19255. }
  19256. }
  19257. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19258. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19259. } else {
  19260. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19261. }
  19262. switch v1 {
  19263. case int32(_BT_RSQB):
  19264. ptr += uintptr(2)
  19265. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19266. return -int32(1)
  19267. }
  19268. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1)) {
  19269. break
  19270. }
  19271. ptr += uintptr(2)
  19272. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19273. return -int32(1)
  19274. }
  19275. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  19276. ptr -= uintptr(2)
  19277. break
  19278. }
  19279. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19280. return int32(m_XML_TOK_CDATA_SECT_CLOSE)
  19281. case int32(_BT_CR):
  19282. ptr += uintptr(2)
  19283. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19284. return -int32(1)
  19285. }
  19286. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19287. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19288. } else {
  19289. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19290. }
  19291. if v2 == int32(_BT_LF) {
  19292. ptr += uintptr(2)
  19293. }
  19294. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19295. return int32(m_XML_TOK_DATA_NEWLINE)
  19296. case int32(_BT_LF):
  19297. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19298. return int32(m_XML_TOK_DATA_NEWLINE)
  19299. case int32(_BT_LEAD2):
  19300. if int32(end)-int32(ptr) < int32(2) {
  19301. return -int32(2)
  19302. }
  19303. if 0 != 0 {
  19304. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19305. return m_XML_TOK_INVALID
  19306. }
  19307. ptr += uintptr(2)
  19308. case int32(_BT_LEAD3):
  19309. if int32(end)-int32(ptr) < int32(3) {
  19310. return -int32(2)
  19311. }
  19312. if 0 != 0 {
  19313. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19314. return m_XML_TOK_INVALID
  19315. }
  19316. ptr += uintptr(3)
  19317. case int32(_BT_LEAD4):
  19318. if int32(end)-int32(ptr) < int32(4) {
  19319. return -int32(2)
  19320. }
  19321. if 0 != 0 {
  19322. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19323. return m_XML_TOK_INVALID
  19324. }
  19325. ptr += uintptr(4)
  19326. case int32(_BT_NONXML):
  19327. fallthrough
  19328. case int32(_BT_MALFORM):
  19329. fallthrough
  19330. case int32(_BT_TRAIL):
  19331. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19332. return m_XML_TOK_INVALID
  19333. default:
  19334. ptr += uintptr(2)
  19335. break
  19336. }
  19337. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  19338. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19339. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19340. } else {
  19341. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19342. }
  19343. switch v3 {
  19344. case int32(_BT_LEAD2):
  19345. if int32(end)-int32(ptr) < int32(2) || libc.Bool(0 != 0) {
  19346. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19347. return int32(m_XML_TOK_DATA_CHARS)
  19348. }
  19349. ptr += uintptr(2)
  19350. case int32(_BT_LEAD3):
  19351. if int32(end)-int32(ptr) < int32(3) || libc.Bool(0 != 0) {
  19352. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19353. return int32(m_XML_TOK_DATA_CHARS)
  19354. }
  19355. ptr += uintptr(3)
  19356. case int32(_BT_LEAD4):
  19357. if int32(end)-int32(ptr) < int32(4) || libc.Bool(0 != 0) {
  19358. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19359. return int32(m_XML_TOK_DATA_CHARS)
  19360. }
  19361. ptr += uintptr(4)
  19362. case int32(_BT_NONXML):
  19363. fallthrough
  19364. case int32(_BT_MALFORM):
  19365. fallthrough
  19366. case int32(_BT_TRAIL):
  19367. fallthrough
  19368. case int32(_BT_CR):
  19369. fallthrough
  19370. case int32(_BT_LF):
  19371. fallthrough
  19372. case int32(_BT_RSQB):
  19373. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19374. return int32(m_XML_TOK_DATA_CHARS)
  19375. default:
  19376. ptr += uintptr(2)
  19377. break
  19378. }
  19379. }
  19380. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19381. return int32(m_XML_TOK_DATA_CHARS)
  19382. }
  19383. /* ptr points to character following "</" */
  19384. func _little2_scanEndTag(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19385. var v1, v2, v22 int32
  19386. _, _, _ = v1, v2, v22
  19387. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19388. return -int32(1)
  19389. }
  19390. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19391. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19392. } else {
  19393. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19394. }
  19395. switch v1 {
  19396. case int32(_BT_NONASCII):
  19397. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  19398. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19399. return m_XML_TOK_INVALID
  19400. } /* fall through */
  19401. fallthrough
  19402. case int32(_BT_NMSTRT):
  19403. fallthrough
  19404. case int32(_BT_HEX):
  19405. ptr += uintptr(2)
  19406. case int32(_BT_LEAD2):
  19407. if int32(end)-int32(ptr) < int32(2) {
  19408. return -int32(2)
  19409. }
  19410. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19411. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19412. return m_XML_TOK_INVALID
  19413. }
  19414. ptr += uintptr(2)
  19415. case int32(_BT_LEAD3):
  19416. if int32(end)-int32(ptr) < int32(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. case int32(_BT_LEAD4):
  19425. if int32(end)-int32(ptr) < int32(4) {
  19426. return -int32(2)
  19427. }
  19428. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19429. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19430. return m_XML_TOK_INVALID
  19431. }
  19432. ptr += uintptr(4)
  19433. default:
  19434. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19435. return m_XML_TOK_INVALID
  19436. }
  19437. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  19438. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19439. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19440. } else {
  19441. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19442. }
  19443. switch v2 {
  19444. case int32(_BT_NONASCII):
  19445. goto _3
  19446. case int32(_BT_MINUS):
  19447. goto _4
  19448. case int32(_BT_NAME):
  19449. goto _5
  19450. case int32(_BT_DIGIT):
  19451. goto _6
  19452. case int32(_BT_HEX):
  19453. goto _7
  19454. case int32(_BT_NMSTRT):
  19455. goto _8
  19456. case int32(_BT_LEAD2):
  19457. goto _9
  19458. case int32(_BT_LEAD3):
  19459. goto _10
  19460. case int32(_BT_LEAD4):
  19461. goto _11
  19462. case int32(_BT_LF):
  19463. goto _12
  19464. case int32(_BT_CR):
  19465. goto _13
  19466. case int32(_BT_S):
  19467. goto _14
  19468. case int32(_BT_COLON):
  19469. goto _15
  19470. case int32(_BT_GT):
  19471. goto _16
  19472. default:
  19473. goto _17
  19474. }
  19475. goto _18
  19476. _3:
  19477. ;
  19478. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  19479. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19480. return m_XML_TOK_INVALID
  19481. } /* fall through */
  19482. _8:
  19483. ;
  19484. _7:
  19485. ;
  19486. _6:
  19487. ;
  19488. _5:
  19489. ;
  19490. _4:
  19491. ;
  19492. ptr += uintptr(2)
  19493. goto _18
  19494. _9:
  19495. ;
  19496. if int32(end)-int32(ptr) < int32(2) {
  19497. return -int32(2)
  19498. }
  19499. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19500. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19501. return m_XML_TOK_INVALID
  19502. }
  19503. ptr += uintptr(2)
  19504. goto _18
  19505. _10:
  19506. ;
  19507. if int32(end)-int32(ptr) < int32(3) {
  19508. return -int32(2)
  19509. }
  19510. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19511. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19512. return m_XML_TOK_INVALID
  19513. }
  19514. ptr += uintptr(3)
  19515. goto _18
  19516. _11:
  19517. ;
  19518. if int32(end)-int32(ptr) < int32(4) {
  19519. return -int32(2)
  19520. }
  19521. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19522. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19523. return m_XML_TOK_INVALID
  19524. }
  19525. ptr += uintptr(4)
  19526. goto _18
  19527. _14:
  19528. ;
  19529. _13:
  19530. ;
  19531. _12:
  19532. ;
  19533. ptr += uintptr(2)
  19534. _21:
  19535. ;
  19536. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19537. goto _19
  19538. }
  19539. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19540. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19541. } else {
  19542. v22 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19543. }
  19544. switch v22 {
  19545. case int32(_BT_S):
  19546. fallthrough
  19547. case int32(_BT_CR):
  19548. fallthrough
  19549. case int32(_BT_LF):
  19550. case int32(_BT_GT):
  19551. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19552. return int32(m_XML_TOK_END_TAG)
  19553. default:
  19554. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19555. return m_XML_TOK_INVALID
  19556. }
  19557. goto _20
  19558. _20:
  19559. ;
  19560. ptr += uintptr(2)
  19561. goto _21
  19562. goto _19
  19563. _19:
  19564. ;
  19565. return -int32(1)
  19566. _15:
  19567. ;
  19568. /* no need to check qname syntax here,
  19569. since end-tag must match exactly */
  19570. ptr += uintptr(2)
  19571. goto _18
  19572. _16:
  19573. ;
  19574. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19575. return int32(m_XML_TOK_END_TAG)
  19576. _17:
  19577. ;
  19578. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19579. return m_XML_TOK_INVALID
  19580. _18:
  19581. }
  19582. return -int32(1)
  19583. }
  19584. /* ptr points to character following "&#X" */
  19585. func _little2_scanHexCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19586. var v1, v3 int32
  19587. _, _ = v1, v3
  19588. if int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  19589. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19590. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19591. } else {
  19592. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19593. }
  19594. switch v1 {
  19595. case int32(_BT_DIGIT):
  19596. fallthrough
  19597. case int32(_BT_HEX):
  19598. default:
  19599. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19600. return m_XML_TOK_INVALID
  19601. }
  19602. ptr += uintptr(2)
  19603. for {
  19604. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19605. break
  19606. }
  19607. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19608. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19609. } else {
  19610. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19611. }
  19612. switch v3 {
  19613. case int32(_BT_DIGIT):
  19614. fallthrough
  19615. case int32(_BT_HEX):
  19616. case int32(_BT_SEMI):
  19617. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19618. return int32(m_XML_TOK_CHAR_REF)
  19619. default:
  19620. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19621. return m_XML_TOK_INVALID
  19622. }
  19623. goto _2
  19624. _2:
  19625. ;
  19626. ptr += uintptr(2)
  19627. }
  19628. }
  19629. return -int32(1)
  19630. }
  19631. /* ptr points to character following "&#" */
  19632. func _little2_scanCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19633. var v1, v3 int32
  19634. _, _ = v1, v3
  19635. if int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  19636. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  19637. return _little2_scanHexCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  19638. }
  19639. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19640. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19641. } else {
  19642. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19643. }
  19644. switch v1 {
  19645. case int32(_BT_DIGIT):
  19646. default:
  19647. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19648. return m_XML_TOK_INVALID
  19649. }
  19650. ptr += uintptr(2)
  19651. for {
  19652. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19653. break
  19654. }
  19655. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19656. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19657. } else {
  19658. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19659. }
  19660. switch v3 {
  19661. case int32(_BT_DIGIT):
  19662. case int32(_BT_SEMI):
  19663. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19664. return int32(m_XML_TOK_CHAR_REF)
  19665. default:
  19666. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19667. return m_XML_TOK_INVALID
  19668. }
  19669. goto _2
  19670. _2:
  19671. ;
  19672. ptr += uintptr(2)
  19673. }
  19674. }
  19675. return -int32(1)
  19676. }
  19677. /* ptr points to character following "&" */
  19678. func _little2_scanRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19679. var v1, v2 int32
  19680. _, _ = v1, v2
  19681. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19682. return -int32(1)
  19683. }
  19684. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19685. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19686. } else {
  19687. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19688. }
  19689. switch v1 {
  19690. case int32(_BT_NONASCII):
  19691. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  19692. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19693. return m_XML_TOK_INVALID
  19694. } /* fall through */
  19695. fallthrough
  19696. case int32(_BT_NMSTRT):
  19697. fallthrough
  19698. case int32(_BT_HEX):
  19699. ptr += uintptr(2)
  19700. case int32(_BT_LEAD2):
  19701. if int32(end)-int32(ptr) < int32(2) {
  19702. return -int32(2)
  19703. }
  19704. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19705. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19706. return m_XML_TOK_INVALID
  19707. }
  19708. ptr += uintptr(2)
  19709. case int32(_BT_LEAD3):
  19710. if int32(end)-int32(ptr) < int32(3) {
  19711. return -int32(2)
  19712. }
  19713. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19714. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19715. return m_XML_TOK_INVALID
  19716. }
  19717. ptr += uintptr(3)
  19718. case int32(_BT_LEAD4):
  19719. if int32(end)-int32(ptr) < int32(4) {
  19720. return -int32(2)
  19721. }
  19722. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19723. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19724. return m_XML_TOK_INVALID
  19725. }
  19726. ptr += uintptr(4)
  19727. case int32(_BT_NUM):
  19728. return _little2_scanCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  19729. default:
  19730. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19731. return m_XML_TOK_INVALID
  19732. }
  19733. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  19734. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19735. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19736. } else {
  19737. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19738. }
  19739. switch v2 {
  19740. case int32(_BT_NONASCII):
  19741. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  19742. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19743. return m_XML_TOK_INVALID
  19744. } /* fall through */
  19745. fallthrough
  19746. case int32(_BT_NMSTRT):
  19747. fallthrough
  19748. case int32(_BT_HEX):
  19749. fallthrough
  19750. case int32(_BT_DIGIT):
  19751. fallthrough
  19752. case int32(_BT_NAME):
  19753. fallthrough
  19754. case int32(_BT_MINUS):
  19755. ptr += uintptr(2)
  19756. case int32(_BT_LEAD2):
  19757. if int32(end)-int32(ptr) < int32(2) {
  19758. return -int32(2)
  19759. }
  19760. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19761. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19762. return m_XML_TOK_INVALID
  19763. }
  19764. ptr += uintptr(2)
  19765. case int32(_BT_LEAD3):
  19766. if int32(end)-int32(ptr) < int32(3) {
  19767. return -int32(2)
  19768. }
  19769. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19770. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19771. return m_XML_TOK_INVALID
  19772. }
  19773. ptr += uintptr(3)
  19774. case int32(_BT_LEAD4):
  19775. if int32(end)-int32(ptr) < int32(4) {
  19776. return -int32(2)
  19777. }
  19778. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19779. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19780. return m_XML_TOK_INVALID
  19781. }
  19782. ptr += uintptr(4)
  19783. case int32(_BT_SEMI):
  19784. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19785. return int32(m_XML_TOK_ENTITY_REF)
  19786. default:
  19787. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19788. return m_XML_TOK_INVALID
  19789. }
  19790. }
  19791. return -int32(1)
  19792. }
  19793. /* ptr points to character following first character of attribute name */
  19794. func _little2_scanAtts(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19795. bp := tls.Alloc(16)
  19796. defer tls.Free(16)
  19797. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  19798. var hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31 int32
  19799. _, _, _, _, _, _, _, _, _, _, _, _ = hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31
  19800. hadColon = 0
  19801. for int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  19802. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  19803. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  19804. } else {
  19805. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  19806. }
  19807. switch v1 {
  19808. case int32(_BT_NONASCII):
  19809. goto _2
  19810. case int32(_BT_MINUS):
  19811. goto _3
  19812. case int32(_BT_NAME):
  19813. goto _4
  19814. case int32(_BT_DIGIT):
  19815. goto _5
  19816. case int32(_BT_HEX):
  19817. goto _6
  19818. case int32(_BT_NMSTRT):
  19819. goto _7
  19820. case int32(_BT_LEAD2):
  19821. goto _8
  19822. case int32(_BT_LEAD3):
  19823. goto _9
  19824. case int32(_BT_LEAD4):
  19825. goto _10
  19826. case int32(_BT_COLON):
  19827. goto _11
  19828. case int32(_BT_LF):
  19829. goto _12
  19830. case int32(_BT_CR):
  19831. goto _13
  19832. case int32(_BT_S):
  19833. goto _14
  19834. case int32(_BT_EQUALS):
  19835. goto _15
  19836. default:
  19837. goto _16
  19838. }
  19839. goto _17
  19840. _2:
  19841. ;
  19842. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))&libc.Int32FromInt32(0x1F))) != 0) {
  19843. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19844. return m_XML_TOK_INVALID
  19845. } /* fall through */
  19846. _7:
  19847. ;
  19848. _6:
  19849. ;
  19850. _5:
  19851. ;
  19852. _4:
  19853. ;
  19854. _3:
  19855. ;
  19856. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19857. goto _17
  19858. _8:
  19859. ;
  19860. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(2) {
  19861. return -int32(2)
  19862. }
  19863. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19864. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19865. return m_XML_TOK_INVALID
  19866. }
  19867. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19868. goto _17
  19869. _9:
  19870. ;
  19871. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(3) {
  19872. return -int32(2)
  19873. }
  19874. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19875. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19876. return m_XML_TOK_INVALID
  19877. }
  19878. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  19879. goto _17
  19880. _10:
  19881. ;
  19882. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(4) {
  19883. return -int32(2)
  19884. }
  19885. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19886. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19887. return m_XML_TOK_INVALID
  19888. }
  19889. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  19890. goto _17
  19891. _11:
  19892. ;
  19893. if hadColon != 0 {
  19894. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19895. return m_XML_TOK_INVALID
  19896. }
  19897. hadColon = int32(1)
  19898. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19899. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19900. return -int32(1)
  19901. }
  19902. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  19903. v18 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  19904. } else {
  19905. v18 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  19906. }
  19907. switch v18 {
  19908. case int32(_BT_NONASCII):
  19909. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))&libc.Int32FromInt32(0x1F))) != 0) {
  19910. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19911. return m_XML_TOK_INVALID
  19912. } /* fall through */
  19913. fallthrough
  19914. case int32(_BT_NMSTRT):
  19915. fallthrough
  19916. case int32(_BT_HEX):
  19917. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19918. case int32(_BT_LEAD2):
  19919. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(2) {
  19920. return -int32(2)
  19921. }
  19922. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19923. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19924. return m_XML_TOK_INVALID
  19925. }
  19926. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19927. case int32(_BT_LEAD3):
  19928. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(3) {
  19929. return -int32(2)
  19930. }
  19931. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19932. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19933. return m_XML_TOK_INVALID
  19934. }
  19935. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  19936. case int32(_BT_LEAD4):
  19937. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(4) {
  19938. return -int32(2)
  19939. }
  19940. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19941. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19942. return m_XML_TOK_INVALID
  19943. }
  19944. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  19945. default:
  19946. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19947. return m_XML_TOK_INVALID
  19948. }
  19949. goto _17
  19950. _14:
  19951. ;
  19952. _13:
  19953. ;
  19954. _12:
  19955. ;
  19956. _21:
  19957. ;
  19958. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19959. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19960. return -int32(1)
  19961. }
  19962. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  19963. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  19964. } else {
  19965. v22 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  19966. }
  19967. t = v22
  19968. if t == int32(_BT_EQUALS) {
  19969. goto _19
  19970. }
  19971. switch t {
  19972. case int32(_BT_S):
  19973. fallthrough
  19974. case int32(_BT_LF):
  19975. fallthrough
  19976. case int32(_BT_CR):
  19977. default:
  19978. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19979. return m_XML_TOK_INVALID
  19980. }
  19981. goto _20
  19982. _20:
  19983. ;
  19984. goto _21
  19985. goto _19
  19986. _19:
  19987. ;
  19988. /* fall through */
  19989. _15:
  19990. ;
  19991. hadColon = 0
  19992. for {
  19993. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19994. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19995. return -int32(1)
  19996. }
  19997. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  19998. v24 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  19999. } else {
  20000. v24 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  20001. }
  20002. open = v24
  20003. if open == int32(_BT_QUOT) || open == int32(_BT_APOS) {
  20004. break
  20005. }
  20006. switch open {
  20007. case int32(_BT_S):
  20008. fallthrough
  20009. case int32(_BT_LF):
  20010. fallthrough
  20011. case int32(_BT_CR):
  20012. default:
  20013. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20014. return m_XML_TOK_INVALID
  20015. }
  20016. goto _23
  20017. _23:
  20018. }
  20019. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20020. /* in attribute value */
  20021. for {
  20022. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20023. return -int32(1)
  20024. }
  20025. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  20026. v26 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  20027. } else {
  20028. v26 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  20029. }
  20030. t1 = v26
  20031. if t1 == open {
  20032. break
  20033. }
  20034. switch t1 {
  20035. case int32(_BT_LEAD2):
  20036. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(2) {
  20037. return -int32(2)
  20038. }
  20039. if 0 != 0 {
  20040. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20041. return m_XML_TOK_INVALID
  20042. }
  20043. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20044. case int32(_BT_LEAD3):
  20045. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(3) {
  20046. return -int32(2)
  20047. }
  20048. if 0 != 0 {
  20049. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20050. return m_XML_TOK_INVALID
  20051. }
  20052. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  20053. case int32(_BT_LEAD4):
  20054. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(4) {
  20055. return -int32(2)
  20056. }
  20057. if 0 != 0 {
  20058. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20059. return m_XML_TOK_INVALID
  20060. }
  20061. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  20062. case int32(_BT_NONXML):
  20063. fallthrough
  20064. case int32(_BT_MALFORM):
  20065. fallthrough
  20066. case int32(_BT_TRAIL):
  20067. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20068. return m_XML_TOK_INVALID
  20069. case int32(_BT_AMP):
  20070. tok = _little2_scanRef(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr(2), end, bp)
  20071. if tok <= 0 {
  20072. if tok == m_XML_TOK_INVALID {
  20073. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20074. }
  20075. return tok
  20076. }
  20077. case int32(_BT_LT):
  20078. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20079. return m_XML_TOK_INVALID
  20080. default:
  20081. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20082. break
  20083. }
  20084. goto _25
  20085. _25:
  20086. }
  20087. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20088. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20089. return -int32(1)
  20090. }
  20091. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  20092. v27 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  20093. } else {
  20094. v27 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  20095. }
  20096. switch v27 {
  20097. case int32(_BT_S):
  20098. fallthrough
  20099. case int32(_BT_CR):
  20100. fallthrough
  20101. case int32(_BT_LF):
  20102. case int32(_BT_SOL):
  20103. goto sol
  20104. case int32(_BT_GT):
  20105. goto gt
  20106. default:
  20107. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20108. return m_XML_TOK_INVALID
  20109. }
  20110. /* ptr points to closing quote */
  20111. _30:
  20112. ;
  20113. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20114. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20115. return -int32(1)
  20116. }
  20117. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  20118. v31 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  20119. } else {
  20120. v31 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  20121. }
  20122. switch v31 {
  20123. case int32(_BT_NONASCII):
  20124. goto _32
  20125. case int32(_BT_HEX):
  20126. goto _33
  20127. case int32(_BT_NMSTRT):
  20128. goto _34
  20129. case int32(_BT_LEAD2):
  20130. goto _35
  20131. case int32(_BT_LEAD3):
  20132. goto _36
  20133. case int32(_BT_LEAD4):
  20134. goto _37
  20135. case int32(_BT_LF):
  20136. goto _38
  20137. case int32(_BT_CR):
  20138. goto _39
  20139. case int32(_BT_S):
  20140. goto _40
  20141. case int32(_BT_GT):
  20142. goto _41
  20143. case int32(_BT_SOL):
  20144. goto _42
  20145. default:
  20146. goto _43
  20147. }
  20148. goto _44
  20149. _32:
  20150. ;
  20151. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))&libc.Int32FromInt32(0x1F))) != 0) {
  20152. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20153. return m_XML_TOK_INVALID
  20154. } /* fall through */
  20155. _34:
  20156. ;
  20157. _33:
  20158. ;
  20159. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20160. goto _44
  20161. _35:
  20162. ;
  20163. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(2) {
  20164. return -int32(2)
  20165. }
  20166. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20167. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20168. return m_XML_TOK_INVALID
  20169. }
  20170. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20171. goto _44
  20172. _36:
  20173. ;
  20174. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(3) {
  20175. return -int32(2)
  20176. }
  20177. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20178. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20179. return m_XML_TOK_INVALID
  20180. }
  20181. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  20182. goto _44
  20183. _37:
  20184. ;
  20185. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(4) {
  20186. return -int32(2)
  20187. }
  20188. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20189. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20190. return m_XML_TOK_INVALID
  20191. }
  20192. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  20193. goto _44
  20194. _40:
  20195. ;
  20196. _39:
  20197. ;
  20198. _38:
  20199. ;
  20200. goto _29
  20201. _41:
  20202. ;
  20203. goto gt
  20204. gt:
  20205. ;
  20206. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  20207. return int32(m_XML_TOK_START_TAG_WITH_ATTS)
  20208. _42:
  20209. ;
  20210. goto sol
  20211. sol:
  20212. ;
  20213. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20214. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20215. return -int32(1)
  20216. }
  20217. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == int32(m_ASCII_GT1)) {
  20218. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20219. return m_XML_TOK_INVALID
  20220. }
  20221. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  20222. return int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS)
  20223. _43:
  20224. ;
  20225. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20226. return m_XML_TOK_INVALID
  20227. _44:
  20228. ;
  20229. goto _28
  20230. goto _29
  20231. _29:
  20232. ;
  20233. goto _30
  20234. goto _28
  20235. _28:
  20236. ;
  20237. goto _17
  20238. _16:
  20239. ;
  20240. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20241. return m_XML_TOK_INVALID
  20242. _17:
  20243. }
  20244. return -int32(1)
  20245. }
  20246. /* ptr points to character following "<" */
  20247. func _little2_scanLt(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20248. var hadColon, v1, v2, v21, v22, v3 int32
  20249. _, _, _, _, _, _ = hadColon, v1, v2, v21, v22, v3
  20250. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20251. return -int32(1)
  20252. }
  20253. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20254. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20255. } else {
  20256. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20257. }
  20258. switch v1 {
  20259. case int32(_BT_NONASCII):
  20260. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  20261. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20262. return m_XML_TOK_INVALID
  20263. } /* fall through */
  20264. fallthrough
  20265. case int32(_BT_NMSTRT):
  20266. fallthrough
  20267. case int32(_BT_HEX):
  20268. ptr += uintptr(2)
  20269. case int32(_BT_LEAD2):
  20270. if int32(end)-int32(ptr) < int32(2) {
  20271. return -int32(2)
  20272. }
  20273. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20274. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20275. return m_XML_TOK_INVALID
  20276. }
  20277. ptr += uintptr(2)
  20278. case int32(_BT_LEAD3):
  20279. if int32(end)-int32(ptr) < int32(3) {
  20280. return -int32(2)
  20281. }
  20282. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20283. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20284. return m_XML_TOK_INVALID
  20285. }
  20286. ptr += uintptr(3)
  20287. case int32(_BT_LEAD4):
  20288. if int32(end)-int32(ptr) < int32(4) {
  20289. return -int32(2)
  20290. }
  20291. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20292. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20293. return m_XML_TOK_INVALID
  20294. }
  20295. ptr += uintptr(4)
  20296. case int32(_BT_EXCL):
  20297. ptr += uintptr(2)
  20298. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20299. return -int32(1)
  20300. }
  20301. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20302. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20303. } else {
  20304. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20305. }
  20306. switch v2 {
  20307. case int32(_BT_MINUS):
  20308. return _little2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20309. case int32(_BT_LSQB):
  20310. return _little2_scanCdataSection(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20311. }
  20312. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20313. return m_XML_TOK_INVALID
  20314. case int32(_BT_QUEST):
  20315. return _little2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20316. case int32(_BT_SOL):
  20317. return _little2_scanEndTag(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20318. default:
  20319. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20320. return m_XML_TOK_INVALID
  20321. }
  20322. hadColon = 0
  20323. /* we have a start-tag */
  20324. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  20325. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20326. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20327. } else {
  20328. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20329. }
  20330. switch v3 {
  20331. case int32(_BT_NONASCII):
  20332. goto _4
  20333. case int32(_BT_MINUS):
  20334. goto _5
  20335. case int32(_BT_NAME):
  20336. goto _6
  20337. case int32(_BT_DIGIT):
  20338. goto _7
  20339. case int32(_BT_HEX):
  20340. goto _8
  20341. case int32(_BT_NMSTRT):
  20342. goto _9
  20343. case int32(_BT_LEAD2):
  20344. goto _10
  20345. case int32(_BT_LEAD3):
  20346. goto _11
  20347. case int32(_BT_LEAD4):
  20348. goto _12
  20349. case int32(_BT_COLON):
  20350. goto _13
  20351. case int32(_BT_LF):
  20352. goto _14
  20353. case int32(_BT_CR):
  20354. goto _15
  20355. case int32(_BT_S):
  20356. goto _16
  20357. case int32(_BT_GT):
  20358. goto _17
  20359. case int32(_BT_SOL):
  20360. goto _18
  20361. default:
  20362. goto _19
  20363. }
  20364. goto _20
  20365. _4:
  20366. ;
  20367. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  20368. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20369. return m_XML_TOK_INVALID
  20370. } /* fall through */
  20371. _9:
  20372. ;
  20373. _8:
  20374. ;
  20375. _7:
  20376. ;
  20377. _6:
  20378. ;
  20379. _5:
  20380. ;
  20381. ptr += uintptr(2)
  20382. goto _20
  20383. _10:
  20384. ;
  20385. if int32(end)-int32(ptr) < int32(2) {
  20386. return -int32(2)
  20387. }
  20388. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20389. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20390. return m_XML_TOK_INVALID
  20391. }
  20392. ptr += uintptr(2)
  20393. goto _20
  20394. _11:
  20395. ;
  20396. if int32(end)-int32(ptr) < int32(3) {
  20397. return -int32(2)
  20398. }
  20399. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20400. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20401. return m_XML_TOK_INVALID
  20402. }
  20403. ptr += uintptr(3)
  20404. goto _20
  20405. _12:
  20406. ;
  20407. if int32(end)-int32(ptr) < int32(4) {
  20408. return -int32(2)
  20409. }
  20410. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20411. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20412. return m_XML_TOK_INVALID
  20413. }
  20414. ptr += uintptr(4)
  20415. goto _20
  20416. _13:
  20417. ;
  20418. if hadColon != 0 {
  20419. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20420. return m_XML_TOK_INVALID
  20421. }
  20422. hadColon = int32(1)
  20423. ptr += uintptr(2)
  20424. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20425. return -int32(1)
  20426. }
  20427. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20428. v21 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20429. } else {
  20430. v21 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20431. }
  20432. switch v21 {
  20433. case int32(_BT_NONASCII):
  20434. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  20435. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20436. return m_XML_TOK_INVALID
  20437. } /* fall through */
  20438. fallthrough
  20439. case int32(_BT_NMSTRT):
  20440. fallthrough
  20441. case int32(_BT_HEX):
  20442. ptr += uintptr(2)
  20443. case int32(_BT_LEAD2):
  20444. if int32(end)-int32(ptr) < int32(2) {
  20445. return -int32(2)
  20446. }
  20447. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20448. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20449. return m_XML_TOK_INVALID
  20450. }
  20451. ptr += uintptr(2)
  20452. case int32(_BT_LEAD3):
  20453. if int32(end)-int32(ptr) < int32(3) {
  20454. return -int32(2)
  20455. }
  20456. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20457. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20458. return m_XML_TOK_INVALID
  20459. }
  20460. ptr += uintptr(3)
  20461. case int32(_BT_LEAD4):
  20462. if int32(end)-int32(ptr) < int32(4) {
  20463. return -int32(2)
  20464. }
  20465. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20466. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20467. return m_XML_TOK_INVALID
  20468. }
  20469. ptr += uintptr(4)
  20470. default:
  20471. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20472. return m_XML_TOK_INVALID
  20473. }
  20474. goto _20
  20475. _16:
  20476. ;
  20477. _15:
  20478. ;
  20479. _14:
  20480. ;
  20481. ptr += uintptr(2)
  20482. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  20483. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20484. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20485. } else {
  20486. v22 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20487. }
  20488. switch v22 {
  20489. case int32(_BT_NONASCII):
  20490. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  20491. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20492. return m_XML_TOK_INVALID
  20493. } /* fall through */
  20494. fallthrough
  20495. case int32(_BT_NMSTRT):
  20496. fallthrough
  20497. case int32(_BT_HEX):
  20498. ptr += uintptr(2)
  20499. case int32(_BT_LEAD2):
  20500. if int32(end)-int32(ptr) < int32(2) {
  20501. return -int32(2)
  20502. }
  20503. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20504. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20505. return m_XML_TOK_INVALID
  20506. }
  20507. ptr += uintptr(2)
  20508. case int32(_BT_LEAD3):
  20509. if int32(end)-int32(ptr) < int32(3) {
  20510. return -int32(2)
  20511. }
  20512. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20513. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20514. return m_XML_TOK_INVALID
  20515. }
  20516. ptr += uintptr(3)
  20517. case int32(_BT_LEAD4):
  20518. if int32(end)-int32(ptr) < int32(4) {
  20519. return -int32(2)
  20520. }
  20521. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20522. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20523. return m_XML_TOK_INVALID
  20524. }
  20525. ptr += uintptr(4)
  20526. case int32(_BT_GT):
  20527. goto gt
  20528. case int32(_BT_SOL):
  20529. goto sol
  20530. case int32(_BT_S):
  20531. fallthrough
  20532. case int32(_BT_CR):
  20533. fallthrough
  20534. case int32(_BT_LF):
  20535. ptr += uintptr(2)
  20536. continue
  20537. default:
  20538. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20539. return m_XML_TOK_INVALID
  20540. }
  20541. return _little2_scanAtts(tls, enc, ptr, end, nextTokPtr)
  20542. }
  20543. return -int32(1)
  20544. _17:
  20545. ;
  20546. goto gt
  20547. gt:
  20548. ;
  20549. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20550. return int32(m_XML_TOK_START_TAG_NO_ATTS)
  20551. _18:
  20552. ;
  20553. goto sol
  20554. sol:
  20555. ;
  20556. ptr += uintptr(2)
  20557. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20558. return -int32(1)
  20559. }
  20560. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  20561. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20562. return m_XML_TOK_INVALID
  20563. }
  20564. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20565. return int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS)
  20566. _19:
  20567. ;
  20568. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20569. return m_XML_TOK_INVALID
  20570. _20:
  20571. }
  20572. return -int32(1)
  20573. }
  20574. func _little2_contentTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20575. var n Tsize_t
  20576. var v1, v2, v3 int32
  20577. _, _, _, _ = n, v1, v2, v3
  20578. if ptr >= end {
  20579. return -int32(4)
  20580. }
  20581. if int32(2) > int32(1) {
  20582. n = libc.Uint32FromInt32(int32(end) - int32(ptr))
  20583. if n&libc.Uint32FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  20584. n &= libc.Uint32FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  20585. if n == uint32(0) {
  20586. return -int32(1)
  20587. }
  20588. end = ptr + uintptr(n)
  20589. }
  20590. }
  20591. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20592. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20593. } else {
  20594. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20595. }
  20596. switch v1 {
  20597. case int32(_BT_LT):
  20598. return _little2_scanLt(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20599. case int32(_BT_AMP):
  20600. return _little2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20601. case int32(_BT_CR):
  20602. ptr += uintptr(2)
  20603. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20604. return -int32(3)
  20605. }
  20606. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20607. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20608. } else {
  20609. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20610. }
  20611. if v2 == int32(_BT_LF) {
  20612. ptr += uintptr(2)
  20613. }
  20614. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20615. return int32(m_XML_TOK_DATA_NEWLINE)
  20616. case int32(_BT_LF):
  20617. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20618. return int32(m_XML_TOK_DATA_NEWLINE)
  20619. case int32(_BT_RSQB):
  20620. ptr += uintptr(2)
  20621. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20622. return -int32(5)
  20623. }
  20624. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1)) {
  20625. break
  20626. }
  20627. ptr += uintptr(2)
  20628. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20629. return -int32(5)
  20630. }
  20631. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  20632. ptr -= uintptr(2)
  20633. break
  20634. }
  20635. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20636. return m_XML_TOK_INVALID
  20637. case int32(_BT_LEAD2):
  20638. if int32(end)-int32(ptr) < int32(2) {
  20639. return -int32(2)
  20640. }
  20641. if 0 != 0 {
  20642. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20643. return m_XML_TOK_INVALID
  20644. }
  20645. ptr += uintptr(2)
  20646. case int32(_BT_LEAD3):
  20647. if int32(end)-int32(ptr) < int32(3) {
  20648. return -int32(2)
  20649. }
  20650. if 0 != 0 {
  20651. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20652. return m_XML_TOK_INVALID
  20653. }
  20654. ptr += uintptr(3)
  20655. case int32(_BT_LEAD4):
  20656. if int32(end)-int32(ptr) < int32(4) {
  20657. return -int32(2)
  20658. }
  20659. if 0 != 0 {
  20660. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20661. return m_XML_TOK_INVALID
  20662. }
  20663. ptr += uintptr(4)
  20664. case int32(_BT_NONXML):
  20665. fallthrough
  20666. case int32(_BT_MALFORM):
  20667. fallthrough
  20668. case int32(_BT_TRAIL):
  20669. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20670. return m_XML_TOK_INVALID
  20671. default:
  20672. ptr += uintptr(2)
  20673. break
  20674. }
  20675. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  20676. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20677. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20678. } else {
  20679. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20680. }
  20681. switch v3 {
  20682. case int32(_BT_LEAD2):
  20683. if int32(end)-int32(ptr) < int32(2) || libc.Bool(0 != 0) {
  20684. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20685. return int32(m_XML_TOK_DATA_CHARS)
  20686. }
  20687. ptr += uintptr(2)
  20688. case int32(_BT_LEAD3):
  20689. if int32(end)-int32(ptr) < int32(3) || libc.Bool(0 != 0) {
  20690. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20691. return int32(m_XML_TOK_DATA_CHARS)
  20692. }
  20693. ptr += uintptr(3)
  20694. case int32(_BT_LEAD4):
  20695. if int32(end)-int32(ptr) < int32(4) || libc.Bool(0 != 0) {
  20696. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20697. return int32(m_XML_TOK_DATA_CHARS)
  20698. }
  20699. ptr += uintptr(4)
  20700. case int32(_BT_RSQB):
  20701. if int32(end)-int32(ptr) >= libc.Int32FromInt32(2)*libc.Int32FromInt32(2) {
  20702. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == int32(m_ASCII_RSQB1)) {
  20703. ptr += uintptr(2)
  20704. break
  20705. }
  20706. if int32(end)-int32(ptr) >= libc.Int32FromInt32(3)*libc.Int32FromInt32(2) {
  20707. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))))) == int32(m_ASCII_GT1)) {
  20708. ptr += uintptr(2)
  20709. break
  20710. }
  20711. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  20712. return m_XML_TOK_INVALID
  20713. }
  20714. }
  20715. /* fall through */
  20716. fallthrough
  20717. case int32(_BT_AMP):
  20718. fallthrough
  20719. case int32(_BT_LT):
  20720. fallthrough
  20721. case int32(_BT_NONXML):
  20722. fallthrough
  20723. case int32(_BT_MALFORM):
  20724. fallthrough
  20725. case int32(_BT_TRAIL):
  20726. fallthrough
  20727. case int32(_BT_CR):
  20728. fallthrough
  20729. case int32(_BT_LF):
  20730. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20731. return int32(m_XML_TOK_DATA_CHARS)
  20732. default:
  20733. ptr += uintptr(2)
  20734. break
  20735. }
  20736. }
  20737. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20738. return int32(m_XML_TOK_DATA_CHARS)
  20739. }
  20740. /* ptr points to character following "%" */
  20741. func _little2_scanPercent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20742. var v1, v2 int32
  20743. _, _ = v1, v2
  20744. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20745. return -int32(1)
  20746. }
  20747. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20748. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20749. } else {
  20750. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20751. }
  20752. switch v1 {
  20753. case int32(_BT_NONASCII):
  20754. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  20755. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20756. return m_XML_TOK_INVALID
  20757. } /* fall through */
  20758. fallthrough
  20759. case int32(_BT_NMSTRT):
  20760. fallthrough
  20761. case int32(_BT_HEX):
  20762. ptr += uintptr(2)
  20763. case int32(_BT_LEAD2):
  20764. if int32(end)-int32(ptr) < int32(2) {
  20765. return -int32(2)
  20766. }
  20767. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20768. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20769. return m_XML_TOK_INVALID
  20770. }
  20771. ptr += uintptr(2)
  20772. case int32(_BT_LEAD3):
  20773. if int32(end)-int32(ptr) < int32(3) {
  20774. return -int32(2)
  20775. }
  20776. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20777. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20778. return m_XML_TOK_INVALID
  20779. }
  20780. ptr += uintptr(3)
  20781. case int32(_BT_LEAD4):
  20782. if int32(end)-int32(ptr) < int32(4) {
  20783. return -int32(2)
  20784. }
  20785. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20786. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20787. return m_XML_TOK_INVALID
  20788. }
  20789. ptr += uintptr(4)
  20790. case int32(_BT_S):
  20791. fallthrough
  20792. case int32(_BT_LF):
  20793. fallthrough
  20794. case int32(_BT_CR):
  20795. fallthrough
  20796. case int32(_BT_PERCNT):
  20797. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20798. return int32(m_XML_TOK_PERCENT)
  20799. default:
  20800. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20801. return m_XML_TOK_INVALID
  20802. }
  20803. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  20804. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20805. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20806. } else {
  20807. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20808. }
  20809. switch v2 {
  20810. case int32(_BT_NONASCII):
  20811. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  20812. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20813. return m_XML_TOK_INVALID
  20814. } /* fall through */
  20815. fallthrough
  20816. case int32(_BT_NMSTRT):
  20817. fallthrough
  20818. case int32(_BT_HEX):
  20819. fallthrough
  20820. case int32(_BT_DIGIT):
  20821. fallthrough
  20822. case int32(_BT_NAME):
  20823. fallthrough
  20824. case int32(_BT_MINUS):
  20825. ptr += uintptr(2)
  20826. case int32(_BT_LEAD2):
  20827. if int32(end)-int32(ptr) < int32(2) {
  20828. return -int32(2)
  20829. }
  20830. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20831. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20832. return m_XML_TOK_INVALID
  20833. }
  20834. ptr += uintptr(2)
  20835. case int32(_BT_LEAD3):
  20836. if int32(end)-int32(ptr) < int32(3) {
  20837. return -int32(2)
  20838. }
  20839. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20840. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20841. return m_XML_TOK_INVALID
  20842. }
  20843. ptr += uintptr(3)
  20844. case int32(_BT_LEAD4):
  20845. if int32(end)-int32(ptr) < int32(4) {
  20846. return -int32(2)
  20847. }
  20848. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20849. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20850. return m_XML_TOK_INVALID
  20851. }
  20852. ptr += uintptr(4)
  20853. case int32(_BT_SEMI):
  20854. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20855. return int32(m_XML_TOK_PARAM_ENTITY_REF)
  20856. default:
  20857. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20858. return m_XML_TOK_INVALID
  20859. }
  20860. }
  20861. return -int32(1)
  20862. }
  20863. func _little2_scanPoundName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20864. var v1, v2 int32
  20865. _, _ = v1, v2
  20866. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20867. return -int32(1)
  20868. }
  20869. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20870. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20871. } else {
  20872. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20873. }
  20874. switch v1 {
  20875. case int32(_BT_NONASCII):
  20876. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  20877. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20878. return m_XML_TOK_INVALID
  20879. } /* fall through */
  20880. fallthrough
  20881. case int32(_BT_NMSTRT):
  20882. fallthrough
  20883. case int32(_BT_HEX):
  20884. ptr += uintptr(2)
  20885. case int32(_BT_LEAD2):
  20886. if int32(end)-int32(ptr) < int32(2) {
  20887. return -int32(2)
  20888. }
  20889. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20890. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20891. return m_XML_TOK_INVALID
  20892. }
  20893. ptr += uintptr(2)
  20894. case int32(_BT_LEAD3):
  20895. if int32(end)-int32(ptr) < int32(3) {
  20896. return -int32(2)
  20897. }
  20898. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20899. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20900. return m_XML_TOK_INVALID
  20901. }
  20902. ptr += uintptr(3)
  20903. case int32(_BT_LEAD4):
  20904. if int32(end)-int32(ptr) < int32(4) {
  20905. return -int32(2)
  20906. }
  20907. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20908. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20909. return m_XML_TOK_INVALID
  20910. }
  20911. ptr += uintptr(4)
  20912. default:
  20913. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20914. return m_XML_TOK_INVALID
  20915. }
  20916. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  20917. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20918. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20919. } else {
  20920. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20921. }
  20922. switch v2 {
  20923. case int32(_BT_NONASCII):
  20924. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  20925. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20926. return m_XML_TOK_INVALID
  20927. } /* fall through */
  20928. fallthrough
  20929. case int32(_BT_NMSTRT):
  20930. fallthrough
  20931. case int32(_BT_HEX):
  20932. fallthrough
  20933. case int32(_BT_DIGIT):
  20934. fallthrough
  20935. case int32(_BT_NAME):
  20936. fallthrough
  20937. case int32(_BT_MINUS):
  20938. ptr += uintptr(2)
  20939. case int32(_BT_LEAD2):
  20940. if int32(end)-int32(ptr) < int32(2) {
  20941. return -int32(2)
  20942. }
  20943. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20944. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20945. return m_XML_TOK_INVALID
  20946. }
  20947. ptr += uintptr(2)
  20948. case int32(_BT_LEAD3):
  20949. if int32(end)-int32(ptr) < int32(3) {
  20950. return -int32(2)
  20951. }
  20952. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20953. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20954. return m_XML_TOK_INVALID
  20955. }
  20956. ptr += uintptr(3)
  20957. case int32(_BT_LEAD4):
  20958. if int32(end)-int32(ptr) < int32(4) {
  20959. return -int32(2)
  20960. }
  20961. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20962. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20963. return m_XML_TOK_INVALID
  20964. }
  20965. ptr += uintptr(4)
  20966. case int32(_BT_CR):
  20967. fallthrough
  20968. case int32(_BT_LF):
  20969. fallthrough
  20970. case int32(_BT_S):
  20971. fallthrough
  20972. case int32(_BT_RPAR):
  20973. fallthrough
  20974. case int32(_BT_GT):
  20975. fallthrough
  20976. case int32(_BT_PERCNT):
  20977. fallthrough
  20978. case int32(_BT_VERBAR):
  20979. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20980. return int32(m_XML_TOK_POUND_NAME)
  20981. default:
  20982. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20983. return m_XML_TOK_INVALID
  20984. }
  20985. }
  20986. return -int32(m_XML_TOK_POUND_NAME)
  20987. }
  20988. func _little2_scanLit(tls *libc.TLS, open int32, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20989. var t, v1, v2 int32
  20990. _, _, _ = t, v1, v2
  20991. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  20992. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20993. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20994. } else {
  20995. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20996. }
  20997. t = v1
  20998. switch t {
  20999. case int32(_BT_LEAD2):
  21000. if int32(end)-int32(ptr) < int32(2) {
  21001. return -int32(2)
  21002. }
  21003. if 0 != 0 {
  21004. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21005. return m_XML_TOK_INVALID
  21006. }
  21007. ptr += uintptr(2)
  21008. case int32(_BT_LEAD3):
  21009. if int32(end)-int32(ptr) < int32(3) {
  21010. return -int32(2)
  21011. }
  21012. if 0 != 0 {
  21013. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21014. return m_XML_TOK_INVALID
  21015. }
  21016. ptr += uintptr(3)
  21017. case int32(_BT_LEAD4):
  21018. if int32(end)-int32(ptr) < int32(4) {
  21019. return -int32(2)
  21020. }
  21021. if 0 != 0 {
  21022. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21023. return m_XML_TOK_INVALID
  21024. }
  21025. ptr += uintptr(4)
  21026. case int32(_BT_NONXML):
  21027. fallthrough
  21028. case int32(_BT_MALFORM):
  21029. fallthrough
  21030. case int32(_BT_TRAIL):
  21031. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21032. return m_XML_TOK_INVALID
  21033. case int32(_BT_QUOT):
  21034. fallthrough
  21035. case int32(_BT_APOS):
  21036. ptr += uintptr(2)
  21037. if t != open {
  21038. break
  21039. }
  21040. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21041. return -int32(m_XML_TOK_LITERAL)
  21042. }
  21043. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21044. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21045. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21046. } else {
  21047. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21048. }
  21049. switch v2 {
  21050. case int32(_BT_S):
  21051. fallthrough
  21052. case int32(_BT_CR):
  21053. fallthrough
  21054. case int32(_BT_LF):
  21055. fallthrough
  21056. case int32(_BT_GT):
  21057. fallthrough
  21058. case int32(_BT_PERCNT):
  21059. fallthrough
  21060. case int32(_BT_LSQB):
  21061. return int32(m_XML_TOK_LITERAL)
  21062. default:
  21063. return m_XML_TOK_INVALID
  21064. }
  21065. fallthrough
  21066. default:
  21067. ptr += uintptr(2)
  21068. break
  21069. }
  21070. }
  21071. return -int32(1)
  21072. }
  21073. func _little2_prologTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21074. var n Tsize_t
  21075. var tok, v1, v29, v33, v34, v35, v36 int32
  21076. _, _, _, _, _, _, _, _ = n, tok, v1, v29, v33, v34, v35, v36
  21077. if ptr >= end {
  21078. return -int32(4)
  21079. }
  21080. if int32(2) > int32(1) {
  21081. n = libc.Uint32FromInt32(int32(end) - int32(ptr))
  21082. if n&libc.Uint32FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  21083. n &= libc.Uint32FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  21084. if n == uint32(0) {
  21085. return -int32(1)
  21086. }
  21087. end = ptr + uintptr(n)
  21088. }
  21089. }
  21090. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21091. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21092. } else {
  21093. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21094. }
  21095. switch v1 {
  21096. case int32(_BT_QUOT):
  21097. goto _2
  21098. case int32(_BT_APOS):
  21099. goto _3
  21100. case int32(_BT_LT):
  21101. goto _4
  21102. case int32(_BT_CR):
  21103. goto _5
  21104. case int32(_BT_LF):
  21105. goto _6
  21106. case int32(_BT_S):
  21107. goto _7
  21108. case int32(_BT_PERCNT):
  21109. goto _8
  21110. case int32(_BT_COMMA):
  21111. goto _9
  21112. case int32(_BT_LSQB):
  21113. goto _10
  21114. case int32(_BT_RSQB):
  21115. goto _11
  21116. case int32(_BT_LPAR):
  21117. goto _12
  21118. case int32(_BT_RPAR):
  21119. goto _13
  21120. case int32(_BT_VERBAR):
  21121. goto _14
  21122. case int32(_BT_GT):
  21123. goto _15
  21124. case int32(_BT_NUM):
  21125. goto _16
  21126. case int32(_BT_LEAD2):
  21127. goto _17
  21128. case int32(_BT_LEAD3):
  21129. goto _18
  21130. case int32(_BT_LEAD4):
  21131. goto _19
  21132. case int32(_BT_HEX):
  21133. goto _20
  21134. case int32(_BT_NMSTRT):
  21135. goto _21
  21136. case int32(_BT_COLON):
  21137. goto _22
  21138. case int32(_BT_MINUS):
  21139. goto _23
  21140. case int32(_BT_NAME):
  21141. goto _24
  21142. case int32(_BT_DIGIT):
  21143. goto _25
  21144. case int32(_BT_NONASCII):
  21145. goto _26
  21146. default:
  21147. goto _27
  21148. }
  21149. goto _28
  21150. _2:
  21151. ;
  21152. return _little2_scanLit(tls, int32(_BT_QUOT), enc, ptr+uintptr(2), end, nextTokPtr)
  21153. _3:
  21154. ;
  21155. return _little2_scanLit(tls, int32(_BT_APOS), enc, ptr+uintptr(2), end, nextTokPtr)
  21156. _4:
  21157. ;
  21158. ptr += uintptr(2)
  21159. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21160. return -int32(1)
  21161. }
  21162. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21163. v29 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21164. } else {
  21165. v29 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21166. }
  21167. switch v29 {
  21168. case int32(_BT_EXCL):
  21169. return _little2_scanDecl(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21170. case int32(_BT_QUEST):
  21171. return _little2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21172. case int32(_BT_NMSTRT):
  21173. fallthrough
  21174. case int32(_BT_HEX):
  21175. fallthrough
  21176. case int32(_BT_NONASCII):
  21177. fallthrough
  21178. case int32(_BT_LEAD2):
  21179. fallthrough
  21180. case int32(_BT_LEAD3):
  21181. fallthrough
  21182. case int32(_BT_LEAD4):
  21183. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr - uintptr(2)
  21184. return int32(m_XML_TOK_INSTANCE_START)
  21185. }
  21186. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21187. return m_XML_TOK_INVALID
  21188. _5:
  21189. ;
  21190. if ptr+uintptr(2) == end {
  21191. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = end
  21192. /* indicate that this might be part of a CR/LF pair */
  21193. return -int32(m_XML_TOK_PROLOG_S)
  21194. }
  21195. /* fall through */
  21196. _7:
  21197. ;
  21198. _6:
  21199. ;
  21200. _32:
  21201. ;
  21202. ptr += uintptr(2)
  21203. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21204. goto _30
  21205. }
  21206. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21207. v33 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21208. } else {
  21209. v33 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21210. }
  21211. switch v33 {
  21212. case int32(_BT_S):
  21213. fallthrough
  21214. case int32(_BT_LF):
  21215. case int32(_BT_CR):
  21216. /* don't split CR/LF pair */
  21217. if ptr+uintptr(2) != end {
  21218. break
  21219. }
  21220. /* fall through */
  21221. fallthrough
  21222. default:
  21223. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21224. return int32(m_XML_TOK_PROLOG_S)
  21225. }
  21226. goto _31
  21227. _31:
  21228. ;
  21229. goto _32
  21230. goto _30
  21231. _30:
  21232. ;
  21233. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21234. return int32(m_XML_TOK_PROLOG_S)
  21235. _8:
  21236. ;
  21237. return _little2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21238. _9:
  21239. ;
  21240. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21241. return int32(m_XML_TOK_COMMA)
  21242. _10:
  21243. ;
  21244. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21245. return int32(m_XML_TOK_OPEN_BRACKET)
  21246. _11:
  21247. ;
  21248. ptr += uintptr(2)
  21249. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21250. return -int32(m_XML_TOK_CLOSE_BRACKET)
  21251. }
  21252. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  21253. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) {
  21254. return -int32(1)
  21255. }
  21256. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == int32(m_ASCII_GT1) {
  21257. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  21258. return int32(m_XML_TOK_COND_SECT_CLOSE)
  21259. }
  21260. }
  21261. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21262. return int32(m_XML_TOK_CLOSE_BRACKET)
  21263. _12:
  21264. ;
  21265. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21266. return int32(m_XML_TOK_OPEN_PAREN)
  21267. _13:
  21268. ;
  21269. ptr += uintptr(2)
  21270. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21271. return -int32(m_XML_TOK_CLOSE_PAREN)
  21272. }
  21273. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21274. v34 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21275. } else {
  21276. v34 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21277. }
  21278. switch v34 {
  21279. case int32(_BT_AST):
  21280. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21281. return int32(m_XML_TOK_CLOSE_PAREN_ASTERISK)
  21282. case int32(_BT_QUEST):
  21283. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21284. return int32(m_XML_TOK_CLOSE_PAREN_QUESTION)
  21285. case int32(_BT_PLUS):
  21286. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21287. return int32(m_XML_TOK_CLOSE_PAREN_PLUS)
  21288. case int32(_BT_CR):
  21289. fallthrough
  21290. case int32(_BT_LF):
  21291. fallthrough
  21292. case int32(_BT_S):
  21293. fallthrough
  21294. case int32(_BT_GT):
  21295. fallthrough
  21296. case int32(_BT_COMMA):
  21297. fallthrough
  21298. case int32(_BT_VERBAR):
  21299. fallthrough
  21300. case int32(_BT_RPAR):
  21301. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21302. return int32(m_XML_TOK_CLOSE_PAREN)
  21303. }
  21304. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21305. return m_XML_TOK_INVALID
  21306. _14:
  21307. ;
  21308. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21309. return int32(m_XML_TOK_OR)
  21310. _15:
  21311. ;
  21312. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21313. return int32(m_XML_TOK_DECL_CLOSE)
  21314. _16:
  21315. ;
  21316. return _little2_scanPoundName(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21317. _17:
  21318. ;
  21319. if int32(end)-int32(ptr) < int32(2) {
  21320. return -int32(2)
  21321. }
  21322. if 0 != 0 {
  21323. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21324. return m_XML_TOK_INVALID
  21325. }
  21326. if 0 != 0 {
  21327. ptr += uintptr(2)
  21328. tok = int32(m_XML_TOK_NAME)
  21329. goto _28
  21330. }
  21331. if 0 != 0 {
  21332. ptr += uintptr(2)
  21333. tok = int32(m_XML_TOK_NMTOKEN)
  21334. goto _28
  21335. }
  21336. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21337. return m_XML_TOK_INVALID
  21338. _18:
  21339. ;
  21340. if int32(end)-int32(ptr) < int32(3) {
  21341. return -int32(2)
  21342. }
  21343. if 0 != 0 {
  21344. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21345. return m_XML_TOK_INVALID
  21346. }
  21347. if 0 != 0 {
  21348. ptr += uintptr(3)
  21349. tok = int32(m_XML_TOK_NAME)
  21350. goto _28
  21351. }
  21352. if 0 != 0 {
  21353. ptr += uintptr(3)
  21354. tok = int32(m_XML_TOK_NMTOKEN)
  21355. goto _28
  21356. }
  21357. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21358. return m_XML_TOK_INVALID
  21359. _19:
  21360. ;
  21361. if int32(end)-int32(ptr) < int32(4) {
  21362. return -int32(2)
  21363. }
  21364. if 0 != 0 {
  21365. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21366. return m_XML_TOK_INVALID
  21367. }
  21368. if 0 != 0 {
  21369. ptr += uintptr(4)
  21370. tok = int32(m_XML_TOK_NAME)
  21371. goto _28
  21372. }
  21373. if 0 != 0 {
  21374. ptr += uintptr(4)
  21375. tok = int32(m_XML_TOK_NMTOKEN)
  21376. goto _28
  21377. }
  21378. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21379. return m_XML_TOK_INVALID
  21380. _21:
  21381. ;
  21382. _20:
  21383. ;
  21384. tok = int32(m_XML_TOK_NAME)
  21385. ptr += uintptr(2)
  21386. goto _28
  21387. _25:
  21388. ;
  21389. _24:
  21390. ;
  21391. _23:
  21392. ;
  21393. _22:
  21394. ;
  21395. tok = int32(m_XML_TOK_NMTOKEN)
  21396. ptr += uintptr(2)
  21397. goto _28
  21398. _26:
  21399. ;
  21400. if _namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&int32(0x1F))) != 0 {
  21401. ptr += uintptr(2)
  21402. tok = int32(m_XML_TOK_NAME)
  21403. goto _28
  21404. }
  21405. if _namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&int32(0x1F))) != 0 {
  21406. ptr += uintptr(2)
  21407. tok = int32(m_XML_TOK_NMTOKEN)
  21408. goto _28
  21409. }
  21410. /* fall through */
  21411. _27:
  21412. ;
  21413. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21414. return m_XML_TOK_INVALID
  21415. _28:
  21416. ;
  21417. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  21418. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21419. v35 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21420. } else {
  21421. v35 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21422. }
  21423. switch v35 {
  21424. case int32(_BT_NONASCII):
  21425. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  21426. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21427. return m_XML_TOK_INVALID
  21428. } /* fall through */
  21429. fallthrough
  21430. case int32(_BT_NMSTRT):
  21431. fallthrough
  21432. case int32(_BT_HEX):
  21433. fallthrough
  21434. case int32(_BT_DIGIT):
  21435. fallthrough
  21436. case int32(_BT_NAME):
  21437. fallthrough
  21438. case int32(_BT_MINUS):
  21439. ptr += uintptr(2)
  21440. case int32(_BT_LEAD2):
  21441. if int32(end)-int32(ptr) < int32(2) {
  21442. return -int32(2)
  21443. }
  21444. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21445. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21446. return m_XML_TOK_INVALID
  21447. }
  21448. ptr += uintptr(2)
  21449. case int32(_BT_LEAD3):
  21450. if int32(end)-int32(ptr) < int32(3) {
  21451. return -int32(2)
  21452. }
  21453. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21454. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21455. return m_XML_TOK_INVALID
  21456. }
  21457. ptr += uintptr(3)
  21458. case int32(_BT_LEAD4):
  21459. if int32(end)-int32(ptr) < int32(4) {
  21460. return -int32(2)
  21461. }
  21462. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21463. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21464. return m_XML_TOK_INVALID
  21465. }
  21466. ptr += uintptr(4)
  21467. case int32(_BT_GT):
  21468. fallthrough
  21469. case int32(_BT_RPAR):
  21470. fallthrough
  21471. case int32(_BT_COMMA):
  21472. fallthrough
  21473. case int32(_BT_VERBAR):
  21474. fallthrough
  21475. case int32(_BT_LSQB):
  21476. fallthrough
  21477. case int32(_BT_PERCNT):
  21478. fallthrough
  21479. case int32(_BT_S):
  21480. fallthrough
  21481. case int32(_BT_CR):
  21482. fallthrough
  21483. case int32(_BT_LF):
  21484. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21485. return tok
  21486. case int32(_BT_COLON):
  21487. ptr += uintptr(2)
  21488. switch tok {
  21489. case int32(m_XML_TOK_NAME):
  21490. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21491. return -int32(1)
  21492. }
  21493. tok = int32(m_XML_TOK_PREFIXED_NAME)
  21494. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21495. v36 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21496. } else {
  21497. v36 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21498. }
  21499. switch v36 {
  21500. case int32(_BT_NONASCII):
  21501. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  21502. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21503. return m_XML_TOK_INVALID
  21504. } /* fall through */
  21505. fallthrough
  21506. case int32(_BT_NMSTRT):
  21507. fallthrough
  21508. case int32(_BT_HEX):
  21509. fallthrough
  21510. case int32(_BT_DIGIT):
  21511. fallthrough
  21512. case int32(_BT_NAME):
  21513. fallthrough
  21514. case int32(_BT_MINUS):
  21515. ptr += uintptr(2)
  21516. case int32(_BT_LEAD2):
  21517. if int32(end)-int32(ptr) < int32(2) {
  21518. return -int32(2)
  21519. }
  21520. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21521. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21522. return m_XML_TOK_INVALID
  21523. }
  21524. ptr += uintptr(2)
  21525. case int32(_BT_LEAD3):
  21526. if int32(end)-int32(ptr) < int32(3) {
  21527. return -int32(2)
  21528. }
  21529. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21530. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21531. return m_XML_TOK_INVALID
  21532. }
  21533. ptr += uintptr(3)
  21534. case int32(_BT_LEAD4):
  21535. if int32(end)-int32(ptr) < int32(4) {
  21536. return -int32(2)
  21537. }
  21538. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21539. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21540. return m_XML_TOK_INVALID
  21541. }
  21542. ptr += uintptr(4)
  21543. default:
  21544. tok = int32(m_XML_TOK_NMTOKEN)
  21545. break
  21546. }
  21547. case int32(m_XML_TOK_PREFIXED_NAME):
  21548. tok = int32(m_XML_TOK_NMTOKEN)
  21549. break
  21550. }
  21551. case int32(_BT_PLUS):
  21552. if tok == int32(m_XML_TOK_NMTOKEN) {
  21553. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21554. return m_XML_TOK_INVALID
  21555. }
  21556. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21557. return int32(m_XML_TOK_NAME_PLUS)
  21558. case int32(_BT_AST):
  21559. if tok == int32(m_XML_TOK_NMTOKEN) {
  21560. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21561. return m_XML_TOK_INVALID
  21562. }
  21563. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21564. return int32(m_XML_TOK_NAME_ASTERISK)
  21565. case int32(_BT_QUEST):
  21566. if tok == int32(m_XML_TOK_NMTOKEN) {
  21567. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21568. return m_XML_TOK_INVALID
  21569. }
  21570. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21571. return int32(m_XML_TOK_NAME_QUESTION)
  21572. default:
  21573. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21574. return m_XML_TOK_INVALID
  21575. }
  21576. }
  21577. return -tok
  21578. }
  21579. func _little2_attributeValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21580. var start uintptr
  21581. var v1, v2 int32
  21582. _, _, _ = start, v1, v2
  21583. if ptr >= end {
  21584. return -int32(4)
  21585. } else {
  21586. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21587. /* This line cannot be executed. The incoming data has already
  21588. * been tokenized once, so incomplete characters like this have
  21589. * already been eliminated from the input. Retaining the paranoia
  21590. * check is still valuable, however.
  21591. */
  21592. return -int32(1) /* LCOV_EXCL_LINE */
  21593. }
  21594. }
  21595. start = ptr
  21596. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  21597. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21598. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21599. } else {
  21600. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21601. }
  21602. switch v1 {
  21603. case int32(_BT_LEAD2):
  21604. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  21605. case int32(_BT_LEAD3):
  21606. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  21607. case int32(_BT_LEAD4):
  21608. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  21609. case int32(_BT_AMP):
  21610. if ptr == start {
  21611. return _little2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21612. }
  21613. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21614. return int32(m_XML_TOK_DATA_CHARS)
  21615. case int32(_BT_LT):
  21616. /* this is for inside entity references */
  21617. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21618. return m_XML_TOK_INVALID
  21619. case int32(_BT_LF):
  21620. if ptr == start {
  21621. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21622. return int32(m_XML_TOK_DATA_NEWLINE)
  21623. }
  21624. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21625. return int32(m_XML_TOK_DATA_CHARS)
  21626. case int32(_BT_CR):
  21627. if ptr == start {
  21628. ptr += uintptr(2)
  21629. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21630. return -int32(3)
  21631. }
  21632. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21633. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21634. } else {
  21635. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21636. }
  21637. if v2 == int32(_BT_LF) {
  21638. ptr += uintptr(2)
  21639. }
  21640. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21641. return int32(m_XML_TOK_DATA_NEWLINE)
  21642. }
  21643. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21644. return int32(m_XML_TOK_DATA_CHARS)
  21645. case int32(_BT_S):
  21646. if ptr == start {
  21647. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21648. return int32(m_XML_TOK_ATTRIBUTE_VALUE_S)
  21649. }
  21650. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21651. return int32(m_XML_TOK_DATA_CHARS)
  21652. default:
  21653. ptr += uintptr(2)
  21654. break
  21655. }
  21656. }
  21657. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21658. return int32(m_XML_TOK_DATA_CHARS)
  21659. }
  21660. func _little2_entityValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21661. var start uintptr
  21662. var tok, v1, v2, v3 int32
  21663. _, _, _, _, _ = start, tok, v1, v2, v3
  21664. if ptr >= end {
  21665. return -int32(4)
  21666. } else {
  21667. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21668. /* This line cannot be executed. The incoming data has already
  21669. * been tokenized once, so incomplete characters like this have
  21670. * already been eliminated from the input. Retaining the paranoia
  21671. * check is still valuable, however.
  21672. */
  21673. return -int32(1) /* LCOV_EXCL_LINE */
  21674. }
  21675. }
  21676. start = ptr
  21677. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  21678. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21679. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21680. } else {
  21681. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21682. }
  21683. switch v1 {
  21684. case int32(_BT_LEAD2):
  21685. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  21686. case int32(_BT_LEAD3):
  21687. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  21688. case int32(_BT_LEAD4):
  21689. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  21690. case int32(_BT_AMP):
  21691. if ptr == start {
  21692. return _little2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21693. }
  21694. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21695. return int32(m_XML_TOK_DATA_CHARS)
  21696. case int32(_BT_PERCNT):
  21697. if ptr == start {
  21698. tok = _little2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21699. if tok == int32(m_XML_TOK_PERCENT) {
  21700. v2 = m_XML_TOK_INVALID
  21701. } else {
  21702. v2 = tok
  21703. }
  21704. return v2
  21705. }
  21706. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21707. return int32(m_XML_TOK_DATA_CHARS)
  21708. case int32(_BT_LF):
  21709. if ptr == start {
  21710. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21711. return int32(m_XML_TOK_DATA_NEWLINE)
  21712. }
  21713. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21714. return int32(m_XML_TOK_DATA_CHARS)
  21715. case int32(_BT_CR):
  21716. if ptr == start {
  21717. ptr += uintptr(2)
  21718. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21719. return -int32(3)
  21720. }
  21721. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21722. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21723. } else {
  21724. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21725. }
  21726. if v3 == int32(_BT_LF) {
  21727. ptr += uintptr(2)
  21728. }
  21729. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21730. return int32(m_XML_TOK_DATA_NEWLINE)
  21731. }
  21732. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21733. return int32(m_XML_TOK_DATA_CHARS)
  21734. default:
  21735. ptr += uintptr(2)
  21736. break
  21737. }
  21738. }
  21739. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21740. return int32(m_XML_TOK_DATA_CHARS)
  21741. }
  21742. func _little2_ignoreSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21743. var level, v1 int32
  21744. var n Tsize_t
  21745. _, _, _ = level, n, v1
  21746. level = 0
  21747. if int32(2) > int32(1) {
  21748. n = libc.Uint32FromInt32(int32(end) - int32(ptr))
  21749. if n&libc.Uint32FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  21750. n &= libc.Uint32FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  21751. end = ptr + uintptr(n)
  21752. }
  21753. }
  21754. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  21755. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21756. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21757. } else {
  21758. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21759. }
  21760. switch v1 {
  21761. case int32(_BT_LEAD2):
  21762. if int32(end)-int32(ptr) < int32(2) {
  21763. return -int32(2)
  21764. }
  21765. if 0 != 0 {
  21766. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21767. return m_XML_TOK_INVALID
  21768. }
  21769. ptr += uintptr(2)
  21770. case int32(_BT_LEAD3):
  21771. if int32(end)-int32(ptr) < int32(3) {
  21772. return -int32(2)
  21773. }
  21774. if 0 != 0 {
  21775. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21776. return m_XML_TOK_INVALID
  21777. }
  21778. ptr += uintptr(3)
  21779. case int32(_BT_LEAD4):
  21780. if int32(end)-int32(ptr) < int32(4) {
  21781. return -int32(2)
  21782. }
  21783. if 0 != 0 {
  21784. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21785. return m_XML_TOK_INVALID
  21786. }
  21787. ptr += uintptr(4)
  21788. case int32(_BT_NONXML):
  21789. fallthrough
  21790. case int32(_BT_MALFORM):
  21791. fallthrough
  21792. case int32(_BT_TRAIL):
  21793. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21794. return m_XML_TOK_INVALID
  21795. case int32(_BT_LT):
  21796. ptr += uintptr(2)
  21797. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21798. return -int32(1)
  21799. }
  21800. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_EXCL2) {
  21801. ptr += uintptr(2)
  21802. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21803. return -int32(1)
  21804. }
  21805. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_LSQB1) {
  21806. level++
  21807. ptr += uintptr(2)
  21808. }
  21809. }
  21810. case int32(_BT_RSQB):
  21811. ptr += uintptr(2)
  21812. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21813. return -int32(1)
  21814. }
  21815. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  21816. ptr += uintptr(2)
  21817. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21818. return -int32(1)
  21819. }
  21820. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  21821. ptr += uintptr(2)
  21822. if level == 0 {
  21823. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21824. return int32(m_XML_TOK_IGNORE_SECT)
  21825. }
  21826. level--
  21827. }
  21828. }
  21829. default:
  21830. ptr += uintptr(2)
  21831. break
  21832. }
  21833. }
  21834. return -int32(1)
  21835. }
  21836. func _little2_isPublicId(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr) (r int32) {
  21837. var v2, v3, v4 int32
  21838. _, _, _ = v2, v3, v4
  21839. ptr += uintptr(2)
  21840. end -= uintptr(2)
  21841. for {
  21842. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21843. break
  21844. }
  21845. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21846. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21847. } else {
  21848. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21849. }
  21850. switch v2 {
  21851. case int32(_BT_DIGIT):
  21852. fallthrough
  21853. case int32(_BT_HEX):
  21854. fallthrough
  21855. case int32(_BT_MINUS):
  21856. fallthrough
  21857. case int32(_BT_APOS):
  21858. fallthrough
  21859. case int32(_BT_LPAR):
  21860. fallthrough
  21861. case int32(_BT_RPAR):
  21862. fallthrough
  21863. case int32(_BT_PLUS):
  21864. fallthrough
  21865. case int32(_BT_COMMA):
  21866. fallthrough
  21867. case int32(_BT_SOL):
  21868. fallthrough
  21869. case int32(_BT_EQUALS):
  21870. fallthrough
  21871. case int32(_BT_QUEST):
  21872. fallthrough
  21873. case int32(_BT_CR):
  21874. fallthrough
  21875. case int32(_BT_LF):
  21876. fallthrough
  21877. case int32(_BT_SEMI):
  21878. fallthrough
  21879. case int32(_BT_EXCL):
  21880. fallthrough
  21881. case int32(_BT_AST):
  21882. fallthrough
  21883. case int32(_BT_PERCNT):
  21884. fallthrough
  21885. case int32(_BT_NUM):
  21886. fallthrough
  21887. case int32(_BT_COLON):
  21888. case int32(_BT_S):
  21889. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_TAB1) {
  21890. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  21891. return 0
  21892. }
  21893. case int32(_BT_NAME):
  21894. fallthrough
  21895. case int32(_BT_NMSTRT):
  21896. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21897. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  21898. } else {
  21899. v3 = -int32(1)
  21900. }
  21901. if !(v3 & ^libc.Int32FromInt32(0x7f) != 0) {
  21902. break
  21903. }
  21904. /* fall through */
  21905. fallthrough
  21906. default:
  21907. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21908. v4 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  21909. } else {
  21910. v4 = -int32(1)
  21911. }
  21912. switch v4 {
  21913. case int32(0x24): /* $ */
  21914. fallthrough
  21915. case int32(0x40): /* @ */
  21916. default:
  21917. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  21918. return 0
  21919. }
  21920. break
  21921. }
  21922. goto _1
  21923. _1:
  21924. ;
  21925. ptr += uintptr(2)
  21926. }
  21927. return int32(1)
  21928. }
  21929. /* This must only be called for a well-formed start-tag or empty
  21930. element tag. Returns the number of attributes. Pointers to the
  21931. first attsMax attributes are stored in atts.
  21932. */
  21933. func _little2_getAtts(tls *libc.TLS, enc uintptr, ptr uintptr, attsMax int32, atts uintptr) (r int32) {
  21934. var nAtts, open, state, v2, v3, v5, v7 int32
  21935. var v4, v6, v8, v9 bool
  21936. _, _, _, _, _, _, _, _, _, _, _ = nAtts, open, state, v2, v3, v4, v5, v6, v7, v8, v9
  21937. state = 1
  21938. nAtts = 0
  21939. open = 0 /* defined when state == inValue;
  21940. initialization just to shut up compilers */
  21941. ptr += uintptr(2)
  21942. for {
  21943. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21944. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21945. } else {
  21946. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21947. }
  21948. switch v2 {
  21949. case int32(_BT_LEAD2):
  21950. if state == 0 {
  21951. if nAtts < attsMax {
  21952. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fname = ptr
  21953. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = uint8(1)
  21954. }
  21955. state = 1
  21956. }
  21957. ptr += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(2))
  21958. case int32(_BT_LEAD3):
  21959. if state == 0 {
  21960. if nAtts < attsMax {
  21961. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fname = ptr
  21962. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = uint8(1)
  21963. }
  21964. state = 1
  21965. }
  21966. ptr += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(2))
  21967. case int32(_BT_LEAD4):
  21968. if state == 0 {
  21969. if nAtts < attsMax {
  21970. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fname = ptr
  21971. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = uint8(1)
  21972. }
  21973. state = 1
  21974. }
  21975. ptr += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(2))
  21976. case int32(_BT_NONASCII):
  21977. fallthrough
  21978. case int32(_BT_NMSTRT):
  21979. fallthrough
  21980. case int32(_BT_HEX):
  21981. if state == 0 {
  21982. if nAtts < attsMax {
  21983. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fname = ptr
  21984. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = uint8(1)
  21985. }
  21986. state = 1
  21987. }
  21988. case int32(_BT_QUOT):
  21989. if state != 2 {
  21990. if nAtts < attsMax {
  21991. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).FvaluePtr = ptr + uintptr(2)
  21992. }
  21993. state = 2
  21994. open = int32(_BT_QUOT)
  21995. } else {
  21996. if open == int32(_BT_QUOT) {
  21997. state = 0
  21998. if nAtts < attsMax {
  21999. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).FvalueEnd = ptr
  22000. }
  22001. nAtts++
  22002. }
  22003. }
  22004. case int32(_BT_APOS):
  22005. if state != 2 {
  22006. if nAtts < attsMax {
  22007. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).FvaluePtr = ptr + uintptr(2)
  22008. }
  22009. state = 2
  22010. open = int32(_BT_APOS)
  22011. } else {
  22012. if open == int32(_BT_APOS) {
  22013. state = 0
  22014. if nAtts < attsMax {
  22015. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).FvalueEnd = ptr
  22016. }
  22017. nAtts++
  22018. }
  22019. }
  22020. case int32(_BT_AMP):
  22021. if nAtts < attsMax {
  22022. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = uint8(0)
  22023. }
  22024. case int32(_BT_S):
  22025. if state == 1 {
  22026. state = 0
  22027. } else {
  22028. if v9 = state == 2 && nAtts < attsMax && (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized != 0; v9 {
  22029. if v4 = ptr == (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).FvaluePtr; !v4 {
  22030. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  22031. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  22032. } else {
  22033. v3 = -int32(1)
  22034. }
  22035. }
  22036. if v6 = v4 || v3 != int32(m_ASCII_SPACE1); !v6 {
  22037. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 {
  22038. v5 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))
  22039. } else {
  22040. v5 = -int32(1)
  22041. }
  22042. }
  22043. if v8 = v6 || v5 == int32(m_ASCII_SPACE1); !v8 {
  22044. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 {
  22045. v7 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))))))
  22046. } else {
  22047. v7 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)), *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))
  22048. }
  22049. }
  22050. }
  22051. if v9 && (v8 || v7 == open) {
  22052. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = uint8(0)
  22053. }
  22054. }
  22055. case int32(_BT_CR):
  22056. fallthrough
  22057. case int32(_BT_LF):
  22058. /* This case ensures that the first attribute name is counted
  22059. Apart from that we could just change state on the quote. */
  22060. if state == 1 {
  22061. state = 0
  22062. } else {
  22063. if state == 2 && nAtts < attsMax {
  22064. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = uint8(0)
  22065. }
  22066. }
  22067. case int32(_BT_GT):
  22068. fallthrough
  22069. case int32(_BT_SOL):
  22070. if state != 2 {
  22071. return nAtts
  22072. }
  22073. default:
  22074. break
  22075. }
  22076. goto _1
  22077. _1:
  22078. ;
  22079. ptr += uintptr(2)
  22080. }
  22081. /* not reached */
  22082. return r
  22083. }
  22084. func _little2_charRefNumber(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  22085. var c, c1, result, v2, v4 int32
  22086. _, _, _, _, _ = c, c1, result, v2, v4
  22087. result = 0
  22088. /* skip &# */
  22089. _ = enc
  22090. ptr += uintptr(libc.Int32FromInt32(2) * libc.Int32FromInt32(2))
  22091. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  22092. ptr += uintptr(2)
  22093. for {
  22094. if !!(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_SEMI1)) {
  22095. break
  22096. }
  22097. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  22098. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  22099. } else {
  22100. v2 = -int32(1)
  22101. }
  22102. c = v2
  22103. switch c {
  22104. case int32(m_ASCII_02):
  22105. fallthrough
  22106. case int32(m_ASCII_12):
  22107. fallthrough
  22108. case int32(m_ASCII_22):
  22109. fallthrough
  22110. case int32(m_ASCII_32):
  22111. fallthrough
  22112. case int32(m_ASCII_41):
  22113. fallthrough
  22114. case int32(m_ASCII_51):
  22115. fallthrough
  22116. case int32(m_ASCII_61):
  22117. fallthrough
  22118. case int32(m_ASCII_71):
  22119. fallthrough
  22120. case int32(m_ASCII_82):
  22121. fallthrough
  22122. case int32(m_ASCII_92):
  22123. result <<= int32(4)
  22124. result |= c - int32(m_ASCII_02)
  22125. case int32(m_ASCII_A):
  22126. fallthrough
  22127. case int32(m_ASCII_B1):
  22128. fallthrough
  22129. case int32(m_ASCII_C):
  22130. fallthrough
  22131. case int32(m_ASCII_D):
  22132. fallthrough
  22133. case int32(m_ASCII_E):
  22134. fallthrough
  22135. case int32(m_ASCII_F):
  22136. result <<= int32(4)
  22137. result += int32(10) + (c - int32(m_ASCII_A))
  22138. case int32(m_ASCII_a2):
  22139. fallthrough
  22140. case int32(m_ASCII_b1):
  22141. fallthrough
  22142. case int32(m_ASCII_c2):
  22143. fallthrough
  22144. case int32(m_ASCII_d1):
  22145. fallthrough
  22146. case int32(m_ASCII_e2):
  22147. fallthrough
  22148. case int32(m_ASCII_f1):
  22149. result <<= int32(4)
  22150. result += int32(10) + (c - int32(m_ASCII_a2))
  22151. break
  22152. }
  22153. if result >= int32(0x110000) {
  22154. return -int32(1)
  22155. }
  22156. goto _1
  22157. _1:
  22158. ;
  22159. ptr += uintptr(2)
  22160. }
  22161. } else {
  22162. for {
  22163. if !!(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_SEMI1)) {
  22164. break
  22165. }
  22166. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  22167. v4 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  22168. } else {
  22169. v4 = -int32(1)
  22170. }
  22171. c1 = v4
  22172. result *= int32(10)
  22173. result += c1 - int32(m_ASCII_02)
  22174. if result >= int32(0x110000) {
  22175. return -int32(1)
  22176. }
  22177. goto _3
  22178. _3:
  22179. ;
  22180. ptr += uintptr(2)
  22181. }
  22182. }
  22183. return _checkCharRefNumber(tls, result)
  22184. }
  22185. func _little2_predefinedEntityName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr) (r int32) {
  22186. var v1, v2 int32
  22187. _, _ = v1, v2
  22188. _ = enc
  22189. switch (int32(end) - int32(ptr)) / libc.Int32FromInt32(2) {
  22190. case int32(2):
  22191. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == int32(m_ASCII_t2) {
  22192. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  22193. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  22194. } else {
  22195. v1 = -int32(1)
  22196. }
  22197. switch v1 {
  22198. case int32(m_ASCII_l2):
  22199. return int32(m_ASCII_LT1)
  22200. case int32(m_ASCII_g2):
  22201. return int32(m_ASCII_GT1)
  22202. }
  22203. }
  22204. case int32(3):
  22205. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_a2) {
  22206. ptr += uintptr(2)
  22207. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_m2) {
  22208. ptr += uintptr(2)
  22209. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  22210. return int32(m_ASCII_AMP1)
  22211. }
  22212. }
  22213. }
  22214. case int32(4):
  22215. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  22216. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  22217. } else {
  22218. v2 = -int32(1)
  22219. }
  22220. switch v2 {
  22221. case int32(m_ASCII_q1):
  22222. ptr += uintptr(2)
  22223. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_u1) {
  22224. ptr += uintptr(2)
  22225. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  22226. ptr += uintptr(2)
  22227. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_t2) {
  22228. return int32(m_ASCII_QUOT1)
  22229. }
  22230. }
  22231. }
  22232. case int32(m_ASCII_a2):
  22233. ptr += uintptr(2)
  22234. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  22235. ptr += uintptr(2)
  22236. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  22237. ptr += uintptr(2)
  22238. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_s2) {
  22239. return int32(m_ASCII_APOS1)
  22240. }
  22241. }
  22242. }
  22243. break
  22244. }
  22245. }
  22246. return 0
  22247. }
  22248. func _little2_nameMatchesAscii(tls *libc.TLS, enc uintptr, ptr1 uintptr, end1 uintptr, ptr2 uintptr) (r int32) {
  22249. _ = enc
  22250. for {
  22251. if !(*(*uint8)(unsafe.Pointer(ptr2)) != 0) {
  22252. break
  22253. }
  22254. if int32(end1)-int32(ptr1) < int32(2) {
  22255. /* This line cannot be executed. The incoming data has already
  22256. * been tokenized once, so incomplete characters like this have
  22257. * already been eliminated from the input. Retaining the
  22258. * paranoia check is still valuable, however.
  22259. */
  22260. return 0 /* LCOV_EXCL_LINE */
  22261. }
  22262. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr1 + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr1))) == libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr2)))) {
  22263. return 0
  22264. }
  22265. goto _1
  22266. _1:
  22267. ;
  22268. ptr1 += uintptr(2)
  22269. ptr2++
  22270. }
  22271. return libc.BoolInt32(ptr1 == end1)
  22272. }
  22273. func _little2_nameLength(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  22274. var start uintptr
  22275. var v2 int32
  22276. _, _ = start, v2
  22277. start = ptr
  22278. for {
  22279. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  22280. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  22281. } else {
  22282. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  22283. }
  22284. switch v2 {
  22285. case int32(_BT_LEAD2):
  22286. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  22287. case int32(_BT_LEAD3):
  22288. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  22289. case int32(_BT_LEAD4):
  22290. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  22291. case int32(_BT_NONASCII):
  22292. fallthrough
  22293. case int32(_BT_NMSTRT):
  22294. fallthrough
  22295. case int32(_BT_COLON):
  22296. fallthrough
  22297. case int32(_BT_HEX):
  22298. fallthrough
  22299. case int32(_BT_DIGIT):
  22300. fallthrough
  22301. case int32(_BT_NAME):
  22302. fallthrough
  22303. case int32(_BT_MINUS):
  22304. ptr += uintptr(2)
  22305. default:
  22306. return int32(ptr) - int32(start)
  22307. }
  22308. goto _1
  22309. _1:
  22310. }
  22311. return r
  22312. }
  22313. func _little2_skipS(tls *libc.TLS, enc uintptr, ptr uintptr) (r uintptr) {
  22314. var v2 int32
  22315. _ = v2
  22316. for {
  22317. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  22318. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  22319. } else {
  22320. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  22321. }
  22322. switch v2 {
  22323. case int32(_BT_LF):
  22324. fallthrough
  22325. case int32(_BT_CR):
  22326. fallthrough
  22327. case int32(_BT_S):
  22328. ptr += uintptr(2)
  22329. default:
  22330. return ptr
  22331. }
  22332. goto _1
  22333. _1:
  22334. }
  22335. return r
  22336. }
  22337. func _little2_updatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  22338. var v1, v2 int32
  22339. var v3 bool
  22340. _, _, _ = v1, v2, v3
  22341. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  22342. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  22343. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  22344. } else {
  22345. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  22346. }
  22347. switch v1 {
  22348. case int32(_BT_LEAD2):
  22349. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  22350. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  22351. case int32(_BT_LEAD3):
  22352. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  22353. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  22354. case int32(_BT_LEAD4):
  22355. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  22356. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  22357. case int32(_BT_LF):
  22358. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint32(0)
  22359. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  22360. ptr += uintptr(2)
  22361. case int32(_BT_CR):
  22362. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  22363. ptr += uintptr(2)
  22364. if v3 = int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2); v3 {
  22365. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  22366. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  22367. } else {
  22368. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  22369. }
  22370. }
  22371. if v3 && v2 == int32(_BT_LF) {
  22372. ptr += uintptr(2)
  22373. }
  22374. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint32(0)
  22375. default:
  22376. ptr += uintptr(2)
  22377. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  22378. break
  22379. }
  22380. }
  22381. }
  22382. var _little2_encoding_ns = Tnormal_encoding{
  22383. Fenc: TENCODING{
  22384. Fscanners: [4]TSCANNER{},
  22385. FliteralScanners: [2]TSCANNER{},
  22386. FminBytesPerChar: int32(2),
  22387. FisUtf16: uint8(1),
  22388. },
  22389. Ftype1: [256]uint8{
  22390. 9: uint8(_BT_S),
  22391. 10: uint8(_BT_LF),
  22392. 13: uint8(_BT_CR),
  22393. 32: uint8(_BT_S),
  22394. 33: uint8(_BT_EXCL),
  22395. 34: uint8(_BT_QUOT),
  22396. 35: uint8(_BT_NUM),
  22397. 36: uint8(_BT_OTHER),
  22398. 37: uint8(_BT_PERCNT),
  22399. 38: uint8(_BT_AMP),
  22400. 39: uint8(_BT_APOS),
  22401. 40: uint8(_BT_LPAR),
  22402. 41: uint8(_BT_RPAR),
  22403. 42: uint8(_BT_AST),
  22404. 43: uint8(_BT_PLUS),
  22405. 44: uint8(_BT_COMMA),
  22406. 45: uint8(_BT_MINUS),
  22407. 46: uint8(_BT_NAME),
  22408. 47: uint8(_BT_SOL),
  22409. 48: uint8(_BT_DIGIT),
  22410. 49: uint8(_BT_DIGIT),
  22411. 50: uint8(_BT_DIGIT),
  22412. 51: uint8(_BT_DIGIT),
  22413. 52: uint8(_BT_DIGIT),
  22414. 53: uint8(_BT_DIGIT),
  22415. 54: uint8(_BT_DIGIT),
  22416. 55: uint8(_BT_DIGIT),
  22417. 56: uint8(_BT_DIGIT),
  22418. 57: uint8(_BT_DIGIT),
  22419. 58: uint8(_BT_COLON),
  22420. 59: uint8(_BT_SEMI),
  22421. 60: uint8(_BT_LT),
  22422. 61: uint8(_BT_EQUALS),
  22423. 62: uint8(_BT_GT),
  22424. 63: uint8(_BT_QUEST),
  22425. 64: uint8(_BT_OTHER),
  22426. 65: uint8(_BT_HEX),
  22427. 66: uint8(_BT_HEX),
  22428. 67: uint8(_BT_HEX),
  22429. 68: uint8(_BT_HEX),
  22430. 69: uint8(_BT_HEX),
  22431. 70: uint8(_BT_HEX),
  22432. 71: uint8(_BT_NMSTRT),
  22433. 72: uint8(_BT_NMSTRT),
  22434. 73: uint8(_BT_NMSTRT),
  22435. 74: uint8(_BT_NMSTRT),
  22436. 75: uint8(_BT_NMSTRT),
  22437. 76: uint8(_BT_NMSTRT),
  22438. 77: uint8(_BT_NMSTRT),
  22439. 78: uint8(_BT_NMSTRT),
  22440. 79: uint8(_BT_NMSTRT),
  22441. 80: uint8(_BT_NMSTRT),
  22442. 81: uint8(_BT_NMSTRT),
  22443. 82: uint8(_BT_NMSTRT),
  22444. 83: uint8(_BT_NMSTRT),
  22445. 84: uint8(_BT_NMSTRT),
  22446. 85: uint8(_BT_NMSTRT),
  22447. 86: uint8(_BT_NMSTRT),
  22448. 87: uint8(_BT_NMSTRT),
  22449. 88: uint8(_BT_NMSTRT),
  22450. 89: uint8(_BT_NMSTRT),
  22451. 90: uint8(_BT_NMSTRT),
  22452. 91: uint8(_BT_LSQB),
  22453. 92: uint8(_BT_OTHER),
  22454. 93: uint8(_BT_RSQB),
  22455. 94: uint8(_BT_OTHER),
  22456. 95: uint8(_BT_NMSTRT),
  22457. 96: uint8(_BT_OTHER),
  22458. 97: uint8(_BT_HEX),
  22459. 98: uint8(_BT_HEX),
  22460. 99: uint8(_BT_HEX),
  22461. 100: uint8(_BT_HEX),
  22462. 101: uint8(_BT_HEX),
  22463. 102: uint8(_BT_HEX),
  22464. 103: uint8(_BT_NMSTRT),
  22465. 104: uint8(_BT_NMSTRT),
  22466. 105: uint8(_BT_NMSTRT),
  22467. 106: uint8(_BT_NMSTRT),
  22468. 107: uint8(_BT_NMSTRT),
  22469. 108: uint8(_BT_NMSTRT),
  22470. 109: uint8(_BT_NMSTRT),
  22471. 110: uint8(_BT_NMSTRT),
  22472. 111: uint8(_BT_NMSTRT),
  22473. 112: uint8(_BT_NMSTRT),
  22474. 113: uint8(_BT_NMSTRT),
  22475. 114: uint8(_BT_NMSTRT),
  22476. 115: uint8(_BT_NMSTRT),
  22477. 116: uint8(_BT_NMSTRT),
  22478. 117: uint8(_BT_NMSTRT),
  22479. 118: uint8(_BT_NMSTRT),
  22480. 119: uint8(_BT_NMSTRT),
  22481. 120: uint8(_BT_NMSTRT),
  22482. 121: uint8(_BT_NMSTRT),
  22483. 122: uint8(_BT_NMSTRT),
  22484. 123: uint8(_BT_OTHER),
  22485. 124: uint8(_BT_VERBAR),
  22486. 125: uint8(_BT_OTHER),
  22487. 126: uint8(_BT_OTHER),
  22488. 127: uint8(_BT_OTHER),
  22489. 128: uint8(_BT_OTHER),
  22490. 129: uint8(_BT_OTHER),
  22491. 130: uint8(_BT_OTHER),
  22492. 131: uint8(_BT_OTHER),
  22493. 132: uint8(_BT_OTHER),
  22494. 133: uint8(_BT_OTHER),
  22495. 134: uint8(_BT_OTHER),
  22496. 135: uint8(_BT_OTHER),
  22497. 136: uint8(_BT_OTHER),
  22498. 137: uint8(_BT_OTHER),
  22499. 138: uint8(_BT_OTHER),
  22500. 139: uint8(_BT_OTHER),
  22501. 140: uint8(_BT_OTHER),
  22502. 141: uint8(_BT_OTHER),
  22503. 142: uint8(_BT_OTHER),
  22504. 143: uint8(_BT_OTHER),
  22505. 144: uint8(_BT_OTHER),
  22506. 145: uint8(_BT_OTHER),
  22507. 146: uint8(_BT_OTHER),
  22508. 147: uint8(_BT_OTHER),
  22509. 148: uint8(_BT_OTHER),
  22510. 149: uint8(_BT_OTHER),
  22511. 150: uint8(_BT_OTHER),
  22512. 151: uint8(_BT_OTHER),
  22513. 152: uint8(_BT_OTHER),
  22514. 153: uint8(_BT_OTHER),
  22515. 154: uint8(_BT_OTHER),
  22516. 155: uint8(_BT_OTHER),
  22517. 156: uint8(_BT_OTHER),
  22518. 157: uint8(_BT_OTHER),
  22519. 158: uint8(_BT_OTHER),
  22520. 159: uint8(_BT_OTHER),
  22521. 160: uint8(_BT_OTHER),
  22522. 161: uint8(_BT_OTHER),
  22523. 162: uint8(_BT_OTHER),
  22524. 163: uint8(_BT_OTHER),
  22525. 164: uint8(_BT_OTHER),
  22526. 165: uint8(_BT_OTHER),
  22527. 166: uint8(_BT_OTHER),
  22528. 167: uint8(_BT_OTHER),
  22529. 168: uint8(_BT_OTHER),
  22530. 169: uint8(_BT_OTHER),
  22531. 170: uint8(_BT_NMSTRT),
  22532. 171: uint8(_BT_OTHER),
  22533. 172: uint8(_BT_OTHER),
  22534. 173: uint8(_BT_OTHER),
  22535. 174: uint8(_BT_OTHER),
  22536. 175: uint8(_BT_OTHER),
  22537. 176: uint8(_BT_OTHER),
  22538. 177: uint8(_BT_OTHER),
  22539. 178: uint8(_BT_OTHER),
  22540. 179: uint8(_BT_OTHER),
  22541. 180: uint8(_BT_OTHER),
  22542. 181: uint8(_BT_NMSTRT),
  22543. 182: uint8(_BT_OTHER),
  22544. 183: uint8(_BT_NAME),
  22545. 184: uint8(_BT_OTHER),
  22546. 185: uint8(_BT_OTHER),
  22547. 186: uint8(_BT_NMSTRT),
  22548. 187: uint8(_BT_OTHER),
  22549. 188: uint8(_BT_OTHER),
  22550. 189: uint8(_BT_OTHER),
  22551. 190: uint8(_BT_OTHER),
  22552. 191: uint8(_BT_OTHER),
  22553. 192: uint8(_BT_NMSTRT),
  22554. 193: uint8(_BT_NMSTRT),
  22555. 194: uint8(_BT_NMSTRT),
  22556. 195: uint8(_BT_NMSTRT),
  22557. 196: uint8(_BT_NMSTRT),
  22558. 197: uint8(_BT_NMSTRT),
  22559. 198: uint8(_BT_NMSTRT),
  22560. 199: uint8(_BT_NMSTRT),
  22561. 200: uint8(_BT_NMSTRT),
  22562. 201: uint8(_BT_NMSTRT),
  22563. 202: uint8(_BT_NMSTRT),
  22564. 203: uint8(_BT_NMSTRT),
  22565. 204: uint8(_BT_NMSTRT),
  22566. 205: uint8(_BT_NMSTRT),
  22567. 206: uint8(_BT_NMSTRT),
  22568. 207: uint8(_BT_NMSTRT),
  22569. 208: uint8(_BT_NMSTRT),
  22570. 209: uint8(_BT_NMSTRT),
  22571. 210: uint8(_BT_NMSTRT),
  22572. 211: uint8(_BT_NMSTRT),
  22573. 212: uint8(_BT_NMSTRT),
  22574. 213: uint8(_BT_NMSTRT),
  22575. 214: uint8(_BT_NMSTRT),
  22576. 215: uint8(_BT_OTHER),
  22577. 216: uint8(_BT_NMSTRT),
  22578. 217: uint8(_BT_NMSTRT),
  22579. 218: uint8(_BT_NMSTRT),
  22580. 219: uint8(_BT_NMSTRT),
  22581. 220: uint8(_BT_NMSTRT),
  22582. 221: uint8(_BT_NMSTRT),
  22583. 222: uint8(_BT_NMSTRT),
  22584. 223: uint8(_BT_NMSTRT),
  22585. 224: uint8(_BT_NMSTRT),
  22586. 225: uint8(_BT_NMSTRT),
  22587. 226: uint8(_BT_NMSTRT),
  22588. 227: uint8(_BT_NMSTRT),
  22589. 228: uint8(_BT_NMSTRT),
  22590. 229: uint8(_BT_NMSTRT),
  22591. 230: uint8(_BT_NMSTRT),
  22592. 231: uint8(_BT_NMSTRT),
  22593. 232: uint8(_BT_NMSTRT),
  22594. 233: uint8(_BT_NMSTRT),
  22595. 234: uint8(_BT_NMSTRT),
  22596. 235: uint8(_BT_NMSTRT),
  22597. 236: uint8(_BT_NMSTRT),
  22598. 237: uint8(_BT_NMSTRT),
  22599. 238: uint8(_BT_NMSTRT),
  22600. 239: uint8(_BT_NMSTRT),
  22601. 240: uint8(_BT_NMSTRT),
  22602. 241: uint8(_BT_NMSTRT),
  22603. 242: uint8(_BT_NMSTRT),
  22604. 243: uint8(_BT_NMSTRT),
  22605. 244: uint8(_BT_NMSTRT),
  22606. 245: uint8(_BT_NMSTRT),
  22607. 246: uint8(_BT_NMSTRT),
  22608. 247: uint8(_BT_OTHER),
  22609. 248: uint8(_BT_NMSTRT),
  22610. 249: uint8(_BT_NMSTRT),
  22611. 250: uint8(_BT_NMSTRT),
  22612. 251: uint8(_BT_NMSTRT),
  22613. 252: uint8(_BT_NMSTRT),
  22614. 253: uint8(_BT_NMSTRT),
  22615. 254: uint8(_BT_NMSTRT),
  22616. 255: uint8(_BT_NMSTRT),
  22617. },
  22618. }
  22619. func init() {
  22620. p := unsafe.Pointer(&_little2_encoding_ns)
  22621. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  22622. *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_little2_contentTok)
  22623. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_cdataSectionTok)
  22624. *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_little2_ignoreSectionTok)
  22625. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_attributeValueTok)
  22626. *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_little2_entityValueTok)
  22627. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_nameMatchesAscii)
  22628. *(*uintptr)(unsafe.Add(p, 28)) = __ccgo_fp(_little2_nameLength)
  22629. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_skipS)
  22630. *(*uintptr)(unsafe.Add(p, 36)) = __ccgo_fp(_little2_getAtts)
  22631. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_charRefNumber)
  22632. *(*uintptr)(unsafe.Add(p, 44)) = __ccgo_fp(_little2_predefinedEntityName)
  22633. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_updatePosition)
  22634. *(*uintptr)(unsafe.Add(p, 52)) = __ccgo_fp(_little2_isPublicId)
  22635. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_toUtf8)
  22636. *(*uintptr)(unsafe.Add(p, 60)) = __ccgo_fp(_little2_toUtf16)
  22637. }
  22638. var _little2_encoding = Tnormal_encoding{
  22639. Fenc: TENCODING{
  22640. Fscanners: [4]TSCANNER{},
  22641. FliteralScanners: [2]TSCANNER{},
  22642. FminBytesPerChar: int32(2),
  22643. FisUtf16: uint8(1),
  22644. },
  22645. Ftype1: [256]uint8{
  22646. 9: uint8(_BT_S),
  22647. 10: uint8(_BT_LF),
  22648. 13: uint8(_BT_CR),
  22649. 32: uint8(_BT_S),
  22650. 33: uint8(_BT_EXCL),
  22651. 34: uint8(_BT_QUOT),
  22652. 35: uint8(_BT_NUM),
  22653. 36: uint8(_BT_OTHER),
  22654. 37: uint8(_BT_PERCNT),
  22655. 38: uint8(_BT_AMP),
  22656. 39: uint8(_BT_APOS),
  22657. 40: uint8(_BT_LPAR),
  22658. 41: uint8(_BT_RPAR),
  22659. 42: uint8(_BT_AST),
  22660. 43: uint8(_BT_PLUS),
  22661. 44: uint8(_BT_COMMA),
  22662. 45: uint8(_BT_MINUS),
  22663. 46: uint8(_BT_NAME),
  22664. 47: uint8(_BT_SOL),
  22665. 48: uint8(_BT_DIGIT),
  22666. 49: uint8(_BT_DIGIT),
  22667. 50: uint8(_BT_DIGIT),
  22668. 51: uint8(_BT_DIGIT),
  22669. 52: uint8(_BT_DIGIT),
  22670. 53: uint8(_BT_DIGIT),
  22671. 54: uint8(_BT_DIGIT),
  22672. 55: uint8(_BT_DIGIT),
  22673. 56: uint8(_BT_DIGIT),
  22674. 57: uint8(_BT_DIGIT),
  22675. 58: uint8(_BT_NMSTRT),
  22676. 59: uint8(_BT_SEMI),
  22677. 60: uint8(_BT_LT),
  22678. 61: uint8(_BT_EQUALS),
  22679. 62: uint8(_BT_GT),
  22680. 63: uint8(_BT_QUEST),
  22681. 64: uint8(_BT_OTHER),
  22682. 65: uint8(_BT_HEX),
  22683. 66: uint8(_BT_HEX),
  22684. 67: uint8(_BT_HEX),
  22685. 68: uint8(_BT_HEX),
  22686. 69: uint8(_BT_HEX),
  22687. 70: uint8(_BT_HEX),
  22688. 71: uint8(_BT_NMSTRT),
  22689. 72: uint8(_BT_NMSTRT),
  22690. 73: uint8(_BT_NMSTRT),
  22691. 74: uint8(_BT_NMSTRT),
  22692. 75: uint8(_BT_NMSTRT),
  22693. 76: uint8(_BT_NMSTRT),
  22694. 77: uint8(_BT_NMSTRT),
  22695. 78: uint8(_BT_NMSTRT),
  22696. 79: uint8(_BT_NMSTRT),
  22697. 80: uint8(_BT_NMSTRT),
  22698. 81: uint8(_BT_NMSTRT),
  22699. 82: uint8(_BT_NMSTRT),
  22700. 83: uint8(_BT_NMSTRT),
  22701. 84: uint8(_BT_NMSTRT),
  22702. 85: uint8(_BT_NMSTRT),
  22703. 86: uint8(_BT_NMSTRT),
  22704. 87: uint8(_BT_NMSTRT),
  22705. 88: uint8(_BT_NMSTRT),
  22706. 89: uint8(_BT_NMSTRT),
  22707. 90: uint8(_BT_NMSTRT),
  22708. 91: uint8(_BT_LSQB),
  22709. 92: uint8(_BT_OTHER),
  22710. 93: uint8(_BT_RSQB),
  22711. 94: uint8(_BT_OTHER),
  22712. 95: uint8(_BT_NMSTRT),
  22713. 96: uint8(_BT_OTHER),
  22714. 97: uint8(_BT_HEX),
  22715. 98: uint8(_BT_HEX),
  22716. 99: uint8(_BT_HEX),
  22717. 100: uint8(_BT_HEX),
  22718. 101: uint8(_BT_HEX),
  22719. 102: uint8(_BT_HEX),
  22720. 103: uint8(_BT_NMSTRT),
  22721. 104: uint8(_BT_NMSTRT),
  22722. 105: uint8(_BT_NMSTRT),
  22723. 106: uint8(_BT_NMSTRT),
  22724. 107: uint8(_BT_NMSTRT),
  22725. 108: uint8(_BT_NMSTRT),
  22726. 109: uint8(_BT_NMSTRT),
  22727. 110: uint8(_BT_NMSTRT),
  22728. 111: uint8(_BT_NMSTRT),
  22729. 112: uint8(_BT_NMSTRT),
  22730. 113: uint8(_BT_NMSTRT),
  22731. 114: uint8(_BT_NMSTRT),
  22732. 115: uint8(_BT_NMSTRT),
  22733. 116: uint8(_BT_NMSTRT),
  22734. 117: uint8(_BT_NMSTRT),
  22735. 118: uint8(_BT_NMSTRT),
  22736. 119: uint8(_BT_NMSTRT),
  22737. 120: uint8(_BT_NMSTRT),
  22738. 121: uint8(_BT_NMSTRT),
  22739. 122: uint8(_BT_NMSTRT),
  22740. 123: uint8(_BT_OTHER),
  22741. 124: uint8(_BT_VERBAR),
  22742. 125: uint8(_BT_OTHER),
  22743. 126: uint8(_BT_OTHER),
  22744. 127: uint8(_BT_OTHER),
  22745. 128: uint8(_BT_OTHER),
  22746. 129: uint8(_BT_OTHER),
  22747. 130: uint8(_BT_OTHER),
  22748. 131: uint8(_BT_OTHER),
  22749. 132: uint8(_BT_OTHER),
  22750. 133: uint8(_BT_OTHER),
  22751. 134: uint8(_BT_OTHER),
  22752. 135: uint8(_BT_OTHER),
  22753. 136: uint8(_BT_OTHER),
  22754. 137: uint8(_BT_OTHER),
  22755. 138: uint8(_BT_OTHER),
  22756. 139: uint8(_BT_OTHER),
  22757. 140: uint8(_BT_OTHER),
  22758. 141: uint8(_BT_OTHER),
  22759. 142: uint8(_BT_OTHER),
  22760. 143: uint8(_BT_OTHER),
  22761. 144: uint8(_BT_OTHER),
  22762. 145: uint8(_BT_OTHER),
  22763. 146: uint8(_BT_OTHER),
  22764. 147: uint8(_BT_OTHER),
  22765. 148: uint8(_BT_OTHER),
  22766. 149: uint8(_BT_OTHER),
  22767. 150: uint8(_BT_OTHER),
  22768. 151: uint8(_BT_OTHER),
  22769. 152: uint8(_BT_OTHER),
  22770. 153: uint8(_BT_OTHER),
  22771. 154: uint8(_BT_OTHER),
  22772. 155: uint8(_BT_OTHER),
  22773. 156: uint8(_BT_OTHER),
  22774. 157: uint8(_BT_OTHER),
  22775. 158: uint8(_BT_OTHER),
  22776. 159: uint8(_BT_OTHER),
  22777. 160: uint8(_BT_OTHER),
  22778. 161: uint8(_BT_OTHER),
  22779. 162: uint8(_BT_OTHER),
  22780. 163: uint8(_BT_OTHER),
  22781. 164: uint8(_BT_OTHER),
  22782. 165: uint8(_BT_OTHER),
  22783. 166: uint8(_BT_OTHER),
  22784. 167: uint8(_BT_OTHER),
  22785. 168: uint8(_BT_OTHER),
  22786. 169: uint8(_BT_OTHER),
  22787. 170: uint8(_BT_NMSTRT),
  22788. 171: uint8(_BT_OTHER),
  22789. 172: uint8(_BT_OTHER),
  22790. 173: uint8(_BT_OTHER),
  22791. 174: uint8(_BT_OTHER),
  22792. 175: uint8(_BT_OTHER),
  22793. 176: uint8(_BT_OTHER),
  22794. 177: uint8(_BT_OTHER),
  22795. 178: uint8(_BT_OTHER),
  22796. 179: uint8(_BT_OTHER),
  22797. 180: uint8(_BT_OTHER),
  22798. 181: uint8(_BT_NMSTRT),
  22799. 182: uint8(_BT_OTHER),
  22800. 183: uint8(_BT_NAME),
  22801. 184: uint8(_BT_OTHER),
  22802. 185: uint8(_BT_OTHER),
  22803. 186: uint8(_BT_NMSTRT),
  22804. 187: uint8(_BT_OTHER),
  22805. 188: uint8(_BT_OTHER),
  22806. 189: uint8(_BT_OTHER),
  22807. 190: uint8(_BT_OTHER),
  22808. 191: uint8(_BT_OTHER),
  22809. 192: uint8(_BT_NMSTRT),
  22810. 193: uint8(_BT_NMSTRT),
  22811. 194: uint8(_BT_NMSTRT),
  22812. 195: uint8(_BT_NMSTRT),
  22813. 196: uint8(_BT_NMSTRT),
  22814. 197: uint8(_BT_NMSTRT),
  22815. 198: uint8(_BT_NMSTRT),
  22816. 199: uint8(_BT_NMSTRT),
  22817. 200: uint8(_BT_NMSTRT),
  22818. 201: uint8(_BT_NMSTRT),
  22819. 202: uint8(_BT_NMSTRT),
  22820. 203: uint8(_BT_NMSTRT),
  22821. 204: uint8(_BT_NMSTRT),
  22822. 205: uint8(_BT_NMSTRT),
  22823. 206: uint8(_BT_NMSTRT),
  22824. 207: uint8(_BT_NMSTRT),
  22825. 208: uint8(_BT_NMSTRT),
  22826. 209: uint8(_BT_NMSTRT),
  22827. 210: uint8(_BT_NMSTRT),
  22828. 211: uint8(_BT_NMSTRT),
  22829. 212: uint8(_BT_NMSTRT),
  22830. 213: uint8(_BT_NMSTRT),
  22831. 214: uint8(_BT_NMSTRT),
  22832. 215: uint8(_BT_OTHER),
  22833. 216: uint8(_BT_NMSTRT),
  22834. 217: uint8(_BT_NMSTRT),
  22835. 218: uint8(_BT_NMSTRT),
  22836. 219: uint8(_BT_NMSTRT),
  22837. 220: uint8(_BT_NMSTRT),
  22838. 221: uint8(_BT_NMSTRT),
  22839. 222: uint8(_BT_NMSTRT),
  22840. 223: uint8(_BT_NMSTRT),
  22841. 224: uint8(_BT_NMSTRT),
  22842. 225: uint8(_BT_NMSTRT),
  22843. 226: uint8(_BT_NMSTRT),
  22844. 227: uint8(_BT_NMSTRT),
  22845. 228: uint8(_BT_NMSTRT),
  22846. 229: uint8(_BT_NMSTRT),
  22847. 230: uint8(_BT_NMSTRT),
  22848. 231: uint8(_BT_NMSTRT),
  22849. 232: uint8(_BT_NMSTRT),
  22850. 233: uint8(_BT_NMSTRT),
  22851. 234: uint8(_BT_NMSTRT),
  22852. 235: uint8(_BT_NMSTRT),
  22853. 236: uint8(_BT_NMSTRT),
  22854. 237: uint8(_BT_NMSTRT),
  22855. 238: uint8(_BT_NMSTRT),
  22856. 239: uint8(_BT_NMSTRT),
  22857. 240: uint8(_BT_NMSTRT),
  22858. 241: uint8(_BT_NMSTRT),
  22859. 242: uint8(_BT_NMSTRT),
  22860. 243: uint8(_BT_NMSTRT),
  22861. 244: uint8(_BT_NMSTRT),
  22862. 245: uint8(_BT_NMSTRT),
  22863. 246: uint8(_BT_NMSTRT),
  22864. 247: uint8(_BT_OTHER),
  22865. 248: uint8(_BT_NMSTRT),
  22866. 249: uint8(_BT_NMSTRT),
  22867. 250: uint8(_BT_NMSTRT),
  22868. 251: uint8(_BT_NMSTRT),
  22869. 252: uint8(_BT_NMSTRT),
  22870. 253: uint8(_BT_NMSTRT),
  22871. 254: uint8(_BT_NMSTRT),
  22872. 255: uint8(_BT_NMSTRT),
  22873. },
  22874. }
  22875. func init() {
  22876. p := unsafe.Pointer(&_little2_encoding)
  22877. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  22878. *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_little2_contentTok)
  22879. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_cdataSectionTok)
  22880. *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_little2_ignoreSectionTok)
  22881. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_attributeValueTok)
  22882. *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_little2_entityValueTok)
  22883. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_nameMatchesAscii)
  22884. *(*uintptr)(unsafe.Add(p, 28)) = __ccgo_fp(_little2_nameLength)
  22885. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_skipS)
  22886. *(*uintptr)(unsafe.Add(p, 36)) = __ccgo_fp(_little2_getAtts)
  22887. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_charRefNumber)
  22888. *(*uintptr)(unsafe.Add(p, 44)) = __ccgo_fp(_little2_predefinedEntityName)
  22889. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_updatePosition)
  22890. *(*uintptr)(unsafe.Add(p, 52)) = __ccgo_fp(_little2_isPublicId)
  22891. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_toUtf8)
  22892. *(*uintptr)(unsafe.Add(p, 60)) = __ccgo_fp(_little2_toUtf16)
  22893. }
  22894. var _internal_little2_encoding_ns = Tnormal_encoding{
  22895. Fenc: TENCODING{
  22896. Fscanners: [4]TSCANNER{},
  22897. FliteralScanners: [2]TSCANNER{},
  22898. FminBytesPerChar: int32(2),
  22899. FisUtf16: uint8(1),
  22900. },
  22901. Ftype1: [256]uint8{
  22902. 9: uint8(_BT_S),
  22903. 10: uint8(_BT_LF),
  22904. 13: uint8(_BT_S),
  22905. 32: uint8(_BT_S),
  22906. 33: uint8(_BT_EXCL),
  22907. 34: uint8(_BT_QUOT),
  22908. 35: uint8(_BT_NUM),
  22909. 36: uint8(_BT_OTHER),
  22910. 37: uint8(_BT_PERCNT),
  22911. 38: uint8(_BT_AMP),
  22912. 39: uint8(_BT_APOS),
  22913. 40: uint8(_BT_LPAR),
  22914. 41: uint8(_BT_RPAR),
  22915. 42: uint8(_BT_AST),
  22916. 43: uint8(_BT_PLUS),
  22917. 44: uint8(_BT_COMMA),
  22918. 45: uint8(_BT_MINUS),
  22919. 46: uint8(_BT_NAME),
  22920. 47: uint8(_BT_SOL),
  22921. 48: uint8(_BT_DIGIT),
  22922. 49: uint8(_BT_DIGIT),
  22923. 50: uint8(_BT_DIGIT),
  22924. 51: uint8(_BT_DIGIT),
  22925. 52: uint8(_BT_DIGIT),
  22926. 53: uint8(_BT_DIGIT),
  22927. 54: uint8(_BT_DIGIT),
  22928. 55: uint8(_BT_DIGIT),
  22929. 56: uint8(_BT_DIGIT),
  22930. 57: uint8(_BT_DIGIT),
  22931. 58: uint8(_BT_COLON),
  22932. 59: uint8(_BT_SEMI),
  22933. 60: uint8(_BT_LT),
  22934. 61: uint8(_BT_EQUALS),
  22935. 62: uint8(_BT_GT),
  22936. 63: uint8(_BT_QUEST),
  22937. 64: uint8(_BT_OTHER),
  22938. 65: uint8(_BT_HEX),
  22939. 66: uint8(_BT_HEX),
  22940. 67: uint8(_BT_HEX),
  22941. 68: uint8(_BT_HEX),
  22942. 69: uint8(_BT_HEX),
  22943. 70: uint8(_BT_HEX),
  22944. 71: uint8(_BT_NMSTRT),
  22945. 72: uint8(_BT_NMSTRT),
  22946. 73: uint8(_BT_NMSTRT),
  22947. 74: uint8(_BT_NMSTRT),
  22948. 75: uint8(_BT_NMSTRT),
  22949. 76: uint8(_BT_NMSTRT),
  22950. 77: uint8(_BT_NMSTRT),
  22951. 78: uint8(_BT_NMSTRT),
  22952. 79: uint8(_BT_NMSTRT),
  22953. 80: uint8(_BT_NMSTRT),
  22954. 81: uint8(_BT_NMSTRT),
  22955. 82: uint8(_BT_NMSTRT),
  22956. 83: uint8(_BT_NMSTRT),
  22957. 84: uint8(_BT_NMSTRT),
  22958. 85: uint8(_BT_NMSTRT),
  22959. 86: uint8(_BT_NMSTRT),
  22960. 87: uint8(_BT_NMSTRT),
  22961. 88: uint8(_BT_NMSTRT),
  22962. 89: uint8(_BT_NMSTRT),
  22963. 90: uint8(_BT_NMSTRT),
  22964. 91: uint8(_BT_LSQB),
  22965. 92: uint8(_BT_OTHER),
  22966. 93: uint8(_BT_RSQB),
  22967. 94: uint8(_BT_OTHER),
  22968. 95: uint8(_BT_NMSTRT),
  22969. 96: uint8(_BT_OTHER),
  22970. 97: uint8(_BT_HEX),
  22971. 98: uint8(_BT_HEX),
  22972. 99: uint8(_BT_HEX),
  22973. 100: uint8(_BT_HEX),
  22974. 101: uint8(_BT_HEX),
  22975. 102: uint8(_BT_HEX),
  22976. 103: uint8(_BT_NMSTRT),
  22977. 104: uint8(_BT_NMSTRT),
  22978. 105: uint8(_BT_NMSTRT),
  22979. 106: uint8(_BT_NMSTRT),
  22980. 107: uint8(_BT_NMSTRT),
  22981. 108: uint8(_BT_NMSTRT),
  22982. 109: uint8(_BT_NMSTRT),
  22983. 110: uint8(_BT_NMSTRT),
  22984. 111: uint8(_BT_NMSTRT),
  22985. 112: uint8(_BT_NMSTRT),
  22986. 113: uint8(_BT_NMSTRT),
  22987. 114: uint8(_BT_NMSTRT),
  22988. 115: uint8(_BT_NMSTRT),
  22989. 116: uint8(_BT_NMSTRT),
  22990. 117: uint8(_BT_NMSTRT),
  22991. 118: uint8(_BT_NMSTRT),
  22992. 119: uint8(_BT_NMSTRT),
  22993. 120: uint8(_BT_NMSTRT),
  22994. 121: uint8(_BT_NMSTRT),
  22995. 122: uint8(_BT_NMSTRT),
  22996. 123: uint8(_BT_OTHER),
  22997. 124: uint8(_BT_VERBAR),
  22998. 125: uint8(_BT_OTHER),
  22999. 126: uint8(_BT_OTHER),
  23000. 127: uint8(_BT_OTHER),
  23001. 128: uint8(_BT_OTHER),
  23002. 129: uint8(_BT_OTHER),
  23003. 130: uint8(_BT_OTHER),
  23004. 131: uint8(_BT_OTHER),
  23005. 132: uint8(_BT_OTHER),
  23006. 133: uint8(_BT_OTHER),
  23007. 134: uint8(_BT_OTHER),
  23008. 135: uint8(_BT_OTHER),
  23009. 136: uint8(_BT_OTHER),
  23010. 137: uint8(_BT_OTHER),
  23011. 138: uint8(_BT_OTHER),
  23012. 139: uint8(_BT_OTHER),
  23013. 140: uint8(_BT_OTHER),
  23014. 141: uint8(_BT_OTHER),
  23015. 142: uint8(_BT_OTHER),
  23016. 143: uint8(_BT_OTHER),
  23017. 144: uint8(_BT_OTHER),
  23018. 145: uint8(_BT_OTHER),
  23019. 146: uint8(_BT_OTHER),
  23020. 147: uint8(_BT_OTHER),
  23021. 148: uint8(_BT_OTHER),
  23022. 149: uint8(_BT_OTHER),
  23023. 150: uint8(_BT_OTHER),
  23024. 151: uint8(_BT_OTHER),
  23025. 152: uint8(_BT_OTHER),
  23026. 153: uint8(_BT_OTHER),
  23027. 154: uint8(_BT_OTHER),
  23028. 155: uint8(_BT_OTHER),
  23029. 156: uint8(_BT_OTHER),
  23030. 157: uint8(_BT_OTHER),
  23031. 158: uint8(_BT_OTHER),
  23032. 159: uint8(_BT_OTHER),
  23033. 160: uint8(_BT_OTHER),
  23034. 161: uint8(_BT_OTHER),
  23035. 162: uint8(_BT_OTHER),
  23036. 163: uint8(_BT_OTHER),
  23037. 164: uint8(_BT_OTHER),
  23038. 165: uint8(_BT_OTHER),
  23039. 166: uint8(_BT_OTHER),
  23040. 167: uint8(_BT_OTHER),
  23041. 168: uint8(_BT_OTHER),
  23042. 169: uint8(_BT_OTHER),
  23043. 170: uint8(_BT_NMSTRT),
  23044. 171: uint8(_BT_OTHER),
  23045. 172: uint8(_BT_OTHER),
  23046. 173: uint8(_BT_OTHER),
  23047. 174: uint8(_BT_OTHER),
  23048. 175: uint8(_BT_OTHER),
  23049. 176: uint8(_BT_OTHER),
  23050. 177: uint8(_BT_OTHER),
  23051. 178: uint8(_BT_OTHER),
  23052. 179: uint8(_BT_OTHER),
  23053. 180: uint8(_BT_OTHER),
  23054. 181: uint8(_BT_NMSTRT),
  23055. 182: uint8(_BT_OTHER),
  23056. 183: uint8(_BT_NAME),
  23057. 184: uint8(_BT_OTHER),
  23058. 185: uint8(_BT_OTHER),
  23059. 186: uint8(_BT_NMSTRT),
  23060. 187: uint8(_BT_OTHER),
  23061. 188: uint8(_BT_OTHER),
  23062. 189: uint8(_BT_OTHER),
  23063. 190: uint8(_BT_OTHER),
  23064. 191: uint8(_BT_OTHER),
  23065. 192: uint8(_BT_NMSTRT),
  23066. 193: uint8(_BT_NMSTRT),
  23067. 194: uint8(_BT_NMSTRT),
  23068. 195: uint8(_BT_NMSTRT),
  23069. 196: uint8(_BT_NMSTRT),
  23070. 197: uint8(_BT_NMSTRT),
  23071. 198: uint8(_BT_NMSTRT),
  23072. 199: uint8(_BT_NMSTRT),
  23073. 200: uint8(_BT_NMSTRT),
  23074. 201: uint8(_BT_NMSTRT),
  23075. 202: uint8(_BT_NMSTRT),
  23076. 203: uint8(_BT_NMSTRT),
  23077. 204: uint8(_BT_NMSTRT),
  23078. 205: uint8(_BT_NMSTRT),
  23079. 206: uint8(_BT_NMSTRT),
  23080. 207: uint8(_BT_NMSTRT),
  23081. 208: uint8(_BT_NMSTRT),
  23082. 209: uint8(_BT_NMSTRT),
  23083. 210: uint8(_BT_NMSTRT),
  23084. 211: uint8(_BT_NMSTRT),
  23085. 212: uint8(_BT_NMSTRT),
  23086. 213: uint8(_BT_NMSTRT),
  23087. 214: uint8(_BT_NMSTRT),
  23088. 215: uint8(_BT_OTHER),
  23089. 216: uint8(_BT_NMSTRT),
  23090. 217: uint8(_BT_NMSTRT),
  23091. 218: uint8(_BT_NMSTRT),
  23092. 219: uint8(_BT_NMSTRT),
  23093. 220: uint8(_BT_NMSTRT),
  23094. 221: uint8(_BT_NMSTRT),
  23095. 222: uint8(_BT_NMSTRT),
  23096. 223: uint8(_BT_NMSTRT),
  23097. 224: uint8(_BT_NMSTRT),
  23098. 225: uint8(_BT_NMSTRT),
  23099. 226: uint8(_BT_NMSTRT),
  23100. 227: uint8(_BT_NMSTRT),
  23101. 228: uint8(_BT_NMSTRT),
  23102. 229: uint8(_BT_NMSTRT),
  23103. 230: uint8(_BT_NMSTRT),
  23104. 231: uint8(_BT_NMSTRT),
  23105. 232: uint8(_BT_NMSTRT),
  23106. 233: uint8(_BT_NMSTRT),
  23107. 234: uint8(_BT_NMSTRT),
  23108. 235: uint8(_BT_NMSTRT),
  23109. 236: uint8(_BT_NMSTRT),
  23110. 237: uint8(_BT_NMSTRT),
  23111. 238: uint8(_BT_NMSTRT),
  23112. 239: uint8(_BT_NMSTRT),
  23113. 240: uint8(_BT_NMSTRT),
  23114. 241: uint8(_BT_NMSTRT),
  23115. 242: uint8(_BT_NMSTRT),
  23116. 243: uint8(_BT_NMSTRT),
  23117. 244: uint8(_BT_NMSTRT),
  23118. 245: uint8(_BT_NMSTRT),
  23119. 246: uint8(_BT_NMSTRT),
  23120. 247: uint8(_BT_OTHER),
  23121. 248: uint8(_BT_NMSTRT),
  23122. 249: uint8(_BT_NMSTRT),
  23123. 250: uint8(_BT_NMSTRT),
  23124. 251: uint8(_BT_NMSTRT),
  23125. 252: uint8(_BT_NMSTRT),
  23126. 253: uint8(_BT_NMSTRT),
  23127. 254: uint8(_BT_NMSTRT),
  23128. 255: uint8(_BT_NMSTRT),
  23129. },
  23130. }
  23131. func init() {
  23132. p := unsafe.Pointer(&_internal_little2_encoding_ns)
  23133. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  23134. *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_little2_contentTok)
  23135. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_cdataSectionTok)
  23136. *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_little2_ignoreSectionTok)
  23137. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_attributeValueTok)
  23138. *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_little2_entityValueTok)
  23139. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_nameMatchesAscii)
  23140. *(*uintptr)(unsafe.Add(p, 28)) = __ccgo_fp(_little2_nameLength)
  23141. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_skipS)
  23142. *(*uintptr)(unsafe.Add(p, 36)) = __ccgo_fp(_little2_getAtts)
  23143. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_charRefNumber)
  23144. *(*uintptr)(unsafe.Add(p, 44)) = __ccgo_fp(_little2_predefinedEntityName)
  23145. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_updatePosition)
  23146. *(*uintptr)(unsafe.Add(p, 52)) = __ccgo_fp(_little2_isPublicId)
  23147. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_toUtf8)
  23148. *(*uintptr)(unsafe.Add(p, 60)) = __ccgo_fp(_little2_toUtf16)
  23149. }
  23150. var _internal_little2_encoding = Tnormal_encoding{
  23151. Fenc: TENCODING{
  23152. Fscanners: [4]TSCANNER{},
  23153. FliteralScanners: [2]TSCANNER{},
  23154. FminBytesPerChar: int32(2),
  23155. FisUtf16: uint8(1),
  23156. },
  23157. Ftype1: [256]uint8{
  23158. 9: uint8(_BT_S),
  23159. 10: uint8(_BT_LF),
  23160. 13: uint8(_BT_S),
  23161. 32: uint8(_BT_S),
  23162. 33: uint8(_BT_EXCL),
  23163. 34: uint8(_BT_QUOT),
  23164. 35: uint8(_BT_NUM),
  23165. 36: uint8(_BT_OTHER),
  23166. 37: uint8(_BT_PERCNT),
  23167. 38: uint8(_BT_AMP),
  23168. 39: uint8(_BT_APOS),
  23169. 40: uint8(_BT_LPAR),
  23170. 41: uint8(_BT_RPAR),
  23171. 42: uint8(_BT_AST),
  23172. 43: uint8(_BT_PLUS),
  23173. 44: uint8(_BT_COMMA),
  23174. 45: uint8(_BT_MINUS),
  23175. 46: uint8(_BT_NAME),
  23176. 47: uint8(_BT_SOL),
  23177. 48: uint8(_BT_DIGIT),
  23178. 49: uint8(_BT_DIGIT),
  23179. 50: uint8(_BT_DIGIT),
  23180. 51: uint8(_BT_DIGIT),
  23181. 52: uint8(_BT_DIGIT),
  23182. 53: uint8(_BT_DIGIT),
  23183. 54: uint8(_BT_DIGIT),
  23184. 55: uint8(_BT_DIGIT),
  23185. 56: uint8(_BT_DIGIT),
  23186. 57: uint8(_BT_DIGIT),
  23187. 58: uint8(_BT_NMSTRT),
  23188. 59: uint8(_BT_SEMI),
  23189. 60: uint8(_BT_LT),
  23190. 61: uint8(_BT_EQUALS),
  23191. 62: uint8(_BT_GT),
  23192. 63: uint8(_BT_QUEST),
  23193. 64: uint8(_BT_OTHER),
  23194. 65: uint8(_BT_HEX),
  23195. 66: uint8(_BT_HEX),
  23196. 67: uint8(_BT_HEX),
  23197. 68: uint8(_BT_HEX),
  23198. 69: uint8(_BT_HEX),
  23199. 70: uint8(_BT_HEX),
  23200. 71: uint8(_BT_NMSTRT),
  23201. 72: uint8(_BT_NMSTRT),
  23202. 73: uint8(_BT_NMSTRT),
  23203. 74: uint8(_BT_NMSTRT),
  23204. 75: uint8(_BT_NMSTRT),
  23205. 76: uint8(_BT_NMSTRT),
  23206. 77: uint8(_BT_NMSTRT),
  23207. 78: uint8(_BT_NMSTRT),
  23208. 79: uint8(_BT_NMSTRT),
  23209. 80: uint8(_BT_NMSTRT),
  23210. 81: uint8(_BT_NMSTRT),
  23211. 82: uint8(_BT_NMSTRT),
  23212. 83: uint8(_BT_NMSTRT),
  23213. 84: uint8(_BT_NMSTRT),
  23214. 85: uint8(_BT_NMSTRT),
  23215. 86: uint8(_BT_NMSTRT),
  23216. 87: uint8(_BT_NMSTRT),
  23217. 88: uint8(_BT_NMSTRT),
  23218. 89: uint8(_BT_NMSTRT),
  23219. 90: uint8(_BT_NMSTRT),
  23220. 91: uint8(_BT_LSQB),
  23221. 92: uint8(_BT_OTHER),
  23222. 93: uint8(_BT_RSQB),
  23223. 94: uint8(_BT_OTHER),
  23224. 95: uint8(_BT_NMSTRT),
  23225. 96: uint8(_BT_OTHER),
  23226. 97: uint8(_BT_HEX),
  23227. 98: uint8(_BT_HEX),
  23228. 99: uint8(_BT_HEX),
  23229. 100: uint8(_BT_HEX),
  23230. 101: uint8(_BT_HEX),
  23231. 102: uint8(_BT_HEX),
  23232. 103: uint8(_BT_NMSTRT),
  23233. 104: uint8(_BT_NMSTRT),
  23234. 105: uint8(_BT_NMSTRT),
  23235. 106: uint8(_BT_NMSTRT),
  23236. 107: uint8(_BT_NMSTRT),
  23237. 108: uint8(_BT_NMSTRT),
  23238. 109: uint8(_BT_NMSTRT),
  23239. 110: uint8(_BT_NMSTRT),
  23240. 111: uint8(_BT_NMSTRT),
  23241. 112: uint8(_BT_NMSTRT),
  23242. 113: uint8(_BT_NMSTRT),
  23243. 114: uint8(_BT_NMSTRT),
  23244. 115: uint8(_BT_NMSTRT),
  23245. 116: uint8(_BT_NMSTRT),
  23246. 117: uint8(_BT_NMSTRT),
  23247. 118: uint8(_BT_NMSTRT),
  23248. 119: uint8(_BT_NMSTRT),
  23249. 120: uint8(_BT_NMSTRT),
  23250. 121: uint8(_BT_NMSTRT),
  23251. 122: uint8(_BT_NMSTRT),
  23252. 123: uint8(_BT_OTHER),
  23253. 124: uint8(_BT_VERBAR),
  23254. 125: uint8(_BT_OTHER),
  23255. 126: uint8(_BT_OTHER),
  23256. 127: uint8(_BT_OTHER),
  23257. 128: uint8(_BT_OTHER),
  23258. 129: uint8(_BT_OTHER),
  23259. 130: uint8(_BT_OTHER),
  23260. 131: uint8(_BT_OTHER),
  23261. 132: uint8(_BT_OTHER),
  23262. 133: uint8(_BT_OTHER),
  23263. 134: uint8(_BT_OTHER),
  23264. 135: uint8(_BT_OTHER),
  23265. 136: uint8(_BT_OTHER),
  23266. 137: uint8(_BT_OTHER),
  23267. 138: uint8(_BT_OTHER),
  23268. 139: uint8(_BT_OTHER),
  23269. 140: uint8(_BT_OTHER),
  23270. 141: uint8(_BT_OTHER),
  23271. 142: uint8(_BT_OTHER),
  23272. 143: uint8(_BT_OTHER),
  23273. 144: uint8(_BT_OTHER),
  23274. 145: uint8(_BT_OTHER),
  23275. 146: uint8(_BT_OTHER),
  23276. 147: uint8(_BT_OTHER),
  23277. 148: uint8(_BT_OTHER),
  23278. 149: uint8(_BT_OTHER),
  23279. 150: uint8(_BT_OTHER),
  23280. 151: uint8(_BT_OTHER),
  23281. 152: uint8(_BT_OTHER),
  23282. 153: uint8(_BT_OTHER),
  23283. 154: uint8(_BT_OTHER),
  23284. 155: uint8(_BT_OTHER),
  23285. 156: uint8(_BT_OTHER),
  23286. 157: uint8(_BT_OTHER),
  23287. 158: uint8(_BT_OTHER),
  23288. 159: uint8(_BT_OTHER),
  23289. 160: uint8(_BT_OTHER),
  23290. 161: uint8(_BT_OTHER),
  23291. 162: uint8(_BT_OTHER),
  23292. 163: uint8(_BT_OTHER),
  23293. 164: uint8(_BT_OTHER),
  23294. 165: uint8(_BT_OTHER),
  23295. 166: uint8(_BT_OTHER),
  23296. 167: uint8(_BT_OTHER),
  23297. 168: uint8(_BT_OTHER),
  23298. 169: uint8(_BT_OTHER),
  23299. 170: uint8(_BT_NMSTRT),
  23300. 171: uint8(_BT_OTHER),
  23301. 172: uint8(_BT_OTHER),
  23302. 173: uint8(_BT_OTHER),
  23303. 174: uint8(_BT_OTHER),
  23304. 175: uint8(_BT_OTHER),
  23305. 176: uint8(_BT_OTHER),
  23306. 177: uint8(_BT_OTHER),
  23307. 178: uint8(_BT_OTHER),
  23308. 179: uint8(_BT_OTHER),
  23309. 180: uint8(_BT_OTHER),
  23310. 181: uint8(_BT_NMSTRT),
  23311. 182: uint8(_BT_OTHER),
  23312. 183: uint8(_BT_NAME),
  23313. 184: uint8(_BT_OTHER),
  23314. 185: uint8(_BT_OTHER),
  23315. 186: uint8(_BT_NMSTRT),
  23316. 187: uint8(_BT_OTHER),
  23317. 188: uint8(_BT_OTHER),
  23318. 189: uint8(_BT_OTHER),
  23319. 190: uint8(_BT_OTHER),
  23320. 191: uint8(_BT_OTHER),
  23321. 192: uint8(_BT_NMSTRT),
  23322. 193: uint8(_BT_NMSTRT),
  23323. 194: uint8(_BT_NMSTRT),
  23324. 195: uint8(_BT_NMSTRT),
  23325. 196: uint8(_BT_NMSTRT),
  23326. 197: uint8(_BT_NMSTRT),
  23327. 198: uint8(_BT_NMSTRT),
  23328. 199: uint8(_BT_NMSTRT),
  23329. 200: uint8(_BT_NMSTRT),
  23330. 201: uint8(_BT_NMSTRT),
  23331. 202: uint8(_BT_NMSTRT),
  23332. 203: uint8(_BT_NMSTRT),
  23333. 204: uint8(_BT_NMSTRT),
  23334. 205: uint8(_BT_NMSTRT),
  23335. 206: uint8(_BT_NMSTRT),
  23336. 207: uint8(_BT_NMSTRT),
  23337. 208: uint8(_BT_NMSTRT),
  23338. 209: uint8(_BT_NMSTRT),
  23339. 210: uint8(_BT_NMSTRT),
  23340. 211: uint8(_BT_NMSTRT),
  23341. 212: uint8(_BT_NMSTRT),
  23342. 213: uint8(_BT_NMSTRT),
  23343. 214: uint8(_BT_NMSTRT),
  23344. 215: uint8(_BT_OTHER),
  23345. 216: uint8(_BT_NMSTRT),
  23346. 217: uint8(_BT_NMSTRT),
  23347. 218: uint8(_BT_NMSTRT),
  23348. 219: uint8(_BT_NMSTRT),
  23349. 220: uint8(_BT_NMSTRT),
  23350. 221: uint8(_BT_NMSTRT),
  23351. 222: uint8(_BT_NMSTRT),
  23352. 223: uint8(_BT_NMSTRT),
  23353. 224: uint8(_BT_NMSTRT),
  23354. 225: uint8(_BT_NMSTRT),
  23355. 226: uint8(_BT_NMSTRT),
  23356. 227: uint8(_BT_NMSTRT),
  23357. 228: uint8(_BT_NMSTRT),
  23358. 229: uint8(_BT_NMSTRT),
  23359. 230: uint8(_BT_NMSTRT),
  23360. 231: uint8(_BT_NMSTRT),
  23361. 232: uint8(_BT_NMSTRT),
  23362. 233: uint8(_BT_NMSTRT),
  23363. 234: uint8(_BT_NMSTRT),
  23364. 235: uint8(_BT_NMSTRT),
  23365. 236: uint8(_BT_NMSTRT),
  23366. 237: uint8(_BT_NMSTRT),
  23367. 238: uint8(_BT_NMSTRT),
  23368. 239: uint8(_BT_NMSTRT),
  23369. 240: uint8(_BT_NMSTRT),
  23370. 241: uint8(_BT_NMSTRT),
  23371. 242: uint8(_BT_NMSTRT),
  23372. 243: uint8(_BT_NMSTRT),
  23373. 244: uint8(_BT_NMSTRT),
  23374. 245: uint8(_BT_NMSTRT),
  23375. 246: uint8(_BT_NMSTRT),
  23376. 247: uint8(_BT_OTHER),
  23377. 248: uint8(_BT_NMSTRT),
  23378. 249: uint8(_BT_NMSTRT),
  23379. 250: uint8(_BT_NMSTRT),
  23380. 251: uint8(_BT_NMSTRT),
  23381. 252: uint8(_BT_NMSTRT),
  23382. 253: uint8(_BT_NMSTRT),
  23383. 254: uint8(_BT_NMSTRT),
  23384. 255: uint8(_BT_NMSTRT),
  23385. },
  23386. }
  23387. func init() {
  23388. p := unsafe.Pointer(&_internal_little2_encoding)
  23389. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  23390. *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_little2_contentTok)
  23391. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_cdataSectionTok)
  23392. *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_little2_ignoreSectionTok)
  23393. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_attributeValueTok)
  23394. *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_little2_entityValueTok)
  23395. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_nameMatchesAscii)
  23396. *(*uintptr)(unsafe.Add(p, 28)) = __ccgo_fp(_little2_nameLength)
  23397. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_skipS)
  23398. *(*uintptr)(unsafe.Add(p, 36)) = __ccgo_fp(_little2_getAtts)
  23399. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_charRefNumber)
  23400. *(*uintptr)(unsafe.Add(p, 44)) = __ccgo_fp(_little2_predefinedEntityName)
  23401. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_updatePosition)
  23402. *(*uintptr)(unsafe.Add(p, 52)) = __ccgo_fp(_little2_isPublicId)
  23403. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_toUtf8)
  23404. *(*uintptr)(unsafe.Add(p, 60)) = __ccgo_fp(_little2_toUtf16)
  23405. }
  23406. /* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
  23407. /* This file is included (from xmltok.c, 1-3 times depending on XML_MIN_SIZE)!
  23408. __ __ _
  23409. ___\ \/ /_ __ __ _| |_
  23410. / _ \\ /| '_ \ / _` | __|
  23411. | __// \| |_) | (_| | |_
  23412. \___/_/\_\ .__/ \__,_|\__|
  23413. |_| XML parser
  23414. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  23415. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  23416. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  23417. Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
  23418. Copyright (c) 2016-2022 Sebastian Pipping <sebastian@pipping.org>
  23419. Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
  23420. Copyright (c) 2018 Benjamin Peterson <benjamin@python.org>
  23421. Copyright (c) 2018 Anton Maklakov <antmak.pub@gmail.com>
  23422. Copyright (c) 2019 David Loffredo <loffredo@steptools.com>
  23423. Copyright (c) 2020 Boris Kolpackov <boris@codesynthesis.com>
  23424. Copyright (c) 2022 Martin Ettl <ettl.martin78@googlemail.com>
  23425. Licensed under the MIT license:
  23426. Permission is hereby granted, free of charge, to any person obtaining
  23427. a copy of this software and associated documentation files (the
  23428. "Software"), to deal in the Software without restriction, including
  23429. without limitation the rights to use, copy, modify, merge, publish,
  23430. distribute, sublicense, and/or sell copies of the Software, and to permit
  23431. persons to whom the Software is furnished to do so, subject to the
  23432. following conditions:
  23433. The above copyright notice and this permission notice shall be included
  23434. in all copies or substantial portions of the Software.
  23435. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  23436. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23437. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  23438. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  23439. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  23440. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  23441. USE OR OTHER DEALINGS IN THE SOFTWARE.
  23442. */
  23443. /* ptr points to character following "<!-" */
  23444. func _big2_scanComment(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23445. var v1 int32
  23446. _ = v1
  23447. if int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  23448. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_MINUS1)) {
  23449. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23450. return m_XML_TOK_INVALID
  23451. }
  23452. ptr += uintptr(2)
  23453. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  23454. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23455. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23456. } else {
  23457. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23458. }
  23459. switch v1 {
  23460. case int32(_BT_LEAD2):
  23461. if int32(end)-int32(ptr) < int32(2) {
  23462. return -int32(2)
  23463. }
  23464. if 0 != 0 {
  23465. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23466. return m_XML_TOK_INVALID
  23467. }
  23468. ptr += uintptr(2)
  23469. case int32(_BT_LEAD3):
  23470. if int32(end)-int32(ptr) < int32(3) {
  23471. return -int32(2)
  23472. }
  23473. if 0 != 0 {
  23474. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23475. return m_XML_TOK_INVALID
  23476. }
  23477. ptr += uintptr(3)
  23478. case int32(_BT_LEAD4):
  23479. if int32(end)-int32(ptr) < int32(4) {
  23480. return -int32(2)
  23481. }
  23482. if 0 != 0 {
  23483. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23484. return m_XML_TOK_INVALID
  23485. }
  23486. ptr += uintptr(4)
  23487. case int32(_BT_NONXML):
  23488. fallthrough
  23489. case int32(_BT_MALFORM):
  23490. fallthrough
  23491. case int32(_BT_TRAIL):
  23492. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23493. return m_XML_TOK_INVALID
  23494. case int32(_BT_MINUS):
  23495. ptr += uintptr(2)
  23496. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23497. return -int32(1)
  23498. }
  23499. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_MINUS1) {
  23500. ptr += uintptr(2)
  23501. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23502. return -int32(1)
  23503. }
  23504. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  23505. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23506. return m_XML_TOK_INVALID
  23507. }
  23508. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23509. return int32(m_XML_TOK_COMMENT)
  23510. }
  23511. default:
  23512. ptr += uintptr(2)
  23513. break
  23514. }
  23515. }
  23516. }
  23517. return -int32(1)
  23518. }
  23519. /* ptr points to character following "<!" */
  23520. func _big2_scanDecl(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23521. var v1, v2, v3 int32
  23522. _, _, _ = v1, v2, v3
  23523. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23524. return -int32(1)
  23525. }
  23526. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23527. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23528. } else {
  23529. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23530. }
  23531. switch v1 {
  23532. case int32(_BT_MINUS):
  23533. return _big2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  23534. case int32(_BT_LSQB):
  23535. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23536. return int32(m_XML_TOK_COND_SECT_OPEN)
  23537. case int32(_BT_NMSTRT):
  23538. fallthrough
  23539. case int32(_BT_HEX):
  23540. ptr += uintptr(2)
  23541. default:
  23542. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23543. return m_XML_TOK_INVALID
  23544. }
  23545. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  23546. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23547. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23548. } else {
  23549. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23550. }
  23551. switch v2 {
  23552. case int32(_BT_PERCNT):
  23553. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) {
  23554. return -int32(1)
  23555. }
  23556. /* don't allow <!ENTITY% foo "whatever"> */
  23557. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 {
  23558. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))))))
  23559. } else {
  23560. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))), *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))
  23561. }
  23562. switch v3 {
  23563. case int32(_BT_S):
  23564. fallthrough
  23565. case int32(_BT_CR):
  23566. fallthrough
  23567. case int32(_BT_LF):
  23568. fallthrough
  23569. case int32(_BT_PERCNT):
  23570. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23571. return m_XML_TOK_INVALID
  23572. }
  23573. /* fall through */
  23574. fallthrough
  23575. case int32(_BT_S):
  23576. fallthrough
  23577. case int32(_BT_CR):
  23578. fallthrough
  23579. case int32(_BT_LF):
  23580. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23581. return int32(m_XML_TOK_DECL_OPEN)
  23582. case int32(_BT_NMSTRT):
  23583. fallthrough
  23584. case int32(_BT_HEX):
  23585. ptr += uintptr(2)
  23586. default:
  23587. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23588. return m_XML_TOK_INVALID
  23589. }
  23590. }
  23591. return -int32(1)
  23592. }
  23593. func _big2_checkPiTarget(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, tokPtr uintptr) (r int32) {
  23594. var upper, v1, v2, v3 int32
  23595. _, _, _, _ = upper, v1, v2, v3
  23596. upper = 0
  23597. _ = enc
  23598. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_PI)
  23599. if int32(end)-int32(ptr) != libc.Int32FromInt32(2)*libc.Int32FromInt32(3) {
  23600. return int32(1)
  23601. }
  23602. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23603. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  23604. } else {
  23605. v1 = -int32(1)
  23606. }
  23607. switch v1 {
  23608. case int32(m_ASCII_x2):
  23609. case int32(m_ASCII_X):
  23610. upper = int32(1)
  23611. default:
  23612. return int32(1)
  23613. }
  23614. ptr += uintptr(2)
  23615. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23616. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  23617. } else {
  23618. v2 = -int32(1)
  23619. }
  23620. switch v2 {
  23621. case int32(m_ASCII_m2):
  23622. case int32(m_ASCII_M):
  23623. upper = int32(1)
  23624. default:
  23625. return int32(1)
  23626. }
  23627. ptr += uintptr(2)
  23628. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23629. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  23630. } else {
  23631. v3 = -int32(1)
  23632. }
  23633. switch v3 {
  23634. case int32(m_ASCII_l2):
  23635. case int32(m_ASCII_L):
  23636. upper = int32(1)
  23637. default:
  23638. return int32(1)
  23639. }
  23640. if upper != 0 {
  23641. return 0
  23642. }
  23643. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_XML_DECL)
  23644. return int32(1)
  23645. }
  23646. /* ptr points to character following "<?" */
  23647. func _big2_scanPi(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23648. bp := tls.Alloc(16)
  23649. defer tls.Free(16)
  23650. var target uintptr
  23651. var v1, v2, v3 int32
  23652. var _ /* tok at bp+0 */ int32
  23653. _, _, _, _ = target, v1, v2, v3
  23654. target = ptr
  23655. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23656. return -int32(1)
  23657. }
  23658. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23659. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23660. } else {
  23661. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23662. }
  23663. switch v1 {
  23664. case int32(_BT_NONASCII):
  23665. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  23666. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23667. return m_XML_TOK_INVALID
  23668. } /* fall through */
  23669. fallthrough
  23670. case int32(_BT_NMSTRT):
  23671. fallthrough
  23672. case int32(_BT_HEX):
  23673. ptr += uintptr(2)
  23674. case int32(_BT_LEAD2):
  23675. if int32(end)-int32(ptr) < int32(2) {
  23676. return -int32(2)
  23677. }
  23678. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23679. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23680. return m_XML_TOK_INVALID
  23681. }
  23682. ptr += uintptr(2)
  23683. case int32(_BT_LEAD3):
  23684. if int32(end)-int32(ptr) < int32(3) {
  23685. return -int32(2)
  23686. }
  23687. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23688. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23689. return m_XML_TOK_INVALID
  23690. }
  23691. ptr += uintptr(3)
  23692. case int32(_BT_LEAD4):
  23693. if int32(end)-int32(ptr) < int32(4) {
  23694. return -int32(2)
  23695. }
  23696. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23697. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23698. return m_XML_TOK_INVALID
  23699. }
  23700. ptr += uintptr(4)
  23701. default:
  23702. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23703. return m_XML_TOK_INVALID
  23704. }
  23705. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  23706. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23707. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23708. } else {
  23709. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23710. }
  23711. switch v2 {
  23712. case int32(_BT_NONASCII):
  23713. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  23714. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23715. return m_XML_TOK_INVALID
  23716. } /* fall through */
  23717. fallthrough
  23718. case int32(_BT_NMSTRT):
  23719. fallthrough
  23720. case int32(_BT_HEX):
  23721. fallthrough
  23722. case int32(_BT_DIGIT):
  23723. fallthrough
  23724. case int32(_BT_NAME):
  23725. fallthrough
  23726. case int32(_BT_MINUS):
  23727. ptr += uintptr(2)
  23728. case int32(_BT_LEAD2):
  23729. if int32(end)-int32(ptr) < int32(2) {
  23730. return -int32(2)
  23731. }
  23732. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23733. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23734. return m_XML_TOK_INVALID
  23735. }
  23736. ptr += uintptr(2)
  23737. case int32(_BT_LEAD3):
  23738. if int32(end)-int32(ptr) < int32(3) {
  23739. return -int32(2)
  23740. }
  23741. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23742. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23743. return m_XML_TOK_INVALID
  23744. }
  23745. ptr += uintptr(3)
  23746. case int32(_BT_LEAD4):
  23747. if int32(end)-int32(ptr) < int32(4) {
  23748. return -int32(2)
  23749. }
  23750. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23751. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23752. return m_XML_TOK_INVALID
  23753. }
  23754. ptr += uintptr(4)
  23755. case int32(_BT_S):
  23756. fallthrough
  23757. case int32(_BT_CR):
  23758. fallthrough
  23759. case int32(_BT_LF):
  23760. if !(_big2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  23761. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23762. return m_XML_TOK_INVALID
  23763. }
  23764. ptr += uintptr(2)
  23765. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  23766. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23767. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23768. } else {
  23769. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23770. }
  23771. switch v3 {
  23772. case int32(_BT_LEAD2):
  23773. if int32(end)-int32(ptr) < int32(2) {
  23774. return -int32(2)
  23775. }
  23776. if 0 != 0 {
  23777. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23778. return m_XML_TOK_INVALID
  23779. }
  23780. ptr += uintptr(2)
  23781. case int32(_BT_LEAD3):
  23782. if int32(end)-int32(ptr) < int32(3) {
  23783. return -int32(2)
  23784. }
  23785. if 0 != 0 {
  23786. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23787. return m_XML_TOK_INVALID
  23788. }
  23789. ptr += uintptr(3)
  23790. case int32(_BT_LEAD4):
  23791. if int32(end)-int32(ptr) < int32(4) {
  23792. return -int32(2)
  23793. }
  23794. if 0 != 0 {
  23795. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23796. return m_XML_TOK_INVALID
  23797. }
  23798. ptr += uintptr(4)
  23799. case int32(_BT_NONXML):
  23800. fallthrough
  23801. case int32(_BT_MALFORM):
  23802. fallthrough
  23803. case int32(_BT_TRAIL):
  23804. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23805. return m_XML_TOK_INVALID
  23806. case int32(_BT_QUEST):
  23807. ptr += uintptr(2)
  23808. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23809. return -int32(1)
  23810. }
  23811. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1) {
  23812. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23813. return *(*int32)(unsafe.Pointer(bp))
  23814. }
  23815. default:
  23816. ptr += uintptr(2)
  23817. break
  23818. }
  23819. }
  23820. return -int32(1)
  23821. case int32(_BT_QUEST):
  23822. if !(_big2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  23823. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23824. return m_XML_TOK_INVALID
  23825. }
  23826. ptr += uintptr(2)
  23827. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23828. return -int32(1)
  23829. }
  23830. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1) {
  23831. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23832. return *(*int32)(unsafe.Pointer(bp))
  23833. }
  23834. /* fall through */
  23835. fallthrough
  23836. default:
  23837. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23838. return m_XML_TOK_INVALID
  23839. }
  23840. }
  23841. return -int32(1)
  23842. }
  23843. func _big2_scanCdataSection(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23844. var i int32
  23845. _ = i
  23846. _ = enc
  23847. /* CDATA[ */
  23848. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(6)*libc.Int32FromInt32(2)) {
  23849. return -int32(1)
  23850. }
  23851. i = 0
  23852. for {
  23853. if !(i < int32(6)) {
  23854. break
  23855. }
  23856. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == libc.Int32FromUint8(_CDATA_LSQB2[i])) {
  23857. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23858. return m_XML_TOK_INVALID
  23859. }
  23860. goto _1
  23861. _1:
  23862. ;
  23863. i++
  23864. ptr += uintptr(2)
  23865. }
  23866. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23867. return int32(m_XML_TOK_CDATA_SECT_OPEN)
  23868. }
  23869. var _CDATA_LSQB2 = [6]uint8{
  23870. 0: uint8(m_ASCII_C),
  23871. 1: uint8(m_ASCII_D),
  23872. 2: uint8(m_ASCII_A),
  23873. 3: uint8(m_ASCII_T),
  23874. 4: uint8(m_ASCII_A),
  23875. 5: uint8(m_ASCII_LSQB1),
  23876. }
  23877. func _big2_cdataSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23878. var n Tsize_t
  23879. var v1, v2, v3 int32
  23880. _, _, _, _ = n, v1, v2, v3
  23881. if ptr >= end {
  23882. return -int32(4)
  23883. }
  23884. if int32(2) > int32(1) {
  23885. n = libc.Uint32FromInt32(int32(end) - int32(ptr))
  23886. if n&libc.Uint32FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  23887. n &= libc.Uint32FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  23888. if n == uint32(0) {
  23889. return -int32(1)
  23890. }
  23891. end = ptr + uintptr(n)
  23892. }
  23893. }
  23894. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23895. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23896. } else {
  23897. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23898. }
  23899. switch v1 {
  23900. case int32(_BT_RSQB):
  23901. ptr += uintptr(2)
  23902. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23903. return -int32(1)
  23904. }
  23905. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1)) {
  23906. break
  23907. }
  23908. ptr += uintptr(2)
  23909. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23910. return -int32(1)
  23911. }
  23912. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  23913. ptr -= uintptr(2)
  23914. break
  23915. }
  23916. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23917. return int32(m_XML_TOK_CDATA_SECT_CLOSE)
  23918. case int32(_BT_CR):
  23919. ptr += uintptr(2)
  23920. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23921. return -int32(1)
  23922. }
  23923. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23924. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23925. } else {
  23926. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23927. }
  23928. if v2 == int32(_BT_LF) {
  23929. ptr += uintptr(2)
  23930. }
  23931. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23932. return int32(m_XML_TOK_DATA_NEWLINE)
  23933. case int32(_BT_LF):
  23934. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23935. return int32(m_XML_TOK_DATA_NEWLINE)
  23936. case int32(_BT_LEAD2):
  23937. if int32(end)-int32(ptr) < int32(2) {
  23938. return -int32(2)
  23939. }
  23940. if 0 != 0 {
  23941. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23942. return m_XML_TOK_INVALID
  23943. }
  23944. ptr += uintptr(2)
  23945. case int32(_BT_LEAD3):
  23946. if int32(end)-int32(ptr) < int32(3) {
  23947. return -int32(2)
  23948. }
  23949. if 0 != 0 {
  23950. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23951. return m_XML_TOK_INVALID
  23952. }
  23953. ptr += uintptr(3)
  23954. case int32(_BT_LEAD4):
  23955. if int32(end)-int32(ptr) < int32(4) {
  23956. return -int32(2)
  23957. }
  23958. if 0 != 0 {
  23959. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23960. return m_XML_TOK_INVALID
  23961. }
  23962. ptr += uintptr(4)
  23963. case int32(_BT_NONXML):
  23964. fallthrough
  23965. case int32(_BT_MALFORM):
  23966. fallthrough
  23967. case int32(_BT_TRAIL):
  23968. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23969. return m_XML_TOK_INVALID
  23970. default:
  23971. ptr += uintptr(2)
  23972. break
  23973. }
  23974. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  23975. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23976. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23977. } else {
  23978. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23979. }
  23980. switch v3 {
  23981. case int32(_BT_LEAD2):
  23982. if int32(end)-int32(ptr) < int32(2) || libc.Bool(0 != 0) {
  23983. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23984. return int32(m_XML_TOK_DATA_CHARS)
  23985. }
  23986. ptr += uintptr(2)
  23987. case int32(_BT_LEAD3):
  23988. if int32(end)-int32(ptr) < int32(3) || libc.Bool(0 != 0) {
  23989. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23990. return int32(m_XML_TOK_DATA_CHARS)
  23991. }
  23992. ptr += uintptr(3)
  23993. case int32(_BT_LEAD4):
  23994. if int32(end)-int32(ptr) < int32(4) || libc.Bool(0 != 0) {
  23995. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23996. return int32(m_XML_TOK_DATA_CHARS)
  23997. }
  23998. ptr += uintptr(4)
  23999. case int32(_BT_NONXML):
  24000. fallthrough
  24001. case int32(_BT_MALFORM):
  24002. fallthrough
  24003. case int32(_BT_TRAIL):
  24004. fallthrough
  24005. case int32(_BT_CR):
  24006. fallthrough
  24007. case int32(_BT_LF):
  24008. fallthrough
  24009. case int32(_BT_RSQB):
  24010. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24011. return int32(m_XML_TOK_DATA_CHARS)
  24012. default:
  24013. ptr += uintptr(2)
  24014. break
  24015. }
  24016. }
  24017. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24018. return int32(m_XML_TOK_DATA_CHARS)
  24019. }
  24020. /* ptr points to character following "</" */
  24021. func _big2_scanEndTag(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24022. var v1, v2, v22 int32
  24023. _, _, _ = v1, v2, v22
  24024. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24025. return -int32(1)
  24026. }
  24027. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24028. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24029. } else {
  24030. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24031. }
  24032. switch v1 {
  24033. case int32(_BT_NONASCII):
  24034. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  24035. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24036. return m_XML_TOK_INVALID
  24037. } /* fall through */
  24038. fallthrough
  24039. case int32(_BT_NMSTRT):
  24040. fallthrough
  24041. case int32(_BT_HEX):
  24042. ptr += uintptr(2)
  24043. case int32(_BT_LEAD2):
  24044. if int32(end)-int32(ptr) < int32(2) {
  24045. return -int32(2)
  24046. }
  24047. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24048. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24049. return m_XML_TOK_INVALID
  24050. }
  24051. ptr += uintptr(2)
  24052. case int32(_BT_LEAD3):
  24053. if int32(end)-int32(ptr) < int32(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. case int32(_BT_LEAD4):
  24062. if int32(end)-int32(ptr) < int32(4) {
  24063. return -int32(2)
  24064. }
  24065. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24066. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24067. return m_XML_TOK_INVALID
  24068. }
  24069. ptr += uintptr(4)
  24070. default:
  24071. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24072. return m_XML_TOK_INVALID
  24073. }
  24074. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  24075. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24076. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24077. } else {
  24078. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24079. }
  24080. switch v2 {
  24081. case int32(_BT_NONASCII):
  24082. goto _3
  24083. case int32(_BT_MINUS):
  24084. goto _4
  24085. case int32(_BT_NAME):
  24086. goto _5
  24087. case int32(_BT_DIGIT):
  24088. goto _6
  24089. case int32(_BT_HEX):
  24090. goto _7
  24091. case int32(_BT_NMSTRT):
  24092. goto _8
  24093. case int32(_BT_LEAD2):
  24094. goto _9
  24095. case int32(_BT_LEAD3):
  24096. goto _10
  24097. case int32(_BT_LEAD4):
  24098. goto _11
  24099. case int32(_BT_LF):
  24100. goto _12
  24101. case int32(_BT_CR):
  24102. goto _13
  24103. case int32(_BT_S):
  24104. goto _14
  24105. case int32(_BT_COLON):
  24106. goto _15
  24107. case int32(_BT_GT):
  24108. goto _16
  24109. default:
  24110. goto _17
  24111. }
  24112. goto _18
  24113. _3:
  24114. ;
  24115. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  24116. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24117. return m_XML_TOK_INVALID
  24118. } /* fall through */
  24119. _8:
  24120. ;
  24121. _7:
  24122. ;
  24123. _6:
  24124. ;
  24125. _5:
  24126. ;
  24127. _4:
  24128. ;
  24129. ptr += uintptr(2)
  24130. goto _18
  24131. _9:
  24132. ;
  24133. if int32(end)-int32(ptr) < int32(2) {
  24134. return -int32(2)
  24135. }
  24136. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24137. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24138. return m_XML_TOK_INVALID
  24139. }
  24140. ptr += uintptr(2)
  24141. goto _18
  24142. _10:
  24143. ;
  24144. if int32(end)-int32(ptr) < int32(3) {
  24145. return -int32(2)
  24146. }
  24147. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24148. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24149. return m_XML_TOK_INVALID
  24150. }
  24151. ptr += uintptr(3)
  24152. goto _18
  24153. _11:
  24154. ;
  24155. if int32(end)-int32(ptr) < int32(4) {
  24156. return -int32(2)
  24157. }
  24158. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24159. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24160. return m_XML_TOK_INVALID
  24161. }
  24162. ptr += uintptr(4)
  24163. goto _18
  24164. _14:
  24165. ;
  24166. _13:
  24167. ;
  24168. _12:
  24169. ;
  24170. ptr += uintptr(2)
  24171. _21:
  24172. ;
  24173. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24174. goto _19
  24175. }
  24176. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24177. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24178. } else {
  24179. v22 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24180. }
  24181. switch v22 {
  24182. case int32(_BT_S):
  24183. fallthrough
  24184. case int32(_BT_CR):
  24185. fallthrough
  24186. case int32(_BT_LF):
  24187. case int32(_BT_GT):
  24188. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24189. return int32(m_XML_TOK_END_TAG)
  24190. default:
  24191. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24192. return m_XML_TOK_INVALID
  24193. }
  24194. goto _20
  24195. _20:
  24196. ;
  24197. ptr += uintptr(2)
  24198. goto _21
  24199. goto _19
  24200. _19:
  24201. ;
  24202. return -int32(1)
  24203. _15:
  24204. ;
  24205. /* no need to check qname syntax here,
  24206. since end-tag must match exactly */
  24207. ptr += uintptr(2)
  24208. goto _18
  24209. _16:
  24210. ;
  24211. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24212. return int32(m_XML_TOK_END_TAG)
  24213. _17:
  24214. ;
  24215. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24216. return m_XML_TOK_INVALID
  24217. _18:
  24218. }
  24219. return -int32(1)
  24220. }
  24221. /* ptr points to character following "&#X" */
  24222. func _big2_scanHexCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24223. var v1, v3 int32
  24224. _, _ = v1, v3
  24225. if int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  24226. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24227. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24228. } else {
  24229. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24230. }
  24231. switch v1 {
  24232. case int32(_BT_DIGIT):
  24233. fallthrough
  24234. case int32(_BT_HEX):
  24235. default:
  24236. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24237. return m_XML_TOK_INVALID
  24238. }
  24239. ptr += uintptr(2)
  24240. for {
  24241. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24242. break
  24243. }
  24244. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24245. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24246. } else {
  24247. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24248. }
  24249. switch v3 {
  24250. case int32(_BT_DIGIT):
  24251. fallthrough
  24252. case int32(_BT_HEX):
  24253. case int32(_BT_SEMI):
  24254. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24255. return int32(m_XML_TOK_CHAR_REF)
  24256. default:
  24257. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24258. return m_XML_TOK_INVALID
  24259. }
  24260. goto _2
  24261. _2:
  24262. ;
  24263. ptr += uintptr(2)
  24264. }
  24265. }
  24266. return -int32(1)
  24267. }
  24268. /* ptr points to character following "&#" */
  24269. func _big2_scanCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24270. var v1, v3 int32
  24271. _, _ = v1, v3
  24272. if int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  24273. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_x2) {
  24274. return _big2_scanHexCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24275. }
  24276. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24277. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24278. } else {
  24279. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24280. }
  24281. switch v1 {
  24282. case int32(_BT_DIGIT):
  24283. default:
  24284. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24285. return m_XML_TOK_INVALID
  24286. }
  24287. ptr += uintptr(2)
  24288. for {
  24289. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24290. break
  24291. }
  24292. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24293. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24294. } else {
  24295. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24296. }
  24297. switch v3 {
  24298. case int32(_BT_DIGIT):
  24299. case int32(_BT_SEMI):
  24300. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24301. return int32(m_XML_TOK_CHAR_REF)
  24302. default:
  24303. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24304. return m_XML_TOK_INVALID
  24305. }
  24306. goto _2
  24307. _2:
  24308. ;
  24309. ptr += uintptr(2)
  24310. }
  24311. }
  24312. return -int32(1)
  24313. }
  24314. /* ptr points to character following "&" */
  24315. func _big2_scanRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24316. var v1, v2 int32
  24317. _, _ = v1, v2
  24318. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24319. return -int32(1)
  24320. }
  24321. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24322. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24323. } else {
  24324. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24325. }
  24326. switch v1 {
  24327. case int32(_BT_NONASCII):
  24328. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  24329. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24330. return m_XML_TOK_INVALID
  24331. } /* fall through */
  24332. fallthrough
  24333. case int32(_BT_NMSTRT):
  24334. fallthrough
  24335. case int32(_BT_HEX):
  24336. ptr += uintptr(2)
  24337. case int32(_BT_LEAD2):
  24338. if int32(end)-int32(ptr) < int32(2) {
  24339. return -int32(2)
  24340. }
  24341. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24342. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24343. return m_XML_TOK_INVALID
  24344. }
  24345. ptr += uintptr(2)
  24346. case int32(_BT_LEAD3):
  24347. if int32(end)-int32(ptr) < int32(3) {
  24348. return -int32(2)
  24349. }
  24350. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24351. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24352. return m_XML_TOK_INVALID
  24353. }
  24354. ptr += uintptr(3)
  24355. case int32(_BT_LEAD4):
  24356. if int32(end)-int32(ptr) < int32(4) {
  24357. return -int32(2)
  24358. }
  24359. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24360. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24361. return m_XML_TOK_INVALID
  24362. }
  24363. ptr += uintptr(4)
  24364. case int32(_BT_NUM):
  24365. return _big2_scanCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24366. default:
  24367. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24368. return m_XML_TOK_INVALID
  24369. }
  24370. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  24371. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24372. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24373. } else {
  24374. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24375. }
  24376. switch v2 {
  24377. case int32(_BT_NONASCII):
  24378. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  24379. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24380. return m_XML_TOK_INVALID
  24381. } /* fall through */
  24382. fallthrough
  24383. case int32(_BT_NMSTRT):
  24384. fallthrough
  24385. case int32(_BT_HEX):
  24386. fallthrough
  24387. case int32(_BT_DIGIT):
  24388. fallthrough
  24389. case int32(_BT_NAME):
  24390. fallthrough
  24391. case int32(_BT_MINUS):
  24392. ptr += uintptr(2)
  24393. case int32(_BT_LEAD2):
  24394. if int32(end)-int32(ptr) < int32(2) {
  24395. return -int32(2)
  24396. }
  24397. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24398. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24399. return m_XML_TOK_INVALID
  24400. }
  24401. ptr += uintptr(2)
  24402. case int32(_BT_LEAD3):
  24403. if int32(end)-int32(ptr) < int32(3) {
  24404. return -int32(2)
  24405. }
  24406. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24407. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24408. return m_XML_TOK_INVALID
  24409. }
  24410. ptr += uintptr(3)
  24411. case int32(_BT_LEAD4):
  24412. if int32(end)-int32(ptr) < int32(4) {
  24413. return -int32(2)
  24414. }
  24415. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24416. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24417. return m_XML_TOK_INVALID
  24418. }
  24419. ptr += uintptr(4)
  24420. case int32(_BT_SEMI):
  24421. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24422. return int32(m_XML_TOK_ENTITY_REF)
  24423. default:
  24424. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24425. return m_XML_TOK_INVALID
  24426. }
  24427. }
  24428. return -int32(1)
  24429. }
  24430. /* ptr points to character following first character of attribute name */
  24431. func _big2_scanAtts(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24432. bp := tls.Alloc(16)
  24433. defer tls.Free(16)
  24434. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  24435. var hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31 int32
  24436. _, _, _, _, _, _, _, _, _, _, _, _ = hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31
  24437. hadColon = 0
  24438. for int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  24439. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24440. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  24441. } else {
  24442. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24443. }
  24444. switch v1 {
  24445. case int32(_BT_NONASCII):
  24446. goto _2
  24447. case int32(_BT_MINUS):
  24448. goto _3
  24449. case int32(_BT_NAME):
  24450. goto _4
  24451. case int32(_BT_DIGIT):
  24452. goto _5
  24453. case int32(_BT_HEX):
  24454. goto _6
  24455. case int32(_BT_NMSTRT):
  24456. goto _7
  24457. case int32(_BT_LEAD2):
  24458. goto _8
  24459. case int32(_BT_LEAD3):
  24460. goto _9
  24461. case int32(_BT_LEAD4):
  24462. goto _10
  24463. case int32(_BT_COLON):
  24464. goto _11
  24465. case int32(_BT_LF):
  24466. goto _12
  24467. case int32(_BT_CR):
  24468. goto _13
  24469. case int32(_BT_S):
  24470. goto _14
  24471. case int32(_BT_EQUALS):
  24472. goto _15
  24473. default:
  24474. goto _16
  24475. }
  24476. goto _17
  24477. _2:
  24478. ;
  24479. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  24480. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24481. return m_XML_TOK_INVALID
  24482. } /* fall through */
  24483. _7:
  24484. ;
  24485. _6:
  24486. ;
  24487. _5:
  24488. ;
  24489. _4:
  24490. ;
  24491. _3:
  24492. ;
  24493. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24494. goto _17
  24495. _8:
  24496. ;
  24497. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(2) {
  24498. return -int32(2)
  24499. }
  24500. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24501. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24502. return m_XML_TOK_INVALID
  24503. }
  24504. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24505. goto _17
  24506. _9:
  24507. ;
  24508. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(3) {
  24509. return -int32(2)
  24510. }
  24511. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24512. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24513. return m_XML_TOK_INVALID
  24514. }
  24515. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  24516. goto _17
  24517. _10:
  24518. ;
  24519. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(4) {
  24520. return -int32(2)
  24521. }
  24522. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24523. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24524. return m_XML_TOK_INVALID
  24525. }
  24526. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  24527. goto _17
  24528. _11:
  24529. ;
  24530. if hadColon != 0 {
  24531. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24532. return m_XML_TOK_INVALID
  24533. }
  24534. hadColon = int32(1)
  24535. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24536. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24537. return -int32(1)
  24538. }
  24539. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24540. v18 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  24541. } else {
  24542. v18 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24543. }
  24544. switch v18 {
  24545. case int32(_BT_NONASCII):
  24546. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  24547. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24548. return m_XML_TOK_INVALID
  24549. } /* fall through */
  24550. fallthrough
  24551. case int32(_BT_NMSTRT):
  24552. fallthrough
  24553. case int32(_BT_HEX):
  24554. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24555. case int32(_BT_LEAD2):
  24556. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(2) {
  24557. return -int32(2)
  24558. }
  24559. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24560. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24561. return m_XML_TOK_INVALID
  24562. }
  24563. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24564. case int32(_BT_LEAD3):
  24565. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(3) {
  24566. return -int32(2)
  24567. }
  24568. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24569. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24570. return m_XML_TOK_INVALID
  24571. }
  24572. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  24573. case int32(_BT_LEAD4):
  24574. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(4) {
  24575. return -int32(2)
  24576. }
  24577. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24578. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24579. return m_XML_TOK_INVALID
  24580. }
  24581. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  24582. default:
  24583. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24584. return m_XML_TOK_INVALID
  24585. }
  24586. goto _17
  24587. _14:
  24588. ;
  24589. _13:
  24590. ;
  24591. _12:
  24592. ;
  24593. _21:
  24594. ;
  24595. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24596. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24597. return -int32(1)
  24598. }
  24599. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24600. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  24601. } else {
  24602. v22 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24603. }
  24604. t = v22
  24605. if t == int32(_BT_EQUALS) {
  24606. goto _19
  24607. }
  24608. switch t {
  24609. case int32(_BT_S):
  24610. fallthrough
  24611. case int32(_BT_LF):
  24612. fallthrough
  24613. case int32(_BT_CR):
  24614. default:
  24615. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24616. return m_XML_TOK_INVALID
  24617. }
  24618. goto _20
  24619. _20:
  24620. ;
  24621. goto _21
  24622. goto _19
  24623. _19:
  24624. ;
  24625. /* fall through */
  24626. _15:
  24627. ;
  24628. hadColon = 0
  24629. for {
  24630. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24631. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24632. return -int32(1)
  24633. }
  24634. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24635. v24 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  24636. } else {
  24637. v24 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24638. }
  24639. open = v24
  24640. if open == int32(_BT_QUOT) || open == int32(_BT_APOS) {
  24641. break
  24642. }
  24643. switch open {
  24644. case int32(_BT_S):
  24645. fallthrough
  24646. case int32(_BT_LF):
  24647. fallthrough
  24648. case int32(_BT_CR):
  24649. default:
  24650. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24651. return m_XML_TOK_INVALID
  24652. }
  24653. goto _23
  24654. _23:
  24655. }
  24656. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24657. /* in attribute value */
  24658. for {
  24659. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24660. return -int32(1)
  24661. }
  24662. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24663. v26 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  24664. } else {
  24665. v26 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24666. }
  24667. t1 = v26
  24668. if t1 == open {
  24669. break
  24670. }
  24671. switch t1 {
  24672. case int32(_BT_LEAD2):
  24673. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(2) {
  24674. return -int32(2)
  24675. }
  24676. if 0 != 0 {
  24677. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24678. return m_XML_TOK_INVALID
  24679. }
  24680. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24681. case int32(_BT_LEAD3):
  24682. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(3) {
  24683. return -int32(2)
  24684. }
  24685. if 0 != 0 {
  24686. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24687. return m_XML_TOK_INVALID
  24688. }
  24689. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  24690. case int32(_BT_LEAD4):
  24691. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(4) {
  24692. return -int32(2)
  24693. }
  24694. if 0 != 0 {
  24695. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24696. return m_XML_TOK_INVALID
  24697. }
  24698. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  24699. case int32(_BT_NONXML):
  24700. fallthrough
  24701. case int32(_BT_MALFORM):
  24702. fallthrough
  24703. case int32(_BT_TRAIL):
  24704. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24705. return m_XML_TOK_INVALID
  24706. case int32(_BT_AMP):
  24707. tok = _big2_scanRef(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr(2), end, bp)
  24708. if tok <= 0 {
  24709. if tok == m_XML_TOK_INVALID {
  24710. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24711. }
  24712. return tok
  24713. }
  24714. case int32(_BT_LT):
  24715. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24716. return m_XML_TOK_INVALID
  24717. default:
  24718. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24719. break
  24720. }
  24721. goto _25
  24722. _25:
  24723. }
  24724. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24725. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24726. return -int32(1)
  24727. }
  24728. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24729. v27 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  24730. } else {
  24731. v27 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24732. }
  24733. switch v27 {
  24734. case int32(_BT_S):
  24735. fallthrough
  24736. case int32(_BT_CR):
  24737. fallthrough
  24738. case int32(_BT_LF):
  24739. case int32(_BT_SOL):
  24740. goto sol
  24741. case int32(_BT_GT):
  24742. goto gt
  24743. default:
  24744. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24745. return m_XML_TOK_INVALID
  24746. }
  24747. /* ptr points to closing quote */
  24748. _30:
  24749. ;
  24750. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24751. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24752. return -int32(1)
  24753. }
  24754. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24755. v31 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  24756. } else {
  24757. v31 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24758. }
  24759. switch v31 {
  24760. case int32(_BT_NONASCII):
  24761. goto _32
  24762. case int32(_BT_HEX):
  24763. goto _33
  24764. case int32(_BT_NMSTRT):
  24765. goto _34
  24766. case int32(_BT_LEAD2):
  24767. goto _35
  24768. case int32(_BT_LEAD3):
  24769. goto _36
  24770. case int32(_BT_LEAD4):
  24771. goto _37
  24772. case int32(_BT_LF):
  24773. goto _38
  24774. case int32(_BT_CR):
  24775. goto _39
  24776. case int32(_BT_S):
  24777. goto _40
  24778. case int32(_BT_GT):
  24779. goto _41
  24780. case int32(_BT_SOL):
  24781. goto _42
  24782. default:
  24783. goto _43
  24784. }
  24785. goto _44
  24786. _32:
  24787. ;
  24788. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  24789. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24790. return m_XML_TOK_INVALID
  24791. } /* fall through */
  24792. _34:
  24793. ;
  24794. _33:
  24795. ;
  24796. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24797. goto _44
  24798. _35:
  24799. ;
  24800. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(2) {
  24801. return -int32(2)
  24802. }
  24803. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24804. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24805. return m_XML_TOK_INVALID
  24806. }
  24807. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24808. goto _44
  24809. _36:
  24810. ;
  24811. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(3) {
  24812. return -int32(2)
  24813. }
  24814. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24815. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24816. return m_XML_TOK_INVALID
  24817. }
  24818. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  24819. goto _44
  24820. _37:
  24821. ;
  24822. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(4) {
  24823. return -int32(2)
  24824. }
  24825. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24826. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24827. return m_XML_TOK_INVALID
  24828. }
  24829. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  24830. goto _44
  24831. _40:
  24832. ;
  24833. _39:
  24834. ;
  24835. _38:
  24836. ;
  24837. goto _29
  24838. _41:
  24839. ;
  24840. goto gt
  24841. gt:
  24842. ;
  24843. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  24844. return int32(m_XML_TOK_START_TAG_WITH_ATTS)
  24845. _42:
  24846. ;
  24847. goto sol
  24848. sol:
  24849. ;
  24850. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24851. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24852. return -int32(1)
  24853. }
  24854. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == int32(m_ASCII_GT1)) {
  24855. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24856. return m_XML_TOK_INVALID
  24857. }
  24858. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  24859. return int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS)
  24860. _43:
  24861. ;
  24862. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24863. return m_XML_TOK_INVALID
  24864. _44:
  24865. ;
  24866. goto _28
  24867. goto _29
  24868. _29:
  24869. ;
  24870. goto _30
  24871. goto _28
  24872. _28:
  24873. ;
  24874. goto _17
  24875. _16:
  24876. ;
  24877. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24878. return m_XML_TOK_INVALID
  24879. _17:
  24880. }
  24881. return -int32(1)
  24882. }
  24883. /* ptr points to character following "<" */
  24884. func _big2_scanLt(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24885. var hadColon, v1, v2, v21, v22, v3 int32
  24886. _, _, _, _, _, _ = hadColon, v1, v2, v21, v22, v3
  24887. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24888. return -int32(1)
  24889. }
  24890. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24891. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24892. } else {
  24893. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24894. }
  24895. switch v1 {
  24896. case int32(_BT_NONASCII):
  24897. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  24898. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24899. return m_XML_TOK_INVALID
  24900. } /* fall through */
  24901. fallthrough
  24902. case int32(_BT_NMSTRT):
  24903. fallthrough
  24904. case int32(_BT_HEX):
  24905. ptr += uintptr(2)
  24906. case int32(_BT_LEAD2):
  24907. if int32(end)-int32(ptr) < int32(2) {
  24908. return -int32(2)
  24909. }
  24910. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24911. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24912. return m_XML_TOK_INVALID
  24913. }
  24914. ptr += uintptr(2)
  24915. case int32(_BT_LEAD3):
  24916. if int32(end)-int32(ptr) < int32(3) {
  24917. return -int32(2)
  24918. }
  24919. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24920. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24921. return m_XML_TOK_INVALID
  24922. }
  24923. ptr += uintptr(3)
  24924. case int32(_BT_LEAD4):
  24925. if int32(end)-int32(ptr) < int32(4) {
  24926. return -int32(2)
  24927. }
  24928. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24929. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24930. return m_XML_TOK_INVALID
  24931. }
  24932. ptr += uintptr(4)
  24933. case int32(_BT_EXCL):
  24934. ptr += uintptr(2)
  24935. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24936. return -int32(1)
  24937. }
  24938. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24939. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24940. } else {
  24941. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24942. }
  24943. switch v2 {
  24944. case int32(_BT_MINUS):
  24945. return _big2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24946. case int32(_BT_LSQB):
  24947. return _big2_scanCdataSection(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24948. }
  24949. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24950. return m_XML_TOK_INVALID
  24951. case int32(_BT_QUEST):
  24952. return _big2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24953. case int32(_BT_SOL):
  24954. return _big2_scanEndTag(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24955. default:
  24956. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24957. return m_XML_TOK_INVALID
  24958. }
  24959. hadColon = 0
  24960. /* we have a start-tag */
  24961. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  24962. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24963. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24964. } else {
  24965. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24966. }
  24967. switch v3 {
  24968. case int32(_BT_NONASCII):
  24969. goto _4
  24970. case int32(_BT_MINUS):
  24971. goto _5
  24972. case int32(_BT_NAME):
  24973. goto _6
  24974. case int32(_BT_DIGIT):
  24975. goto _7
  24976. case int32(_BT_HEX):
  24977. goto _8
  24978. case int32(_BT_NMSTRT):
  24979. goto _9
  24980. case int32(_BT_LEAD2):
  24981. goto _10
  24982. case int32(_BT_LEAD3):
  24983. goto _11
  24984. case int32(_BT_LEAD4):
  24985. goto _12
  24986. case int32(_BT_COLON):
  24987. goto _13
  24988. case int32(_BT_LF):
  24989. goto _14
  24990. case int32(_BT_CR):
  24991. goto _15
  24992. case int32(_BT_S):
  24993. goto _16
  24994. case int32(_BT_GT):
  24995. goto _17
  24996. case int32(_BT_SOL):
  24997. goto _18
  24998. default:
  24999. goto _19
  25000. }
  25001. goto _20
  25002. _4:
  25003. ;
  25004. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  25005. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25006. return m_XML_TOK_INVALID
  25007. } /* fall through */
  25008. _9:
  25009. ;
  25010. _8:
  25011. ;
  25012. _7:
  25013. ;
  25014. _6:
  25015. ;
  25016. _5:
  25017. ;
  25018. ptr += uintptr(2)
  25019. goto _20
  25020. _10:
  25021. ;
  25022. if int32(end)-int32(ptr) < int32(2) {
  25023. return -int32(2)
  25024. }
  25025. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25026. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25027. return m_XML_TOK_INVALID
  25028. }
  25029. ptr += uintptr(2)
  25030. goto _20
  25031. _11:
  25032. ;
  25033. if int32(end)-int32(ptr) < int32(3) {
  25034. return -int32(2)
  25035. }
  25036. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25037. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25038. return m_XML_TOK_INVALID
  25039. }
  25040. ptr += uintptr(3)
  25041. goto _20
  25042. _12:
  25043. ;
  25044. if int32(end)-int32(ptr) < int32(4) {
  25045. return -int32(2)
  25046. }
  25047. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25048. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25049. return m_XML_TOK_INVALID
  25050. }
  25051. ptr += uintptr(4)
  25052. goto _20
  25053. _13:
  25054. ;
  25055. if hadColon != 0 {
  25056. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25057. return m_XML_TOK_INVALID
  25058. }
  25059. hadColon = int32(1)
  25060. ptr += uintptr(2)
  25061. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25062. return -int32(1)
  25063. }
  25064. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25065. v21 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25066. } else {
  25067. v21 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25068. }
  25069. switch v21 {
  25070. case int32(_BT_NONASCII):
  25071. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  25072. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25073. return m_XML_TOK_INVALID
  25074. } /* fall through */
  25075. fallthrough
  25076. case int32(_BT_NMSTRT):
  25077. fallthrough
  25078. case int32(_BT_HEX):
  25079. ptr += uintptr(2)
  25080. case int32(_BT_LEAD2):
  25081. if int32(end)-int32(ptr) < int32(2) {
  25082. return -int32(2)
  25083. }
  25084. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25085. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25086. return m_XML_TOK_INVALID
  25087. }
  25088. ptr += uintptr(2)
  25089. case int32(_BT_LEAD3):
  25090. if int32(end)-int32(ptr) < int32(3) {
  25091. return -int32(2)
  25092. }
  25093. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25094. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25095. return m_XML_TOK_INVALID
  25096. }
  25097. ptr += uintptr(3)
  25098. case int32(_BT_LEAD4):
  25099. if int32(end)-int32(ptr) < int32(4) {
  25100. return -int32(2)
  25101. }
  25102. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25103. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25104. return m_XML_TOK_INVALID
  25105. }
  25106. ptr += uintptr(4)
  25107. default:
  25108. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25109. return m_XML_TOK_INVALID
  25110. }
  25111. goto _20
  25112. _16:
  25113. ;
  25114. _15:
  25115. ;
  25116. _14:
  25117. ;
  25118. ptr += uintptr(2)
  25119. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  25120. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25121. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25122. } else {
  25123. v22 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25124. }
  25125. switch v22 {
  25126. case int32(_BT_NONASCII):
  25127. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  25128. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25129. return m_XML_TOK_INVALID
  25130. } /* fall through */
  25131. fallthrough
  25132. case int32(_BT_NMSTRT):
  25133. fallthrough
  25134. case int32(_BT_HEX):
  25135. ptr += uintptr(2)
  25136. case int32(_BT_LEAD2):
  25137. if int32(end)-int32(ptr) < int32(2) {
  25138. return -int32(2)
  25139. }
  25140. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25141. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25142. return m_XML_TOK_INVALID
  25143. }
  25144. ptr += uintptr(2)
  25145. case int32(_BT_LEAD3):
  25146. if int32(end)-int32(ptr) < int32(3) {
  25147. return -int32(2)
  25148. }
  25149. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25150. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25151. return m_XML_TOK_INVALID
  25152. }
  25153. ptr += uintptr(3)
  25154. case int32(_BT_LEAD4):
  25155. if int32(end)-int32(ptr) < int32(4) {
  25156. return -int32(2)
  25157. }
  25158. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25159. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25160. return m_XML_TOK_INVALID
  25161. }
  25162. ptr += uintptr(4)
  25163. case int32(_BT_GT):
  25164. goto gt
  25165. case int32(_BT_SOL):
  25166. goto sol
  25167. case int32(_BT_S):
  25168. fallthrough
  25169. case int32(_BT_CR):
  25170. fallthrough
  25171. case int32(_BT_LF):
  25172. ptr += uintptr(2)
  25173. continue
  25174. default:
  25175. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25176. return m_XML_TOK_INVALID
  25177. }
  25178. return _big2_scanAtts(tls, enc, ptr, end, nextTokPtr)
  25179. }
  25180. return -int32(1)
  25181. _17:
  25182. ;
  25183. goto gt
  25184. gt:
  25185. ;
  25186. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25187. return int32(m_XML_TOK_START_TAG_NO_ATTS)
  25188. _18:
  25189. ;
  25190. goto sol
  25191. sol:
  25192. ;
  25193. ptr += uintptr(2)
  25194. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25195. return -int32(1)
  25196. }
  25197. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  25198. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25199. return m_XML_TOK_INVALID
  25200. }
  25201. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25202. return int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS)
  25203. _19:
  25204. ;
  25205. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25206. return m_XML_TOK_INVALID
  25207. _20:
  25208. }
  25209. return -int32(1)
  25210. }
  25211. func _big2_contentTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25212. var n Tsize_t
  25213. var v1, v2, v3 int32
  25214. _, _, _, _ = n, v1, v2, v3
  25215. if ptr >= end {
  25216. return -int32(4)
  25217. }
  25218. if int32(2) > int32(1) {
  25219. n = libc.Uint32FromInt32(int32(end) - int32(ptr))
  25220. if n&libc.Uint32FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  25221. n &= libc.Uint32FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  25222. if n == uint32(0) {
  25223. return -int32(1)
  25224. }
  25225. end = ptr + uintptr(n)
  25226. }
  25227. }
  25228. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25229. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25230. } else {
  25231. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25232. }
  25233. switch v1 {
  25234. case int32(_BT_LT):
  25235. return _big2_scanLt(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25236. case int32(_BT_AMP):
  25237. return _big2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25238. case int32(_BT_CR):
  25239. ptr += uintptr(2)
  25240. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25241. return -int32(3)
  25242. }
  25243. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25244. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25245. } else {
  25246. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25247. }
  25248. if v2 == int32(_BT_LF) {
  25249. ptr += uintptr(2)
  25250. }
  25251. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25252. return int32(m_XML_TOK_DATA_NEWLINE)
  25253. case int32(_BT_LF):
  25254. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25255. return int32(m_XML_TOK_DATA_NEWLINE)
  25256. case int32(_BT_RSQB):
  25257. ptr += uintptr(2)
  25258. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25259. return -int32(5)
  25260. }
  25261. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1)) {
  25262. break
  25263. }
  25264. ptr += uintptr(2)
  25265. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25266. return -int32(5)
  25267. }
  25268. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  25269. ptr -= uintptr(2)
  25270. break
  25271. }
  25272. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25273. return m_XML_TOK_INVALID
  25274. case int32(_BT_LEAD2):
  25275. if int32(end)-int32(ptr) < int32(2) {
  25276. return -int32(2)
  25277. }
  25278. if 0 != 0 {
  25279. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25280. return m_XML_TOK_INVALID
  25281. }
  25282. ptr += uintptr(2)
  25283. case int32(_BT_LEAD3):
  25284. if int32(end)-int32(ptr) < int32(3) {
  25285. return -int32(2)
  25286. }
  25287. if 0 != 0 {
  25288. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25289. return m_XML_TOK_INVALID
  25290. }
  25291. ptr += uintptr(3)
  25292. case int32(_BT_LEAD4):
  25293. if int32(end)-int32(ptr) < int32(4) {
  25294. return -int32(2)
  25295. }
  25296. if 0 != 0 {
  25297. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25298. return m_XML_TOK_INVALID
  25299. }
  25300. ptr += uintptr(4)
  25301. case int32(_BT_NONXML):
  25302. fallthrough
  25303. case int32(_BT_MALFORM):
  25304. fallthrough
  25305. case int32(_BT_TRAIL):
  25306. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25307. return m_XML_TOK_INVALID
  25308. default:
  25309. ptr += uintptr(2)
  25310. break
  25311. }
  25312. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  25313. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25314. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25315. } else {
  25316. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25317. }
  25318. switch v3 {
  25319. case int32(_BT_LEAD2):
  25320. if int32(end)-int32(ptr) < int32(2) || libc.Bool(0 != 0) {
  25321. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25322. return int32(m_XML_TOK_DATA_CHARS)
  25323. }
  25324. ptr += uintptr(2)
  25325. case int32(_BT_LEAD3):
  25326. if int32(end)-int32(ptr) < int32(3) || libc.Bool(0 != 0) {
  25327. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25328. return int32(m_XML_TOK_DATA_CHARS)
  25329. }
  25330. ptr += uintptr(3)
  25331. case int32(_BT_LEAD4):
  25332. if int32(end)-int32(ptr) < int32(4) || libc.Bool(0 != 0) {
  25333. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25334. return int32(m_XML_TOK_DATA_CHARS)
  25335. }
  25336. ptr += uintptr(4)
  25337. case int32(_BT_RSQB):
  25338. if int32(end)-int32(ptr) >= libc.Int32FromInt32(2)*libc.Int32FromInt32(2) {
  25339. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == int32(m_ASCII_RSQB1)) {
  25340. ptr += uintptr(2)
  25341. break
  25342. }
  25343. if int32(end)-int32(ptr) >= libc.Int32FromInt32(3)*libc.Int32FromInt32(2) {
  25344. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) + 1))) == int32(m_ASCII_GT1)) {
  25345. ptr += uintptr(2)
  25346. break
  25347. }
  25348. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  25349. return m_XML_TOK_INVALID
  25350. }
  25351. }
  25352. /* fall through */
  25353. fallthrough
  25354. case int32(_BT_AMP):
  25355. fallthrough
  25356. case int32(_BT_LT):
  25357. fallthrough
  25358. case int32(_BT_NONXML):
  25359. fallthrough
  25360. case int32(_BT_MALFORM):
  25361. fallthrough
  25362. case int32(_BT_TRAIL):
  25363. fallthrough
  25364. case int32(_BT_CR):
  25365. fallthrough
  25366. case int32(_BT_LF):
  25367. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25368. return int32(m_XML_TOK_DATA_CHARS)
  25369. default:
  25370. ptr += uintptr(2)
  25371. break
  25372. }
  25373. }
  25374. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25375. return int32(m_XML_TOK_DATA_CHARS)
  25376. }
  25377. /* ptr points to character following "%" */
  25378. func _big2_scanPercent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25379. var v1, v2 int32
  25380. _, _ = v1, v2
  25381. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25382. return -int32(1)
  25383. }
  25384. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25385. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25386. } else {
  25387. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25388. }
  25389. switch v1 {
  25390. case int32(_BT_NONASCII):
  25391. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  25392. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25393. return m_XML_TOK_INVALID
  25394. } /* fall through */
  25395. fallthrough
  25396. case int32(_BT_NMSTRT):
  25397. fallthrough
  25398. case int32(_BT_HEX):
  25399. ptr += uintptr(2)
  25400. case int32(_BT_LEAD2):
  25401. if int32(end)-int32(ptr) < int32(2) {
  25402. return -int32(2)
  25403. }
  25404. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25405. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25406. return m_XML_TOK_INVALID
  25407. }
  25408. ptr += uintptr(2)
  25409. case int32(_BT_LEAD3):
  25410. if int32(end)-int32(ptr) < int32(3) {
  25411. return -int32(2)
  25412. }
  25413. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25414. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25415. return m_XML_TOK_INVALID
  25416. }
  25417. ptr += uintptr(3)
  25418. case int32(_BT_LEAD4):
  25419. if int32(end)-int32(ptr) < int32(4) {
  25420. return -int32(2)
  25421. }
  25422. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25423. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25424. return m_XML_TOK_INVALID
  25425. }
  25426. ptr += uintptr(4)
  25427. case int32(_BT_S):
  25428. fallthrough
  25429. case int32(_BT_LF):
  25430. fallthrough
  25431. case int32(_BT_CR):
  25432. fallthrough
  25433. case int32(_BT_PERCNT):
  25434. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25435. return int32(m_XML_TOK_PERCENT)
  25436. default:
  25437. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25438. return m_XML_TOK_INVALID
  25439. }
  25440. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  25441. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25442. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25443. } else {
  25444. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25445. }
  25446. switch v2 {
  25447. case int32(_BT_NONASCII):
  25448. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  25449. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25450. return m_XML_TOK_INVALID
  25451. } /* fall through */
  25452. fallthrough
  25453. case int32(_BT_NMSTRT):
  25454. fallthrough
  25455. case int32(_BT_HEX):
  25456. fallthrough
  25457. case int32(_BT_DIGIT):
  25458. fallthrough
  25459. case int32(_BT_NAME):
  25460. fallthrough
  25461. case int32(_BT_MINUS):
  25462. ptr += uintptr(2)
  25463. case int32(_BT_LEAD2):
  25464. if int32(end)-int32(ptr) < int32(2) {
  25465. return -int32(2)
  25466. }
  25467. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25468. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25469. return m_XML_TOK_INVALID
  25470. }
  25471. ptr += uintptr(2)
  25472. case int32(_BT_LEAD3):
  25473. if int32(end)-int32(ptr) < int32(3) {
  25474. return -int32(2)
  25475. }
  25476. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25477. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25478. return m_XML_TOK_INVALID
  25479. }
  25480. ptr += uintptr(3)
  25481. case int32(_BT_LEAD4):
  25482. if int32(end)-int32(ptr) < int32(4) {
  25483. return -int32(2)
  25484. }
  25485. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25486. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25487. return m_XML_TOK_INVALID
  25488. }
  25489. ptr += uintptr(4)
  25490. case int32(_BT_SEMI):
  25491. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25492. return int32(m_XML_TOK_PARAM_ENTITY_REF)
  25493. default:
  25494. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25495. return m_XML_TOK_INVALID
  25496. }
  25497. }
  25498. return -int32(1)
  25499. }
  25500. func _big2_scanPoundName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25501. var v1, v2 int32
  25502. _, _ = v1, v2
  25503. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25504. return -int32(1)
  25505. }
  25506. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25507. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25508. } else {
  25509. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25510. }
  25511. switch v1 {
  25512. case int32(_BT_NONASCII):
  25513. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  25514. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25515. return m_XML_TOK_INVALID
  25516. } /* fall through */
  25517. fallthrough
  25518. case int32(_BT_NMSTRT):
  25519. fallthrough
  25520. case int32(_BT_HEX):
  25521. ptr += uintptr(2)
  25522. case int32(_BT_LEAD2):
  25523. if int32(end)-int32(ptr) < int32(2) {
  25524. return -int32(2)
  25525. }
  25526. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25527. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25528. return m_XML_TOK_INVALID
  25529. }
  25530. ptr += uintptr(2)
  25531. case int32(_BT_LEAD3):
  25532. if int32(end)-int32(ptr) < int32(3) {
  25533. return -int32(2)
  25534. }
  25535. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25536. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25537. return m_XML_TOK_INVALID
  25538. }
  25539. ptr += uintptr(3)
  25540. case int32(_BT_LEAD4):
  25541. if int32(end)-int32(ptr) < int32(4) {
  25542. return -int32(2)
  25543. }
  25544. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25545. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25546. return m_XML_TOK_INVALID
  25547. }
  25548. ptr += uintptr(4)
  25549. default:
  25550. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25551. return m_XML_TOK_INVALID
  25552. }
  25553. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  25554. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25555. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25556. } else {
  25557. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25558. }
  25559. switch v2 {
  25560. case int32(_BT_NONASCII):
  25561. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  25562. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25563. return m_XML_TOK_INVALID
  25564. } /* fall through */
  25565. fallthrough
  25566. case int32(_BT_NMSTRT):
  25567. fallthrough
  25568. case int32(_BT_HEX):
  25569. fallthrough
  25570. case int32(_BT_DIGIT):
  25571. fallthrough
  25572. case int32(_BT_NAME):
  25573. fallthrough
  25574. case int32(_BT_MINUS):
  25575. ptr += uintptr(2)
  25576. case int32(_BT_LEAD2):
  25577. if int32(end)-int32(ptr) < int32(2) {
  25578. return -int32(2)
  25579. }
  25580. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25581. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25582. return m_XML_TOK_INVALID
  25583. }
  25584. ptr += uintptr(2)
  25585. case int32(_BT_LEAD3):
  25586. if int32(end)-int32(ptr) < int32(3) {
  25587. return -int32(2)
  25588. }
  25589. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25590. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25591. return m_XML_TOK_INVALID
  25592. }
  25593. ptr += uintptr(3)
  25594. case int32(_BT_LEAD4):
  25595. if int32(end)-int32(ptr) < int32(4) {
  25596. return -int32(2)
  25597. }
  25598. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25599. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25600. return m_XML_TOK_INVALID
  25601. }
  25602. ptr += uintptr(4)
  25603. case int32(_BT_CR):
  25604. fallthrough
  25605. case int32(_BT_LF):
  25606. fallthrough
  25607. case int32(_BT_S):
  25608. fallthrough
  25609. case int32(_BT_RPAR):
  25610. fallthrough
  25611. case int32(_BT_GT):
  25612. fallthrough
  25613. case int32(_BT_PERCNT):
  25614. fallthrough
  25615. case int32(_BT_VERBAR):
  25616. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25617. return int32(m_XML_TOK_POUND_NAME)
  25618. default:
  25619. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25620. return m_XML_TOK_INVALID
  25621. }
  25622. }
  25623. return -int32(m_XML_TOK_POUND_NAME)
  25624. }
  25625. func _big2_scanLit(tls *libc.TLS, open int32, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25626. var t, v1, v2 int32
  25627. _, _, _ = t, v1, v2
  25628. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  25629. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25630. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25631. } else {
  25632. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25633. }
  25634. t = v1
  25635. switch t {
  25636. case int32(_BT_LEAD2):
  25637. if int32(end)-int32(ptr) < int32(2) {
  25638. return -int32(2)
  25639. }
  25640. if 0 != 0 {
  25641. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25642. return m_XML_TOK_INVALID
  25643. }
  25644. ptr += uintptr(2)
  25645. case int32(_BT_LEAD3):
  25646. if int32(end)-int32(ptr) < int32(3) {
  25647. return -int32(2)
  25648. }
  25649. if 0 != 0 {
  25650. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25651. return m_XML_TOK_INVALID
  25652. }
  25653. ptr += uintptr(3)
  25654. case int32(_BT_LEAD4):
  25655. if int32(end)-int32(ptr) < int32(4) {
  25656. return -int32(2)
  25657. }
  25658. if 0 != 0 {
  25659. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25660. return m_XML_TOK_INVALID
  25661. }
  25662. ptr += uintptr(4)
  25663. case int32(_BT_NONXML):
  25664. fallthrough
  25665. case int32(_BT_MALFORM):
  25666. fallthrough
  25667. case int32(_BT_TRAIL):
  25668. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25669. return m_XML_TOK_INVALID
  25670. case int32(_BT_QUOT):
  25671. fallthrough
  25672. case int32(_BT_APOS):
  25673. ptr += uintptr(2)
  25674. if t != open {
  25675. break
  25676. }
  25677. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25678. return -int32(m_XML_TOK_LITERAL)
  25679. }
  25680. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25681. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25682. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25683. } else {
  25684. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25685. }
  25686. switch v2 {
  25687. case int32(_BT_S):
  25688. fallthrough
  25689. case int32(_BT_CR):
  25690. fallthrough
  25691. case int32(_BT_LF):
  25692. fallthrough
  25693. case int32(_BT_GT):
  25694. fallthrough
  25695. case int32(_BT_PERCNT):
  25696. fallthrough
  25697. case int32(_BT_LSQB):
  25698. return int32(m_XML_TOK_LITERAL)
  25699. default:
  25700. return m_XML_TOK_INVALID
  25701. }
  25702. fallthrough
  25703. default:
  25704. ptr += uintptr(2)
  25705. break
  25706. }
  25707. }
  25708. return -int32(1)
  25709. }
  25710. func _big2_prologTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25711. var n Tsize_t
  25712. var tok, v1, v29, v33, v34, v35, v36 int32
  25713. _, _, _, _, _, _, _, _ = n, tok, v1, v29, v33, v34, v35, v36
  25714. if ptr >= end {
  25715. return -int32(4)
  25716. }
  25717. if int32(2) > int32(1) {
  25718. n = libc.Uint32FromInt32(int32(end) - int32(ptr))
  25719. if n&libc.Uint32FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  25720. n &= libc.Uint32FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  25721. if n == uint32(0) {
  25722. return -int32(1)
  25723. }
  25724. end = ptr + uintptr(n)
  25725. }
  25726. }
  25727. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25728. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25729. } else {
  25730. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25731. }
  25732. switch v1 {
  25733. case int32(_BT_QUOT):
  25734. goto _2
  25735. case int32(_BT_APOS):
  25736. goto _3
  25737. case int32(_BT_LT):
  25738. goto _4
  25739. case int32(_BT_CR):
  25740. goto _5
  25741. case int32(_BT_LF):
  25742. goto _6
  25743. case int32(_BT_S):
  25744. goto _7
  25745. case int32(_BT_PERCNT):
  25746. goto _8
  25747. case int32(_BT_COMMA):
  25748. goto _9
  25749. case int32(_BT_LSQB):
  25750. goto _10
  25751. case int32(_BT_RSQB):
  25752. goto _11
  25753. case int32(_BT_LPAR):
  25754. goto _12
  25755. case int32(_BT_RPAR):
  25756. goto _13
  25757. case int32(_BT_VERBAR):
  25758. goto _14
  25759. case int32(_BT_GT):
  25760. goto _15
  25761. case int32(_BT_NUM):
  25762. goto _16
  25763. case int32(_BT_LEAD2):
  25764. goto _17
  25765. case int32(_BT_LEAD3):
  25766. goto _18
  25767. case int32(_BT_LEAD4):
  25768. goto _19
  25769. case int32(_BT_HEX):
  25770. goto _20
  25771. case int32(_BT_NMSTRT):
  25772. goto _21
  25773. case int32(_BT_COLON):
  25774. goto _22
  25775. case int32(_BT_MINUS):
  25776. goto _23
  25777. case int32(_BT_NAME):
  25778. goto _24
  25779. case int32(_BT_DIGIT):
  25780. goto _25
  25781. case int32(_BT_NONASCII):
  25782. goto _26
  25783. default:
  25784. goto _27
  25785. }
  25786. goto _28
  25787. _2:
  25788. ;
  25789. return _big2_scanLit(tls, int32(_BT_QUOT), enc, ptr+uintptr(2), end, nextTokPtr)
  25790. _3:
  25791. ;
  25792. return _big2_scanLit(tls, int32(_BT_APOS), enc, ptr+uintptr(2), end, nextTokPtr)
  25793. _4:
  25794. ;
  25795. ptr += uintptr(2)
  25796. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25797. return -int32(1)
  25798. }
  25799. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25800. v29 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25801. } else {
  25802. v29 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25803. }
  25804. switch v29 {
  25805. case int32(_BT_EXCL):
  25806. return _big2_scanDecl(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25807. case int32(_BT_QUEST):
  25808. return _big2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25809. case int32(_BT_NMSTRT):
  25810. fallthrough
  25811. case int32(_BT_HEX):
  25812. fallthrough
  25813. case int32(_BT_NONASCII):
  25814. fallthrough
  25815. case int32(_BT_LEAD2):
  25816. fallthrough
  25817. case int32(_BT_LEAD3):
  25818. fallthrough
  25819. case int32(_BT_LEAD4):
  25820. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr - uintptr(2)
  25821. return int32(m_XML_TOK_INSTANCE_START)
  25822. }
  25823. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25824. return m_XML_TOK_INVALID
  25825. _5:
  25826. ;
  25827. if ptr+uintptr(2) == end {
  25828. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = end
  25829. /* indicate that this might be part of a CR/LF pair */
  25830. return -int32(m_XML_TOK_PROLOG_S)
  25831. }
  25832. /* fall through */
  25833. _7:
  25834. ;
  25835. _6:
  25836. ;
  25837. _32:
  25838. ;
  25839. ptr += uintptr(2)
  25840. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25841. goto _30
  25842. }
  25843. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25844. v33 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25845. } else {
  25846. v33 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25847. }
  25848. switch v33 {
  25849. case int32(_BT_S):
  25850. fallthrough
  25851. case int32(_BT_LF):
  25852. case int32(_BT_CR):
  25853. /* don't split CR/LF pair */
  25854. if ptr+uintptr(2) != end {
  25855. break
  25856. }
  25857. /* fall through */
  25858. fallthrough
  25859. default:
  25860. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25861. return int32(m_XML_TOK_PROLOG_S)
  25862. }
  25863. goto _31
  25864. _31:
  25865. ;
  25866. goto _32
  25867. goto _30
  25868. _30:
  25869. ;
  25870. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25871. return int32(m_XML_TOK_PROLOG_S)
  25872. _8:
  25873. ;
  25874. return _big2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25875. _9:
  25876. ;
  25877. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25878. return int32(m_XML_TOK_COMMA)
  25879. _10:
  25880. ;
  25881. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25882. return int32(m_XML_TOK_OPEN_BRACKET)
  25883. _11:
  25884. ;
  25885. ptr += uintptr(2)
  25886. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25887. return -int32(m_XML_TOK_CLOSE_BRACKET)
  25888. }
  25889. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1) {
  25890. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) {
  25891. return -int32(1)
  25892. }
  25893. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == int32(m_ASCII_GT1) {
  25894. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  25895. return int32(m_XML_TOK_COND_SECT_CLOSE)
  25896. }
  25897. }
  25898. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25899. return int32(m_XML_TOK_CLOSE_BRACKET)
  25900. _12:
  25901. ;
  25902. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25903. return int32(m_XML_TOK_OPEN_PAREN)
  25904. _13:
  25905. ;
  25906. ptr += uintptr(2)
  25907. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25908. return -int32(m_XML_TOK_CLOSE_PAREN)
  25909. }
  25910. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25911. v34 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25912. } else {
  25913. v34 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25914. }
  25915. switch v34 {
  25916. case int32(_BT_AST):
  25917. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25918. return int32(m_XML_TOK_CLOSE_PAREN_ASTERISK)
  25919. case int32(_BT_QUEST):
  25920. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25921. return int32(m_XML_TOK_CLOSE_PAREN_QUESTION)
  25922. case int32(_BT_PLUS):
  25923. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25924. return int32(m_XML_TOK_CLOSE_PAREN_PLUS)
  25925. case int32(_BT_CR):
  25926. fallthrough
  25927. case int32(_BT_LF):
  25928. fallthrough
  25929. case int32(_BT_S):
  25930. fallthrough
  25931. case int32(_BT_GT):
  25932. fallthrough
  25933. case int32(_BT_COMMA):
  25934. fallthrough
  25935. case int32(_BT_VERBAR):
  25936. fallthrough
  25937. case int32(_BT_RPAR):
  25938. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25939. return int32(m_XML_TOK_CLOSE_PAREN)
  25940. }
  25941. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25942. return m_XML_TOK_INVALID
  25943. _14:
  25944. ;
  25945. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25946. return int32(m_XML_TOK_OR)
  25947. _15:
  25948. ;
  25949. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25950. return int32(m_XML_TOK_DECL_CLOSE)
  25951. _16:
  25952. ;
  25953. return _big2_scanPoundName(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25954. _17:
  25955. ;
  25956. if int32(end)-int32(ptr) < int32(2) {
  25957. return -int32(2)
  25958. }
  25959. if 0 != 0 {
  25960. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25961. return m_XML_TOK_INVALID
  25962. }
  25963. if 0 != 0 {
  25964. ptr += uintptr(2)
  25965. tok = int32(m_XML_TOK_NAME)
  25966. goto _28
  25967. }
  25968. if 0 != 0 {
  25969. ptr += uintptr(2)
  25970. tok = int32(m_XML_TOK_NMTOKEN)
  25971. goto _28
  25972. }
  25973. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25974. return m_XML_TOK_INVALID
  25975. _18:
  25976. ;
  25977. if int32(end)-int32(ptr) < int32(3) {
  25978. return -int32(2)
  25979. }
  25980. if 0 != 0 {
  25981. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25982. return m_XML_TOK_INVALID
  25983. }
  25984. if 0 != 0 {
  25985. ptr += uintptr(3)
  25986. tok = int32(m_XML_TOK_NAME)
  25987. goto _28
  25988. }
  25989. if 0 != 0 {
  25990. ptr += uintptr(3)
  25991. tok = int32(m_XML_TOK_NMTOKEN)
  25992. goto _28
  25993. }
  25994. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25995. return m_XML_TOK_INVALID
  25996. _19:
  25997. ;
  25998. if int32(end)-int32(ptr) < int32(4) {
  25999. return -int32(2)
  26000. }
  26001. if 0 != 0 {
  26002. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26003. return m_XML_TOK_INVALID
  26004. }
  26005. if 0 != 0 {
  26006. ptr += uintptr(4)
  26007. tok = int32(m_XML_TOK_NAME)
  26008. goto _28
  26009. }
  26010. if 0 != 0 {
  26011. ptr += uintptr(4)
  26012. tok = int32(m_XML_TOK_NMTOKEN)
  26013. goto _28
  26014. }
  26015. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26016. return m_XML_TOK_INVALID
  26017. _21:
  26018. ;
  26019. _20:
  26020. ;
  26021. tok = int32(m_XML_TOK_NAME)
  26022. ptr += uintptr(2)
  26023. goto _28
  26024. _25:
  26025. ;
  26026. _24:
  26027. ;
  26028. _23:
  26029. ;
  26030. _22:
  26031. ;
  26032. tok = int32(m_XML_TOK_NMTOKEN)
  26033. ptr += uintptr(2)
  26034. goto _28
  26035. _26:
  26036. ;
  26037. if _namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&int32(0x1F))) != 0 {
  26038. ptr += uintptr(2)
  26039. tok = int32(m_XML_TOK_NAME)
  26040. goto _28
  26041. }
  26042. if _namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&int32(0x1F))) != 0 {
  26043. ptr += uintptr(2)
  26044. tok = int32(m_XML_TOK_NMTOKEN)
  26045. goto _28
  26046. }
  26047. /* fall through */
  26048. _27:
  26049. ;
  26050. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26051. return m_XML_TOK_INVALID
  26052. _28:
  26053. ;
  26054. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  26055. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26056. v35 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26057. } else {
  26058. v35 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26059. }
  26060. switch v35 {
  26061. case int32(_BT_NONASCII):
  26062. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  26063. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26064. return m_XML_TOK_INVALID
  26065. } /* fall through */
  26066. fallthrough
  26067. case int32(_BT_NMSTRT):
  26068. fallthrough
  26069. case int32(_BT_HEX):
  26070. fallthrough
  26071. case int32(_BT_DIGIT):
  26072. fallthrough
  26073. case int32(_BT_NAME):
  26074. fallthrough
  26075. case int32(_BT_MINUS):
  26076. ptr += uintptr(2)
  26077. case int32(_BT_LEAD2):
  26078. if int32(end)-int32(ptr) < int32(2) {
  26079. return -int32(2)
  26080. }
  26081. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26082. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26083. return m_XML_TOK_INVALID
  26084. }
  26085. ptr += uintptr(2)
  26086. case int32(_BT_LEAD3):
  26087. if int32(end)-int32(ptr) < int32(3) {
  26088. return -int32(2)
  26089. }
  26090. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26091. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26092. return m_XML_TOK_INVALID
  26093. }
  26094. ptr += uintptr(3)
  26095. case int32(_BT_LEAD4):
  26096. if int32(end)-int32(ptr) < int32(4) {
  26097. return -int32(2)
  26098. }
  26099. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26100. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26101. return m_XML_TOK_INVALID
  26102. }
  26103. ptr += uintptr(4)
  26104. case int32(_BT_GT):
  26105. fallthrough
  26106. case int32(_BT_RPAR):
  26107. fallthrough
  26108. case int32(_BT_COMMA):
  26109. fallthrough
  26110. case int32(_BT_VERBAR):
  26111. fallthrough
  26112. case int32(_BT_LSQB):
  26113. fallthrough
  26114. case int32(_BT_PERCNT):
  26115. fallthrough
  26116. case int32(_BT_S):
  26117. fallthrough
  26118. case int32(_BT_CR):
  26119. fallthrough
  26120. case int32(_BT_LF):
  26121. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26122. return tok
  26123. case int32(_BT_COLON):
  26124. ptr += uintptr(2)
  26125. switch tok {
  26126. case int32(m_XML_TOK_NAME):
  26127. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26128. return -int32(1)
  26129. }
  26130. tok = int32(m_XML_TOK_PREFIXED_NAME)
  26131. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26132. v36 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26133. } else {
  26134. v36 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26135. }
  26136. switch v36 {
  26137. case int32(_BT_NONASCII):
  26138. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  26139. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26140. return m_XML_TOK_INVALID
  26141. } /* fall through */
  26142. fallthrough
  26143. case int32(_BT_NMSTRT):
  26144. fallthrough
  26145. case int32(_BT_HEX):
  26146. fallthrough
  26147. case int32(_BT_DIGIT):
  26148. fallthrough
  26149. case int32(_BT_NAME):
  26150. fallthrough
  26151. case int32(_BT_MINUS):
  26152. ptr += uintptr(2)
  26153. case int32(_BT_LEAD2):
  26154. if int32(end)-int32(ptr) < int32(2) {
  26155. return -int32(2)
  26156. }
  26157. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26158. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26159. return m_XML_TOK_INVALID
  26160. }
  26161. ptr += uintptr(2)
  26162. case int32(_BT_LEAD3):
  26163. if int32(end)-int32(ptr) < int32(3) {
  26164. return -int32(2)
  26165. }
  26166. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26167. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26168. return m_XML_TOK_INVALID
  26169. }
  26170. ptr += uintptr(3)
  26171. case int32(_BT_LEAD4):
  26172. if int32(end)-int32(ptr) < int32(4) {
  26173. return -int32(2)
  26174. }
  26175. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26176. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26177. return m_XML_TOK_INVALID
  26178. }
  26179. ptr += uintptr(4)
  26180. default:
  26181. tok = int32(m_XML_TOK_NMTOKEN)
  26182. break
  26183. }
  26184. case int32(m_XML_TOK_PREFIXED_NAME):
  26185. tok = int32(m_XML_TOK_NMTOKEN)
  26186. break
  26187. }
  26188. case int32(_BT_PLUS):
  26189. if tok == int32(m_XML_TOK_NMTOKEN) {
  26190. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26191. return m_XML_TOK_INVALID
  26192. }
  26193. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26194. return int32(m_XML_TOK_NAME_PLUS)
  26195. case int32(_BT_AST):
  26196. if tok == int32(m_XML_TOK_NMTOKEN) {
  26197. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26198. return m_XML_TOK_INVALID
  26199. }
  26200. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26201. return int32(m_XML_TOK_NAME_ASTERISK)
  26202. case int32(_BT_QUEST):
  26203. if tok == int32(m_XML_TOK_NMTOKEN) {
  26204. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26205. return m_XML_TOK_INVALID
  26206. }
  26207. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26208. return int32(m_XML_TOK_NAME_QUESTION)
  26209. default:
  26210. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26211. return m_XML_TOK_INVALID
  26212. }
  26213. }
  26214. return -tok
  26215. }
  26216. func _big2_attributeValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  26217. var start uintptr
  26218. var v1, v2 int32
  26219. _, _, _ = start, v1, v2
  26220. if ptr >= end {
  26221. return -int32(4)
  26222. } else {
  26223. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26224. /* This line cannot be executed. The incoming data has already
  26225. * been tokenized once, so incomplete characters like this have
  26226. * already been eliminated from the input. Retaining the paranoia
  26227. * check is still valuable, however.
  26228. */
  26229. return -int32(1) /* LCOV_EXCL_LINE */
  26230. }
  26231. }
  26232. start = ptr
  26233. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  26234. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26235. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26236. } else {
  26237. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26238. }
  26239. switch v1 {
  26240. case int32(_BT_LEAD2):
  26241. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  26242. case int32(_BT_LEAD3):
  26243. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  26244. case int32(_BT_LEAD4):
  26245. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  26246. case int32(_BT_AMP):
  26247. if ptr == start {
  26248. return _big2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  26249. }
  26250. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26251. return int32(m_XML_TOK_DATA_CHARS)
  26252. case int32(_BT_LT):
  26253. /* this is for inside entity references */
  26254. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26255. return m_XML_TOK_INVALID
  26256. case int32(_BT_LF):
  26257. if ptr == start {
  26258. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26259. return int32(m_XML_TOK_DATA_NEWLINE)
  26260. }
  26261. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26262. return int32(m_XML_TOK_DATA_CHARS)
  26263. case int32(_BT_CR):
  26264. if ptr == start {
  26265. ptr += uintptr(2)
  26266. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26267. return -int32(3)
  26268. }
  26269. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26270. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26271. } else {
  26272. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26273. }
  26274. if v2 == int32(_BT_LF) {
  26275. ptr += uintptr(2)
  26276. }
  26277. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26278. return int32(m_XML_TOK_DATA_NEWLINE)
  26279. }
  26280. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26281. return int32(m_XML_TOK_DATA_CHARS)
  26282. case int32(_BT_S):
  26283. if ptr == start {
  26284. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26285. return int32(m_XML_TOK_ATTRIBUTE_VALUE_S)
  26286. }
  26287. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26288. return int32(m_XML_TOK_DATA_CHARS)
  26289. default:
  26290. ptr += uintptr(2)
  26291. break
  26292. }
  26293. }
  26294. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26295. return int32(m_XML_TOK_DATA_CHARS)
  26296. }
  26297. func _big2_entityValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  26298. var start uintptr
  26299. var tok, v1, v2, v3 int32
  26300. _, _, _, _, _ = start, tok, v1, v2, v3
  26301. if ptr >= end {
  26302. return -int32(4)
  26303. } else {
  26304. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26305. /* This line cannot be executed. The incoming data has already
  26306. * been tokenized once, so incomplete characters like this have
  26307. * already been eliminated from the input. Retaining the paranoia
  26308. * check is still valuable, however.
  26309. */
  26310. return -int32(1) /* LCOV_EXCL_LINE */
  26311. }
  26312. }
  26313. start = ptr
  26314. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  26315. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26316. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26317. } else {
  26318. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26319. }
  26320. switch v1 {
  26321. case int32(_BT_LEAD2):
  26322. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  26323. case int32(_BT_LEAD3):
  26324. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  26325. case int32(_BT_LEAD4):
  26326. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  26327. case int32(_BT_AMP):
  26328. if ptr == start {
  26329. return _big2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  26330. }
  26331. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26332. return int32(m_XML_TOK_DATA_CHARS)
  26333. case int32(_BT_PERCNT):
  26334. if ptr == start {
  26335. tok = _big2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  26336. if tok == int32(m_XML_TOK_PERCENT) {
  26337. v2 = m_XML_TOK_INVALID
  26338. } else {
  26339. v2 = tok
  26340. }
  26341. return v2
  26342. }
  26343. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26344. return int32(m_XML_TOK_DATA_CHARS)
  26345. case int32(_BT_LF):
  26346. if ptr == start {
  26347. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26348. return int32(m_XML_TOK_DATA_NEWLINE)
  26349. }
  26350. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26351. return int32(m_XML_TOK_DATA_CHARS)
  26352. case int32(_BT_CR):
  26353. if ptr == start {
  26354. ptr += uintptr(2)
  26355. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26356. return -int32(3)
  26357. }
  26358. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26359. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26360. } else {
  26361. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26362. }
  26363. if v3 == int32(_BT_LF) {
  26364. ptr += uintptr(2)
  26365. }
  26366. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26367. return int32(m_XML_TOK_DATA_NEWLINE)
  26368. }
  26369. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26370. return int32(m_XML_TOK_DATA_CHARS)
  26371. default:
  26372. ptr += uintptr(2)
  26373. break
  26374. }
  26375. }
  26376. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26377. return int32(m_XML_TOK_DATA_CHARS)
  26378. }
  26379. func _big2_ignoreSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  26380. var level, v1 int32
  26381. var n Tsize_t
  26382. _, _, _ = level, n, v1
  26383. level = 0
  26384. if int32(2) > int32(1) {
  26385. n = libc.Uint32FromInt32(int32(end) - int32(ptr))
  26386. if n&libc.Uint32FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  26387. n &= libc.Uint32FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  26388. end = ptr + uintptr(n)
  26389. }
  26390. }
  26391. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  26392. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26393. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26394. } else {
  26395. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26396. }
  26397. switch v1 {
  26398. case int32(_BT_LEAD2):
  26399. if int32(end)-int32(ptr) < int32(2) {
  26400. return -int32(2)
  26401. }
  26402. if 0 != 0 {
  26403. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26404. return m_XML_TOK_INVALID
  26405. }
  26406. ptr += uintptr(2)
  26407. case int32(_BT_LEAD3):
  26408. if int32(end)-int32(ptr) < int32(3) {
  26409. return -int32(2)
  26410. }
  26411. if 0 != 0 {
  26412. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26413. return m_XML_TOK_INVALID
  26414. }
  26415. ptr += uintptr(3)
  26416. case int32(_BT_LEAD4):
  26417. if int32(end)-int32(ptr) < int32(4) {
  26418. return -int32(2)
  26419. }
  26420. if 0 != 0 {
  26421. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26422. return m_XML_TOK_INVALID
  26423. }
  26424. ptr += uintptr(4)
  26425. case int32(_BT_NONXML):
  26426. fallthrough
  26427. case int32(_BT_MALFORM):
  26428. fallthrough
  26429. case int32(_BT_TRAIL):
  26430. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26431. return m_XML_TOK_INVALID
  26432. case int32(_BT_LT):
  26433. ptr += uintptr(2)
  26434. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26435. return -int32(1)
  26436. }
  26437. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_EXCL2) {
  26438. ptr += uintptr(2)
  26439. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26440. return -int32(1)
  26441. }
  26442. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_LSQB1) {
  26443. level++
  26444. ptr += uintptr(2)
  26445. }
  26446. }
  26447. case int32(_BT_RSQB):
  26448. ptr += uintptr(2)
  26449. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26450. return -int32(1)
  26451. }
  26452. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1) {
  26453. ptr += uintptr(2)
  26454. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26455. return -int32(1)
  26456. }
  26457. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1) {
  26458. ptr += uintptr(2)
  26459. if level == 0 {
  26460. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26461. return int32(m_XML_TOK_IGNORE_SECT)
  26462. }
  26463. level--
  26464. }
  26465. }
  26466. default:
  26467. ptr += uintptr(2)
  26468. break
  26469. }
  26470. }
  26471. return -int32(1)
  26472. }
  26473. func _big2_isPublicId(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr) (r int32) {
  26474. var v2, v3, v4 int32
  26475. _, _, _ = v2, v3, v4
  26476. ptr += uintptr(2)
  26477. end -= uintptr(2)
  26478. for {
  26479. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26480. break
  26481. }
  26482. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26483. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26484. } else {
  26485. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26486. }
  26487. switch v2 {
  26488. case int32(_BT_DIGIT):
  26489. fallthrough
  26490. case int32(_BT_HEX):
  26491. fallthrough
  26492. case int32(_BT_MINUS):
  26493. fallthrough
  26494. case int32(_BT_APOS):
  26495. fallthrough
  26496. case int32(_BT_LPAR):
  26497. fallthrough
  26498. case int32(_BT_RPAR):
  26499. fallthrough
  26500. case int32(_BT_PLUS):
  26501. fallthrough
  26502. case int32(_BT_COMMA):
  26503. fallthrough
  26504. case int32(_BT_SOL):
  26505. fallthrough
  26506. case int32(_BT_EQUALS):
  26507. fallthrough
  26508. case int32(_BT_QUEST):
  26509. fallthrough
  26510. case int32(_BT_CR):
  26511. fallthrough
  26512. case int32(_BT_LF):
  26513. fallthrough
  26514. case int32(_BT_SEMI):
  26515. fallthrough
  26516. case int32(_BT_EXCL):
  26517. fallthrough
  26518. case int32(_BT_AST):
  26519. fallthrough
  26520. case int32(_BT_PERCNT):
  26521. fallthrough
  26522. case int32(_BT_NUM):
  26523. fallthrough
  26524. case int32(_BT_COLON):
  26525. case int32(_BT_S):
  26526. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_TAB1) {
  26527. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  26528. return 0
  26529. }
  26530. case int32(_BT_NAME):
  26531. fallthrough
  26532. case int32(_BT_NMSTRT):
  26533. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26534. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  26535. } else {
  26536. v3 = -int32(1)
  26537. }
  26538. if !(v3 & ^libc.Int32FromInt32(0x7f) != 0) {
  26539. break
  26540. }
  26541. /* fall through */
  26542. fallthrough
  26543. default:
  26544. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26545. v4 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  26546. } else {
  26547. v4 = -int32(1)
  26548. }
  26549. switch v4 {
  26550. case int32(0x24): /* $ */
  26551. fallthrough
  26552. case int32(0x40): /* @ */
  26553. default:
  26554. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  26555. return 0
  26556. }
  26557. break
  26558. }
  26559. goto _1
  26560. _1:
  26561. ;
  26562. ptr += uintptr(2)
  26563. }
  26564. return int32(1)
  26565. }
  26566. /* This must only be called for a well-formed start-tag or empty
  26567. element tag. Returns the number of attributes. Pointers to the
  26568. first attsMax attributes are stored in atts.
  26569. */
  26570. func _big2_getAtts(tls *libc.TLS, enc uintptr, ptr uintptr, attsMax int32, atts uintptr) (r int32) {
  26571. var nAtts, open, state, v2, v3, v5, v7 int32
  26572. var v4, v6, v8, v9 bool
  26573. _, _, _, _, _, _, _, _, _, _, _ = nAtts, open, state, v2, v3, v4, v5, v6, v7, v8, v9
  26574. state = 1
  26575. nAtts = 0
  26576. open = 0 /* defined when state == inValue;
  26577. initialization just to shut up compilers */
  26578. ptr += uintptr(2)
  26579. for {
  26580. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26581. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26582. } else {
  26583. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26584. }
  26585. switch v2 {
  26586. case int32(_BT_LEAD2):
  26587. if state == 0 {
  26588. if nAtts < attsMax {
  26589. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fname = ptr
  26590. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = uint8(1)
  26591. }
  26592. state = 1
  26593. }
  26594. ptr += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(2))
  26595. case int32(_BT_LEAD3):
  26596. if state == 0 {
  26597. if nAtts < attsMax {
  26598. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fname = ptr
  26599. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = uint8(1)
  26600. }
  26601. state = 1
  26602. }
  26603. ptr += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(2))
  26604. case int32(_BT_LEAD4):
  26605. if state == 0 {
  26606. if nAtts < attsMax {
  26607. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fname = ptr
  26608. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = uint8(1)
  26609. }
  26610. state = 1
  26611. }
  26612. ptr += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(2))
  26613. case int32(_BT_NONASCII):
  26614. fallthrough
  26615. case int32(_BT_NMSTRT):
  26616. fallthrough
  26617. case int32(_BT_HEX):
  26618. if state == 0 {
  26619. if nAtts < attsMax {
  26620. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fname = ptr
  26621. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = uint8(1)
  26622. }
  26623. state = 1
  26624. }
  26625. case int32(_BT_QUOT):
  26626. if state != 2 {
  26627. if nAtts < attsMax {
  26628. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).FvaluePtr = ptr + uintptr(2)
  26629. }
  26630. state = 2
  26631. open = int32(_BT_QUOT)
  26632. } else {
  26633. if open == int32(_BT_QUOT) {
  26634. state = 0
  26635. if nAtts < attsMax {
  26636. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).FvalueEnd = ptr
  26637. }
  26638. nAtts++
  26639. }
  26640. }
  26641. case int32(_BT_APOS):
  26642. if state != 2 {
  26643. if nAtts < attsMax {
  26644. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).FvaluePtr = ptr + uintptr(2)
  26645. }
  26646. state = 2
  26647. open = int32(_BT_APOS)
  26648. } else {
  26649. if open == int32(_BT_APOS) {
  26650. state = 0
  26651. if nAtts < attsMax {
  26652. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).FvalueEnd = ptr
  26653. }
  26654. nAtts++
  26655. }
  26656. }
  26657. case int32(_BT_AMP):
  26658. if nAtts < attsMax {
  26659. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = uint8(0)
  26660. }
  26661. case int32(_BT_S):
  26662. if state == 1 {
  26663. state = 0
  26664. } else {
  26665. if v9 = state == 2 && nAtts < attsMax && (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized != 0; v9 {
  26666. if v4 = ptr == (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).FvaluePtr; !v4 {
  26667. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26668. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  26669. } else {
  26670. v3 = -int32(1)
  26671. }
  26672. }
  26673. if v6 = v4 || v3 != int32(m_ASCII_SPACE1); !v6 {
  26674. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 {
  26675. v5 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))
  26676. } else {
  26677. v5 = -int32(1)
  26678. }
  26679. }
  26680. if v8 = v6 || v5 == int32(m_ASCII_SPACE1); !v8 {
  26681. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 {
  26682. v7 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))))))
  26683. } else {
  26684. v7 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))), *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))
  26685. }
  26686. }
  26687. }
  26688. if v9 && (v8 || v7 == open) {
  26689. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = uint8(0)
  26690. }
  26691. }
  26692. case int32(_BT_CR):
  26693. fallthrough
  26694. case int32(_BT_LF):
  26695. /* This case ensures that the first attribute name is counted
  26696. Apart from that we could just change state on the quote. */
  26697. if state == 1 {
  26698. state = 0
  26699. } else {
  26700. if state == 2 && nAtts < attsMax {
  26701. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = uint8(0)
  26702. }
  26703. }
  26704. case int32(_BT_GT):
  26705. fallthrough
  26706. case int32(_BT_SOL):
  26707. if state != 2 {
  26708. return nAtts
  26709. }
  26710. default:
  26711. break
  26712. }
  26713. goto _1
  26714. _1:
  26715. ;
  26716. ptr += uintptr(2)
  26717. }
  26718. /* not reached */
  26719. return r
  26720. }
  26721. func _big2_charRefNumber(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  26722. var c, c1, result, v2, v4 int32
  26723. _, _, _, _, _ = c, c1, result, v2, v4
  26724. result = 0
  26725. /* skip &# */
  26726. _ = enc
  26727. ptr += uintptr(libc.Int32FromInt32(2) * libc.Int32FromInt32(2))
  26728. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_x2) {
  26729. ptr += uintptr(2)
  26730. for {
  26731. if !!(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_SEMI1)) {
  26732. break
  26733. }
  26734. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26735. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  26736. } else {
  26737. v2 = -int32(1)
  26738. }
  26739. c = v2
  26740. switch c {
  26741. case int32(m_ASCII_02):
  26742. fallthrough
  26743. case int32(m_ASCII_12):
  26744. fallthrough
  26745. case int32(m_ASCII_22):
  26746. fallthrough
  26747. case int32(m_ASCII_32):
  26748. fallthrough
  26749. case int32(m_ASCII_41):
  26750. fallthrough
  26751. case int32(m_ASCII_51):
  26752. fallthrough
  26753. case int32(m_ASCII_61):
  26754. fallthrough
  26755. case int32(m_ASCII_71):
  26756. fallthrough
  26757. case int32(m_ASCII_82):
  26758. fallthrough
  26759. case int32(m_ASCII_92):
  26760. result <<= int32(4)
  26761. result |= c - int32(m_ASCII_02)
  26762. case int32(m_ASCII_A):
  26763. fallthrough
  26764. case int32(m_ASCII_B1):
  26765. fallthrough
  26766. case int32(m_ASCII_C):
  26767. fallthrough
  26768. case int32(m_ASCII_D):
  26769. fallthrough
  26770. case int32(m_ASCII_E):
  26771. fallthrough
  26772. case int32(m_ASCII_F):
  26773. result <<= int32(4)
  26774. result += int32(10) + (c - int32(m_ASCII_A))
  26775. case int32(m_ASCII_a2):
  26776. fallthrough
  26777. case int32(m_ASCII_b1):
  26778. fallthrough
  26779. case int32(m_ASCII_c2):
  26780. fallthrough
  26781. case int32(m_ASCII_d1):
  26782. fallthrough
  26783. case int32(m_ASCII_e2):
  26784. fallthrough
  26785. case int32(m_ASCII_f1):
  26786. result <<= int32(4)
  26787. result += int32(10) + (c - int32(m_ASCII_a2))
  26788. break
  26789. }
  26790. if result >= int32(0x110000) {
  26791. return -int32(1)
  26792. }
  26793. goto _1
  26794. _1:
  26795. ;
  26796. ptr += uintptr(2)
  26797. }
  26798. } else {
  26799. for {
  26800. if !!(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_SEMI1)) {
  26801. break
  26802. }
  26803. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26804. v4 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  26805. } else {
  26806. v4 = -int32(1)
  26807. }
  26808. c1 = v4
  26809. result *= int32(10)
  26810. result += c1 - int32(m_ASCII_02)
  26811. if result >= int32(0x110000) {
  26812. return -int32(1)
  26813. }
  26814. goto _3
  26815. _3:
  26816. ;
  26817. ptr += uintptr(2)
  26818. }
  26819. }
  26820. return _checkCharRefNumber(tls, result)
  26821. }
  26822. func _big2_predefinedEntityName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr) (r int32) {
  26823. var v1, v2 int32
  26824. _, _ = v1, v2
  26825. _ = enc
  26826. switch (int32(end) - int32(ptr)) / libc.Int32FromInt32(2) {
  26827. case int32(2):
  26828. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == int32(m_ASCII_t2) {
  26829. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26830. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  26831. } else {
  26832. v1 = -int32(1)
  26833. }
  26834. switch v1 {
  26835. case int32(m_ASCII_l2):
  26836. return int32(m_ASCII_LT1)
  26837. case int32(m_ASCII_g2):
  26838. return int32(m_ASCII_GT1)
  26839. }
  26840. }
  26841. case int32(3):
  26842. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_a2) {
  26843. ptr += uintptr(2)
  26844. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_m2) {
  26845. ptr += uintptr(2)
  26846. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_p2) {
  26847. return int32(m_ASCII_AMP1)
  26848. }
  26849. }
  26850. }
  26851. case int32(4):
  26852. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26853. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  26854. } else {
  26855. v2 = -int32(1)
  26856. }
  26857. switch v2 {
  26858. case int32(m_ASCII_q1):
  26859. ptr += uintptr(2)
  26860. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_u1) {
  26861. ptr += uintptr(2)
  26862. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_o2) {
  26863. ptr += uintptr(2)
  26864. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_t2) {
  26865. return int32(m_ASCII_QUOT1)
  26866. }
  26867. }
  26868. }
  26869. case int32(m_ASCII_a2):
  26870. ptr += uintptr(2)
  26871. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_p2) {
  26872. ptr += uintptr(2)
  26873. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_o2) {
  26874. ptr += uintptr(2)
  26875. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_s2) {
  26876. return int32(m_ASCII_APOS1)
  26877. }
  26878. }
  26879. }
  26880. break
  26881. }
  26882. }
  26883. return 0
  26884. }
  26885. func _big2_nameMatchesAscii(tls *libc.TLS, enc uintptr, ptr1 uintptr, end1 uintptr, ptr2 uintptr) (r int32) {
  26886. _ = enc
  26887. for {
  26888. if !(*(*uint8)(unsafe.Pointer(ptr2)) != 0) {
  26889. break
  26890. }
  26891. if int32(end1)-int32(ptr1) < int32(2) {
  26892. /* This line cannot be executed. The incoming data has already
  26893. * been tokenized once, so incomplete characters like this have
  26894. * already been eliminated from the input. Retaining the
  26895. * paranoia check is still valuable, however.
  26896. */
  26897. return 0 /* LCOV_EXCL_LINE */
  26898. }
  26899. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr1 + 1))) == libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr2)))) {
  26900. return 0
  26901. }
  26902. goto _1
  26903. _1:
  26904. ;
  26905. ptr1 += uintptr(2)
  26906. ptr2++
  26907. }
  26908. return libc.BoolInt32(ptr1 == end1)
  26909. }
  26910. func _big2_nameLength(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  26911. var start uintptr
  26912. var v2 int32
  26913. _, _ = start, v2
  26914. start = ptr
  26915. for {
  26916. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26917. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26918. } else {
  26919. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26920. }
  26921. switch v2 {
  26922. case int32(_BT_LEAD2):
  26923. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  26924. case int32(_BT_LEAD3):
  26925. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  26926. case int32(_BT_LEAD4):
  26927. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  26928. case int32(_BT_NONASCII):
  26929. fallthrough
  26930. case int32(_BT_NMSTRT):
  26931. fallthrough
  26932. case int32(_BT_COLON):
  26933. fallthrough
  26934. case int32(_BT_HEX):
  26935. fallthrough
  26936. case int32(_BT_DIGIT):
  26937. fallthrough
  26938. case int32(_BT_NAME):
  26939. fallthrough
  26940. case int32(_BT_MINUS):
  26941. ptr += uintptr(2)
  26942. default:
  26943. return int32(ptr) - int32(start)
  26944. }
  26945. goto _1
  26946. _1:
  26947. }
  26948. return r
  26949. }
  26950. func _big2_skipS(tls *libc.TLS, enc uintptr, ptr uintptr) (r uintptr) {
  26951. var v2 int32
  26952. _ = v2
  26953. for {
  26954. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26955. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26956. } else {
  26957. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26958. }
  26959. switch v2 {
  26960. case int32(_BT_LF):
  26961. fallthrough
  26962. case int32(_BT_CR):
  26963. fallthrough
  26964. case int32(_BT_S):
  26965. ptr += uintptr(2)
  26966. default:
  26967. return ptr
  26968. }
  26969. goto _1
  26970. _1:
  26971. }
  26972. return r
  26973. }
  26974. func _big2_updatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  26975. var v1, v2 int32
  26976. var v3 bool
  26977. _, _, _ = v1, v2, v3
  26978. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  26979. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26980. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26981. } else {
  26982. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26983. }
  26984. switch v1 {
  26985. case int32(_BT_LEAD2):
  26986. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  26987. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  26988. case int32(_BT_LEAD3):
  26989. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  26990. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  26991. case int32(_BT_LEAD4):
  26992. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  26993. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  26994. case int32(_BT_LF):
  26995. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint32(0)
  26996. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  26997. ptr += uintptr(2)
  26998. case int32(_BT_CR):
  26999. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  27000. ptr += uintptr(2)
  27001. if v3 = int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2); v3 {
  27002. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  27003. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  27004. } else {
  27005. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  27006. }
  27007. }
  27008. if v3 && v2 == int32(_BT_LF) {
  27009. ptr += uintptr(2)
  27010. }
  27011. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint32(0)
  27012. default:
  27013. ptr += uintptr(2)
  27014. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  27015. break
  27016. }
  27017. }
  27018. }
  27019. var _big2_encoding_ns = Tnormal_encoding{
  27020. Fenc: TENCODING{
  27021. Fscanners: [4]TSCANNER{},
  27022. FliteralScanners: [2]TSCANNER{},
  27023. FminBytesPerChar: int32(2),
  27024. },
  27025. Ftype1: [256]uint8{
  27026. 9: uint8(_BT_S),
  27027. 10: uint8(_BT_LF),
  27028. 13: uint8(_BT_CR),
  27029. 32: uint8(_BT_S),
  27030. 33: uint8(_BT_EXCL),
  27031. 34: uint8(_BT_QUOT),
  27032. 35: uint8(_BT_NUM),
  27033. 36: uint8(_BT_OTHER),
  27034. 37: uint8(_BT_PERCNT),
  27035. 38: uint8(_BT_AMP),
  27036. 39: uint8(_BT_APOS),
  27037. 40: uint8(_BT_LPAR),
  27038. 41: uint8(_BT_RPAR),
  27039. 42: uint8(_BT_AST),
  27040. 43: uint8(_BT_PLUS),
  27041. 44: uint8(_BT_COMMA),
  27042. 45: uint8(_BT_MINUS),
  27043. 46: uint8(_BT_NAME),
  27044. 47: uint8(_BT_SOL),
  27045. 48: uint8(_BT_DIGIT),
  27046. 49: uint8(_BT_DIGIT),
  27047. 50: uint8(_BT_DIGIT),
  27048. 51: uint8(_BT_DIGIT),
  27049. 52: uint8(_BT_DIGIT),
  27050. 53: uint8(_BT_DIGIT),
  27051. 54: uint8(_BT_DIGIT),
  27052. 55: uint8(_BT_DIGIT),
  27053. 56: uint8(_BT_DIGIT),
  27054. 57: uint8(_BT_DIGIT),
  27055. 58: uint8(_BT_COLON),
  27056. 59: uint8(_BT_SEMI),
  27057. 60: uint8(_BT_LT),
  27058. 61: uint8(_BT_EQUALS),
  27059. 62: uint8(_BT_GT),
  27060. 63: uint8(_BT_QUEST),
  27061. 64: uint8(_BT_OTHER),
  27062. 65: uint8(_BT_HEX),
  27063. 66: uint8(_BT_HEX),
  27064. 67: uint8(_BT_HEX),
  27065. 68: uint8(_BT_HEX),
  27066. 69: uint8(_BT_HEX),
  27067. 70: uint8(_BT_HEX),
  27068. 71: uint8(_BT_NMSTRT),
  27069. 72: uint8(_BT_NMSTRT),
  27070. 73: uint8(_BT_NMSTRT),
  27071. 74: uint8(_BT_NMSTRT),
  27072. 75: uint8(_BT_NMSTRT),
  27073. 76: uint8(_BT_NMSTRT),
  27074. 77: uint8(_BT_NMSTRT),
  27075. 78: uint8(_BT_NMSTRT),
  27076. 79: uint8(_BT_NMSTRT),
  27077. 80: uint8(_BT_NMSTRT),
  27078. 81: uint8(_BT_NMSTRT),
  27079. 82: uint8(_BT_NMSTRT),
  27080. 83: uint8(_BT_NMSTRT),
  27081. 84: uint8(_BT_NMSTRT),
  27082. 85: uint8(_BT_NMSTRT),
  27083. 86: uint8(_BT_NMSTRT),
  27084. 87: uint8(_BT_NMSTRT),
  27085. 88: uint8(_BT_NMSTRT),
  27086. 89: uint8(_BT_NMSTRT),
  27087. 90: uint8(_BT_NMSTRT),
  27088. 91: uint8(_BT_LSQB),
  27089. 92: uint8(_BT_OTHER),
  27090. 93: uint8(_BT_RSQB),
  27091. 94: uint8(_BT_OTHER),
  27092. 95: uint8(_BT_NMSTRT),
  27093. 96: uint8(_BT_OTHER),
  27094. 97: uint8(_BT_HEX),
  27095. 98: uint8(_BT_HEX),
  27096. 99: uint8(_BT_HEX),
  27097. 100: uint8(_BT_HEX),
  27098. 101: uint8(_BT_HEX),
  27099. 102: uint8(_BT_HEX),
  27100. 103: uint8(_BT_NMSTRT),
  27101. 104: uint8(_BT_NMSTRT),
  27102. 105: uint8(_BT_NMSTRT),
  27103. 106: uint8(_BT_NMSTRT),
  27104. 107: uint8(_BT_NMSTRT),
  27105. 108: uint8(_BT_NMSTRT),
  27106. 109: uint8(_BT_NMSTRT),
  27107. 110: uint8(_BT_NMSTRT),
  27108. 111: uint8(_BT_NMSTRT),
  27109. 112: uint8(_BT_NMSTRT),
  27110. 113: uint8(_BT_NMSTRT),
  27111. 114: uint8(_BT_NMSTRT),
  27112. 115: uint8(_BT_NMSTRT),
  27113. 116: uint8(_BT_NMSTRT),
  27114. 117: uint8(_BT_NMSTRT),
  27115. 118: uint8(_BT_NMSTRT),
  27116. 119: uint8(_BT_NMSTRT),
  27117. 120: uint8(_BT_NMSTRT),
  27118. 121: uint8(_BT_NMSTRT),
  27119. 122: uint8(_BT_NMSTRT),
  27120. 123: uint8(_BT_OTHER),
  27121. 124: uint8(_BT_VERBAR),
  27122. 125: uint8(_BT_OTHER),
  27123. 126: uint8(_BT_OTHER),
  27124. 127: uint8(_BT_OTHER),
  27125. 128: uint8(_BT_OTHER),
  27126. 129: uint8(_BT_OTHER),
  27127. 130: uint8(_BT_OTHER),
  27128. 131: uint8(_BT_OTHER),
  27129. 132: uint8(_BT_OTHER),
  27130. 133: uint8(_BT_OTHER),
  27131. 134: uint8(_BT_OTHER),
  27132. 135: uint8(_BT_OTHER),
  27133. 136: uint8(_BT_OTHER),
  27134. 137: uint8(_BT_OTHER),
  27135. 138: uint8(_BT_OTHER),
  27136. 139: uint8(_BT_OTHER),
  27137. 140: uint8(_BT_OTHER),
  27138. 141: uint8(_BT_OTHER),
  27139. 142: uint8(_BT_OTHER),
  27140. 143: uint8(_BT_OTHER),
  27141. 144: uint8(_BT_OTHER),
  27142. 145: uint8(_BT_OTHER),
  27143. 146: uint8(_BT_OTHER),
  27144. 147: uint8(_BT_OTHER),
  27145. 148: uint8(_BT_OTHER),
  27146. 149: uint8(_BT_OTHER),
  27147. 150: uint8(_BT_OTHER),
  27148. 151: uint8(_BT_OTHER),
  27149. 152: uint8(_BT_OTHER),
  27150. 153: uint8(_BT_OTHER),
  27151. 154: uint8(_BT_OTHER),
  27152. 155: uint8(_BT_OTHER),
  27153. 156: uint8(_BT_OTHER),
  27154. 157: uint8(_BT_OTHER),
  27155. 158: uint8(_BT_OTHER),
  27156. 159: uint8(_BT_OTHER),
  27157. 160: uint8(_BT_OTHER),
  27158. 161: uint8(_BT_OTHER),
  27159. 162: uint8(_BT_OTHER),
  27160. 163: uint8(_BT_OTHER),
  27161. 164: uint8(_BT_OTHER),
  27162. 165: uint8(_BT_OTHER),
  27163. 166: uint8(_BT_OTHER),
  27164. 167: uint8(_BT_OTHER),
  27165. 168: uint8(_BT_OTHER),
  27166. 169: uint8(_BT_OTHER),
  27167. 170: uint8(_BT_NMSTRT),
  27168. 171: uint8(_BT_OTHER),
  27169. 172: uint8(_BT_OTHER),
  27170. 173: uint8(_BT_OTHER),
  27171. 174: uint8(_BT_OTHER),
  27172. 175: uint8(_BT_OTHER),
  27173. 176: uint8(_BT_OTHER),
  27174. 177: uint8(_BT_OTHER),
  27175. 178: uint8(_BT_OTHER),
  27176. 179: uint8(_BT_OTHER),
  27177. 180: uint8(_BT_OTHER),
  27178. 181: uint8(_BT_NMSTRT),
  27179. 182: uint8(_BT_OTHER),
  27180. 183: uint8(_BT_NAME),
  27181. 184: uint8(_BT_OTHER),
  27182. 185: uint8(_BT_OTHER),
  27183. 186: uint8(_BT_NMSTRT),
  27184. 187: uint8(_BT_OTHER),
  27185. 188: uint8(_BT_OTHER),
  27186. 189: uint8(_BT_OTHER),
  27187. 190: uint8(_BT_OTHER),
  27188. 191: uint8(_BT_OTHER),
  27189. 192: uint8(_BT_NMSTRT),
  27190. 193: uint8(_BT_NMSTRT),
  27191. 194: uint8(_BT_NMSTRT),
  27192. 195: uint8(_BT_NMSTRT),
  27193. 196: uint8(_BT_NMSTRT),
  27194. 197: uint8(_BT_NMSTRT),
  27195. 198: uint8(_BT_NMSTRT),
  27196. 199: uint8(_BT_NMSTRT),
  27197. 200: uint8(_BT_NMSTRT),
  27198. 201: uint8(_BT_NMSTRT),
  27199. 202: uint8(_BT_NMSTRT),
  27200. 203: uint8(_BT_NMSTRT),
  27201. 204: uint8(_BT_NMSTRT),
  27202. 205: uint8(_BT_NMSTRT),
  27203. 206: uint8(_BT_NMSTRT),
  27204. 207: uint8(_BT_NMSTRT),
  27205. 208: uint8(_BT_NMSTRT),
  27206. 209: uint8(_BT_NMSTRT),
  27207. 210: uint8(_BT_NMSTRT),
  27208. 211: uint8(_BT_NMSTRT),
  27209. 212: uint8(_BT_NMSTRT),
  27210. 213: uint8(_BT_NMSTRT),
  27211. 214: uint8(_BT_NMSTRT),
  27212. 215: uint8(_BT_OTHER),
  27213. 216: uint8(_BT_NMSTRT),
  27214. 217: uint8(_BT_NMSTRT),
  27215. 218: uint8(_BT_NMSTRT),
  27216. 219: uint8(_BT_NMSTRT),
  27217. 220: uint8(_BT_NMSTRT),
  27218. 221: uint8(_BT_NMSTRT),
  27219. 222: uint8(_BT_NMSTRT),
  27220. 223: uint8(_BT_NMSTRT),
  27221. 224: uint8(_BT_NMSTRT),
  27222. 225: uint8(_BT_NMSTRT),
  27223. 226: uint8(_BT_NMSTRT),
  27224. 227: uint8(_BT_NMSTRT),
  27225. 228: uint8(_BT_NMSTRT),
  27226. 229: uint8(_BT_NMSTRT),
  27227. 230: uint8(_BT_NMSTRT),
  27228. 231: uint8(_BT_NMSTRT),
  27229. 232: uint8(_BT_NMSTRT),
  27230. 233: uint8(_BT_NMSTRT),
  27231. 234: uint8(_BT_NMSTRT),
  27232. 235: uint8(_BT_NMSTRT),
  27233. 236: uint8(_BT_NMSTRT),
  27234. 237: uint8(_BT_NMSTRT),
  27235. 238: uint8(_BT_NMSTRT),
  27236. 239: uint8(_BT_NMSTRT),
  27237. 240: uint8(_BT_NMSTRT),
  27238. 241: uint8(_BT_NMSTRT),
  27239. 242: uint8(_BT_NMSTRT),
  27240. 243: uint8(_BT_NMSTRT),
  27241. 244: uint8(_BT_NMSTRT),
  27242. 245: uint8(_BT_NMSTRT),
  27243. 246: uint8(_BT_NMSTRT),
  27244. 247: uint8(_BT_OTHER),
  27245. 248: uint8(_BT_NMSTRT),
  27246. 249: uint8(_BT_NMSTRT),
  27247. 250: uint8(_BT_NMSTRT),
  27248. 251: uint8(_BT_NMSTRT),
  27249. 252: uint8(_BT_NMSTRT),
  27250. 253: uint8(_BT_NMSTRT),
  27251. 254: uint8(_BT_NMSTRT),
  27252. 255: uint8(_BT_NMSTRT),
  27253. },
  27254. }
  27255. func init() {
  27256. p := unsafe.Pointer(&_big2_encoding_ns)
  27257. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_big2_prologTok)
  27258. *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_big2_contentTok)
  27259. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_big2_cdataSectionTok)
  27260. *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_big2_ignoreSectionTok)
  27261. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_big2_attributeValueTok)
  27262. *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_big2_entityValueTok)
  27263. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_big2_nameMatchesAscii)
  27264. *(*uintptr)(unsafe.Add(p, 28)) = __ccgo_fp(_big2_nameLength)
  27265. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_big2_skipS)
  27266. *(*uintptr)(unsafe.Add(p, 36)) = __ccgo_fp(_big2_getAtts)
  27267. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_big2_charRefNumber)
  27268. *(*uintptr)(unsafe.Add(p, 44)) = __ccgo_fp(_big2_predefinedEntityName)
  27269. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_big2_updatePosition)
  27270. *(*uintptr)(unsafe.Add(p, 52)) = __ccgo_fp(_big2_isPublicId)
  27271. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_big2_toUtf8)
  27272. *(*uintptr)(unsafe.Add(p, 60)) = __ccgo_fp(_big2_toUtf16)
  27273. }
  27274. var _big2_encoding = Tnormal_encoding{
  27275. Fenc: TENCODING{
  27276. Fscanners: [4]TSCANNER{},
  27277. FliteralScanners: [2]TSCANNER{},
  27278. FminBytesPerChar: int32(2),
  27279. },
  27280. Ftype1: [256]uint8{
  27281. 9: uint8(_BT_S),
  27282. 10: uint8(_BT_LF),
  27283. 13: uint8(_BT_CR),
  27284. 32: uint8(_BT_S),
  27285. 33: uint8(_BT_EXCL),
  27286. 34: uint8(_BT_QUOT),
  27287. 35: uint8(_BT_NUM),
  27288. 36: uint8(_BT_OTHER),
  27289. 37: uint8(_BT_PERCNT),
  27290. 38: uint8(_BT_AMP),
  27291. 39: uint8(_BT_APOS),
  27292. 40: uint8(_BT_LPAR),
  27293. 41: uint8(_BT_RPAR),
  27294. 42: uint8(_BT_AST),
  27295. 43: uint8(_BT_PLUS),
  27296. 44: uint8(_BT_COMMA),
  27297. 45: uint8(_BT_MINUS),
  27298. 46: uint8(_BT_NAME),
  27299. 47: uint8(_BT_SOL),
  27300. 48: uint8(_BT_DIGIT),
  27301. 49: uint8(_BT_DIGIT),
  27302. 50: uint8(_BT_DIGIT),
  27303. 51: uint8(_BT_DIGIT),
  27304. 52: uint8(_BT_DIGIT),
  27305. 53: uint8(_BT_DIGIT),
  27306. 54: uint8(_BT_DIGIT),
  27307. 55: uint8(_BT_DIGIT),
  27308. 56: uint8(_BT_DIGIT),
  27309. 57: uint8(_BT_DIGIT),
  27310. 58: uint8(_BT_NMSTRT),
  27311. 59: uint8(_BT_SEMI),
  27312. 60: uint8(_BT_LT),
  27313. 61: uint8(_BT_EQUALS),
  27314. 62: uint8(_BT_GT),
  27315. 63: uint8(_BT_QUEST),
  27316. 64: uint8(_BT_OTHER),
  27317. 65: uint8(_BT_HEX),
  27318. 66: uint8(_BT_HEX),
  27319. 67: uint8(_BT_HEX),
  27320. 68: uint8(_BT_HEX),
  27321. 69: uint8(_BT_HEX),
  27322. 70: uint8(_BT_HEX),
  27323. 71: uint8(_BT_NMSTRT),
  27324. 72: uint8(_BT_NMSTRT),
  27325. 73: uint8(_BT_NMSTRT),
  27326. 74: uint8(_BT_NMSTRT),
  27327. 75: uint8(_BT_NMSTRT),
  27328. 76: uint8(_BT_NMSTRT),
  27329. 77: uint8(_BT_NMSTRT),
  27330. 78: uint8(_BT_NMSTRT),
  27331. 79: uint8(_BT_NMSTRT),
  27332. 80: uint8(_BT_NMSTRT),
  27333. 81: uint8(_BT_NMSTRT),
  27334. 82: uint8(_BT_NMSTRT),
  27335. 83: uint8(_BT_NMSTRT),
  27336. 84: uint8(_BT_NMSTRT),
  27337. 85: uint8(_BT_NMSTRT),
  27338. 86: uint8(_BT_NMSTRT),
  27339. 87: uint8(_BT_NMSTRT),
  27340. 88: uint8(_BT_NMSTRT),
  27341. 89: uint8(_BT_NMSTRT),
  27342. 90: uint8(_BT_NMSTRT),
  27343. 91: uint8(_BT_LSQB),
  27344. 92: uint8(_BT_OTHER),
  27345. 93: uint8(_BT_RSQB),
  27346. 94: uint8(_BT_OTHER),
  27347. 95: uint8(_BT_NMSTRT),
  27348. 96: uint8(_BT_OTHER),
  27349. 97: uint8(_BT_HEX),
  27350. 98: uint8(_BT_HEX),
  27351. 99: uint8(_BT_HEX),
  27352. 100: uint8(_BT_HEX),
  27353. 101: uint8(_BT_HEX),
  27354. 102: uint8(_BT_HEX),
  27355. 103: uint8(_BT_NMSTRT),
  27356. 104: uint8(_BT_NMSTRT),
  27357. 105: uint8(_BT_NMSTRT),
  27358. 106: uint8(_BT_NMSTRT),
  27359. 107: uint8(_BT_NMSTRT),
  27360. 108: uint8(_BT_NMSTRT),
  27361. 109: uint8(_BT_NMSTRT),
  27362. 110: uint8(_BT_NMSTRT),
  27363. 111: uint8(_BT_NMSTRT),
  27364. 112: uint8(_BT_NMSTRT),
  27365. 113: uint8(_BT_NMSTRT),
  27366. 114: uint8(_BT_NMSTRT),
  27367. 115: uint8(_BT_NMSTRT),
  27368. 116: uint8(_BT_NMSTRT),
  27369. 117: uint8(_BT_NMSTRT),
  27370. 118: uint8(_BT_NMSTRT),
  27371. 119: uint8(_BT_NMSTRT),
  27372. 120: uint8(_BT_NMSTRT),
  27373. 121: uint8(_BT_NMSTRT),
  27374. 122: uint8(_BT_NMSTRT),
  27375. 123: uint8(_BT_OTHER),
  27376. 124: uint8(_BT_VERBAR),
  27377. 125: uint8(_BT_OTHER),
  27378. 126: uint8(_BT_OTHER),
  27379. 127: uint8(_BT_OTHER),
  27380. 128: uint8(_BT_OTHER),
  27381. 129: uint8(_BT_OTHER),
  27382. 130: uint8(_BT_OTHER),
  27383. 131: uint8(_BT_OTHER),
  27384. 132: uint8(_BT_OTHER),
  27385. 133: uint8(_BT_OTHER),
  27386. 134: uint8(_BT_OTHER),
  27387. 135: uint8(_BT_OTHER),
  27388. 136: uint8(_BT_OTHER),
  27389. 137: uint8(_BT_OTHER),
  27390. 138: uint8(_BT_OTHER),
  27391. 139: uint8(_BT_OTHER),
  27392. 140: uint8(_BT_OTHER),
  27393. 141: uint8(_BT_OTHER),
  27394. 142: uint8(_BT_OTHER),
  27395. 143: uint8(_BT_OTHER),
  27396. 144: uint8(_BT_OTHER),
  27397. 145: uint8(_BT_OTHER),
  27398. 146: uint8(_BT_OTHER),
  27399. 147: uint8(_BT_OTHER),
  27400. 148: uint8(_BT_OTHER),
  27401. 149: uint8(_BT_OTHER),
  27402. 150: uint8(_BT_OTHER),
  27403. 151: uint8(_BT_OTHER),
  27404. 152: uint8(_BT_OTHER),
  27405. 153: uint8(_BT_OTHER),
  27406. 154: uint8(_BT_OTHER),
  27407. 155: uint8(_BT_OTHER),
  27408. 156: uint8(_BT_OTHER),
  27409. 157: uint8(_BT_OTHER),
  27410. 158: uint8(_BT_OTHER),
  27411. 159: uint8(_BT_OTHER),
  27412. 160: uint8(_BT_OTHER),
  27413. 161: uint8(_BT_OTHER),
  27414. 162: uint8(_BT_OTHER),
  27415. 163: uint8(_BT_OTHER),
  27416. 164: uint8(_BT_OTHER),
  27417. 165: uint8(_BT_OTHER),
  27418. 166: uint8(_BT_OTHER),
  27419. 167: uint8(_BT_OTHER),
  27420. 168: uint8(_BT_OTHER),
  27421. 169: uint8(_BT_OTHER),
  27422. 170: uint8(_BT_NMSTRT),
  27423. 171: uint8(_BT_OTHER),
  27424. 172: uint8(_BT_OTHER),
  27425. 173: uint8(_BT_OTHER),
  27426. 174: uint8(_BT_OTHER),
  27427. 175: uint8(_BT_OTHER),
  27428. 176: uint8(_BT_OTHER),
  27429. 177: uint8(_BT_OTHER),
  27430. 178: uint8(_BT_OTHER),
  27431. 179: uint8(_BT_OTHER),
  27432. 180: uint8(_BT_OTHER),
  27433. 181: uint8(_BT_NMSTRT),
  27434. 182: uint8(_BT_OTHER),
  27435. 183: uint8(_BT_NAME),
  27436. 184: uint8(_BT_OTHER),
  27437. 185: uint8(_BT_OTHER),
  27438. 186: uint8(_BT_NMSTRT),
  27439. 187: uint8(_BT_OTHER),
  27440. 188: uint8(_BT_OTHER),
  27441. 189: uint8(_BT_OTHER),
  27442. 190: uint8(_BT_OTHER),
  27443. 191: uint8(_BT_OTHER),
  27444. 192: uint8(_BT_NMSTRT),
  27445. 193: uint8(_BT_NMSTRT),
  27446. 194: uint8(_BT_NMSTRT),
  27447. 195: uint8(_BT_NMSTRT),
  27448. 196: uint8(_BT_NMSTRT),
  27449. 197: uint8(_BT_NMSTRT),
  27450. 198: uint8(_BT_NMSTRT),
  27451. 199: uint8(_BT_NMSTRT),
  27452. 200: uint8(_BT_NMSTRT),
  27453. 201: uint8(_BT_NMSTRT),
  27454. 202: uint8(_BT_NMSTRT),
  27455. 203: uint8(_BT_NMSTRT),
  27456. 204: uint8(_BT_NMSTRT),
  27457. 205: uint8(_BT_NMSTRT),
  27458. 206: uint8(_BT_NMSTRT),
  27459. 207: uint8(_BT_NMSTRT),
  27460. 208: uint8(_BT_NMSTRT),
  27461. 209: uint8(_BT_NMSTRT),
  27462. 210: uint8(_BT_NMSTRT),
  27463. 211: uint8(_BT_NMSTRT),
  27464. 212: uint8(_BT_NMSTRT),
  27465. 213: uint8(_BT_NMSTRT),
  27466. 214: uint8(_BT_NMSTRT),
  27467. 215: uint8(_BT_OTHER),
  27468. 216: uint8(_BT_NMSTRT),
  27469. 217: uint8(_BT_NMSTRT),
  27470. 218: uint8(_BT_NMSTRT),
  27471. 219: uint8(_BT_NMSTRT),
  27472. 220: uint8(_BT_NMSTRT),
  27473. 221: uint8(_BT_NMSTRT),
  27474. 222: uint8(_BT_NMSTRT),
  27475. 223: uint8(_BT_NMSTRT),
  27476. 224: uint8(_BT_NMSTRT),
  27477. 225: uint8(_BT_NMSTRT),
  27478. 226: uint8(_BT_NMSTRT),
  27479. 227: uint8(_BT_NMSTRT),
  27480. 228: uint8(_BT_NMSTRT),
  27481. 229: uint8(_BT_NMSTRT),
  27482. 230: uint8(_BT_NMSTRT),
  27483. 231: uint8(_BT_NMSTRT),
  27484. 232: uint8(_BT_NMSTRT),
  27485. 233: uint8(_BT_NMSTRT),
  27486. 234: uint8(_BT_NMSTRT),
  27487. 235: uint8(_BT_NMSTRT),
  27488. 236: uint8(_BT_NMSTRT),
  27489. 237: uint8(_BT_NMSTRT),
  27490. 238: uint8(_BT_NMSTRT),
  27491. 239: uint8(_BT_NMSTRT),
  27492. 240: uint8(_BT_NMSTRT),
  27493. 241: uint8(_BT_NMSTRT),
  27494. 242: uint8(_BT_NMSTRT),
  27495. 243: uint8(_BT_NMSTRT),
  27496. 244: uint8(_BT_NMSTRT),
  27497. 245: uint8(_BT_NMSTRT),
  27498. 246: uint8(_BT_NMSTRT),
  27499. 247: uint8(_BT_OTHER),
  27500. 248: uint8(_BT_NMSTRT),
  27501. 249: uint8(_BT_NMSTRT),
  27502. 250: uint8(_BT_NMSTRT),
  27503. 251: uint8(_BT_NMSTRT),
  27504. 252: uint8(_BT_NMSTRT),
  27505. 253: uint8(_BT_NMSTRT),
  27506. 254: uint8(_BT_NMSTRT),
  27507. 255: uint8(_BT_NMSTRT),
  27508. },
  27509. }
  27510. func init() {
  27511. p := unsafe.Pointer(&_big2_encoding)
  27512. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_big2_prologTok)
  27513. *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_big2_contentTok)
  27514. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_big2_cdataSectionTok)
  27515. *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_big2_ignoreSectionTok)
  27516. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_big2_attributeValueTok)
  27517. *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_big2_entityValueTok)
  27518. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_big2_nameMatchesAscii)
  27519. *(*uintptr)(unsafe.Add(p, 28)) = __ccgo_fp(_big2_nameLength)
  27520. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_big2_skipS)
  27521. *(*uintptr)(unsafe.Add(p, 36)) = __ccgo_fp(_big2_getAtts)
  27522. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_big2_charRefNumber)
  27523. *(*uintptr)(unsafe.Add(p, 44)) = __ccgo_fp(_big2_predefinedEntityName)
  27524. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_big2_updatePosition)
  27525. *(*uintptr)(unsafe.Add(p, 52)) = __ccgo_fp(_big2_isPublicId)
  27526. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_big2_toUtf8)
  27527. *(*uintptr)(unsafe.Add(p, 60)) = __ccgo_fp(_big2_toUtf16)
  27528. }
  27529. func _streqci(tls *libc.TLS, s1 uintptr, s2 uintptr) (r int32) {
  27530. var c1, c2 uint8
  27531. var v2, v3 uintptr
  27532. _, _, _, _ = c1, c2, v2, v3
  27533. for {
  27534. v2 = s1
  27535. s1++
  27536. c1 = *(*uint8)(unsafe.Pointer(v2))
  27537. v3 = s2
  27538. s2++
  27539. c2 = *(*uint8)(unsafe.Pointer(v3))
  27540. if int32(m_ASCII_a2) <= libc.Int32FromUint8(c1) && libc.Int32FromUint8(c1) <= int32(m_ASCII_z1) {
  27541. c1 = uint8(int32(c1) + (libc.Int32FromInt32(m_ASCII_A) - libc.Int32FromInt32(m_ASCII_a2)))
  27542. }
  27543. if int32(m_ASCII_a2) <= libc.Int32FromUint8(c2) && libc.Int32FromUint8(c2) <= int32(m_ASCII_z1) {
  27544. /* The following line will never get executed. streqci() is
  27545. * only called from two places, both of which guarantee to put
  27546. * upper-case strings into s2.
  27547. */
  27548. c2 = uint8(int32(c2) + (libc.Int32FromInt32(m_ASCII_A) - libc.Int32FromInt32(m_ASCII_a2)))
  27549. } /* LCOV_EXCL_LINE */
  27550. if libc.Int32FromUint8(c1) != libc.Int32FromUint8(c2) {
  27551. return 0
  27552. }
  27553. if !(c1 != 0) {
  27554. break
  27555. }
  27556. goto _1
  27557. _1:
  27558. }
  27559. return int32(1)
  27560. }
  27561. func _initUpdatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  27562. _ = enc
  27563. _normal_updatePosition(tls, uintptr(unsafe.Pointer(&_utf8_encoding)), ptr, end, pos)
  27564. }
  27565. func _toAscii(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr) (r int32) {
  27566. bp := tls.Alloc(16)
  27567. defer tls.Free(16)
  27568. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  27569. var _ /* buf at bp+4 */ [1]uint8
  27570. var _ /* p at bp+8 */ uintptr
  27571. *(*uintptr)(unsafe.Pointer(bp + 8)) = bp + 4
  27572. (*(*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, *(*uintptr)(unsafe.Pointer(bp + 8))+uintptr(1))
  27573. if *(*uintptr)(unsafe.Pointer(bp + 8)) == bp+4 {
  27574. return -int32(1)
  27575. } else {
  27576. return libc.Int32FromUint8((*(*[1]uint8)(unsafe.Pointer(bp + 4)))[0])
  27577. }
  27578. return r
  27579. }
  27580. func _isSpace(tls *libc.TLS, c int32) (r int32) {
  27581. switch c {
  27582. case int32(0x20):
  27583. fallthrough
  27584. case int32(0xD):
  27585. fallthrough
  27586. case int32(0xA):
  27587. fallthrough
  27588. case int32(0x9):
  27589. return int32(1)
  27590. }
  27591. return 0
  27592. }
  27593. // C documentation
  27594. //
  27595. // /* Return 1 if there's just optional white space or there's an S
  27596. // followed by name=val.
  27597. // */
  27598. func _parsePseudoAttribute(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, namePtr uintptr, nameEndPtr uintptr, valPtr uintptr, nextTokPtr uintptr) (r int32) {
  27599. var c, v2 int32
  27600. var open uint8
  27601. _, _, _ = c, open, v2
  27602. if ptr == end {
  27603. *(*uintptr)(unsafe.Pointer(namePtr)) = libc.UintptrFromInt32(0)
  27604. return int32(1)
  27605. }
  27606. if !(_isSpace(tls, _toAscii(tls, enc, ptr, end)) != 0) {
  27607. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27608. return 0
  27609. }
  27610. for cond := true; cond; cond = _isSpace(tls, _toAscii(tls, enc, ptr, end)) != 0 {
  27611. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27612. }
  27613. if ptr == end {
  27614. *(*uintptr)(unsafe.Pointer(namePtr)) = libc.UintptrFromInt32(0)
  27615. return int32(1)
  27616. }
  27617. *(*uintptr)(unsafe.Pointer(namePtr)) = ptr
  27618. for {
  27619. c = _toAscii(tls, enc, ptr, end)
  27620. if c == -int32(1) {
  27621. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27622. return 0
  27623. }
  27624. if c == int32(m_ASCII_EQUALS2) {
  27625. *(*uintptr)(unsafe.Pointer(nameEndPtr)) = ptr
  27626. break
  27627. }
  27628. if _isSpace(tls, c) != 0 {
  27629. *(*uintptr)(unsafe.Pointer(nameEndPtr)) = ptr
  27630. for {
  27631. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27632. goto _3
  27633. _3:
  27634. ;
  27635. v2 = _toAscii(tls, enc, ptr, end)
  27636. c = v2
  27637. if !(_isSpace(tls, v2) != 0) {
  27638. break
  27639. }
  27640. }
  27641. if c != int32(m_ASCII_EQUALS2) {
  27642. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27643. return 0
  27644. }
  27645. break
  27646. }
  27647. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27648. goto _1
  27649. _1:
  27650. }
  27651. if ptr == *(*uintptr)(unsafe.Pointer(namePtr)) {
  27652. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27653. return 0
  27654. }
  27655. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27656. c = _toAscii(tls, enc, ptr, end)
  27657. for _isSpace(tls, c) != 0 {
  27658. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27659. c = _toAscii(tls, enc, ptr, end)
  27660. }
  27661. if c != int32(m_ASCII_QUOT1) && c != int32(m_ASCII_APOS1) {
  27662. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27663. return 0
  27664. }
  27665. open = libc.Uint8FromInt32(c)
  27666. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27667. *(*uintptr)(unsafe.Pointer(valPtr)) = ptr
  27668. for {
  27669. c = _toAscii(tls, enc, ptr, end)
  27670. if c == libc.Int32FromUint8(open) {
  27671. break
  27672. }
  27673. 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) {
  27674. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27675. return 0
  27676. }
  27677. goto _4
  27678. _4:
  27679. ;
  27680. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27681. }
  27682. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27683. return int32(1)
  27684. }
  27685. var _KW_version = [8]uint8{
  27686. 0: uint8(m_ASCII_v1),
  27687. 1: uint8(m_ASCII_e2),
  27688. 2: uint8(m_ASCII_r2),
  27689. 3: uint8(m_ASCII_s2),
  27690. 4: uint8(m_ASCII_i1),
  27691. 5: uint8(m_ASCII_o2),
  27692. 6: uint8(m_ASCII_n2),
  27693. }
  27694. var _KW_encoding = [9]uint8{
  27695. 0: uint8(m_ASCII_e2),
  27696. 1: uint8(m_ASCII_n2),
  27697. 2: uint8(m_ASCII_c2),
  27698. 3: uint8(m_ASCII_o2),
  27699. 4: uint8(m_ASCII_d1),
  27700. 5: uint8(m_ASCII_i1),
  27701. 6: uint8(m_ASCII_n2),
  27702. 7: uint8(m_ASCII_g2),
  27703. }
  27704. var _KW_standalone = [11]uint8{
  27705. 0: uint8(m_ASCII_s2),
  27706. 1: uint8(m_ASCII_t2),
  27707. 2: uint8(m_ASCII_a2),
  27708. 3: uint8(m_ASCII_n2),
  27709. 4: uint8(m_ASCII_d1),
  27710. 5: uint8(m_ASCII_a2),
  27711. 6: uint8(m_ASCII_l2),
  27712. 7: uint8(m_ASCII_o2),
  27713. 8: uint8(m_ASCII_n2),
  27714. 9: uint8(m_ASCII_e2),
  27715. }
  27716. var _KW_yes = [4]uint8{
  27717. 0: uint8(m_ASCII_y1),
  27718. 1: uint8(m_ASCII_e2),
  27719. 2: uint8(m_ASCII_s2),
  27720. }
  27721. var _KW_no = [3]uint8{
  27722. 0: uint8(m_ASCII_n2),
  27723. 1: uint8(m_ASCII_o2),
  27724. }
  27725. 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) {
  27726. bp := tls.Alloc(16)
  27727. defer tls.Free(16)
  27728. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  27729. var c int32
  27730. var _ /* name at bp+8 */ uintptr
  27731. var _ /* nameEnd at bp+12 */ uintptr
  27732. var _ /* val at bp+4 */ uintptr
  27733. _ = c
  27734. *(*uintptr)(unsafe.Pointer(bp + 4)) = libc.UintptrFromInt32(0)
  27735. *(*uintptr)(unsafe.Pointer(bp + 8)) = libc.UintptrFromInt32(0)
  27736. *(*uintptr)(unsafe.Pointer(bp + 12)) = libc.UintptrFromInt32(0)
  27737. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(int32(5) * (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27738. end -= uintptr(int32(2) * (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27739. if !(_parsePseudoAttribute(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+8, bp+12, bp+4, bp) != 0) || !(*(*uintptr)(unsafe.Pointer(bp + 8)) != 0) {
  27740. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27741. return 0
  27742. }
  27743. 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 + 12)), uintptr(unsafe.Pointer(&_KW_version))) != 0) {
  27744. if !(isGeneralTextEntity != 0) {
  27745. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  27746. return 0
  27747. }
  27748. } else {
  27749. if versionPtr != 0 {
  27750. *(*uintptr)(unsafe.Pointer(versionPtr)) = *(*uintptr)(unsafe.Pointer(bp + 4))
  27751. }
  27752. if versionEndPtr != 0 {
  27753. *(*uintptr)(unsafe.Pointer(versionEndPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27754. }
  27755. if !(_parsePseudoAttribute(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+8, bp+12, bp+4, bp) != 0) {
  27756. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27757. return 0
  27758. }
  27759. if !(*(*uintptr)(unsafe.Pointer(bp + 8)) != 0) {
  27760. if isGeneralTextEntity != 0 {
  27761. /* a TextDecl must have an EncodingDecl */
  27762. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27763. return 0
  27764. }
  27765. return int32(1)
  27766. }
  27767. }
  27768. 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 + 12)), uintptr(unsafe.Pointer(&_KW_encoding))) != 0 {
  27769. c = _toAscii(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 4)), end)
  27770. if !(int32(m_ASCII_a2) <= c && c <= int32(m_ASCII_z1)) && !(int32(m_ASCII_A) <= c && c <= int32(m_ASCII_Z1)) {
  27771. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 4))
  27772. return 0
  27773. }
  27774. if encodingName != 0 {
  27775. *(*uintptr)(unsafe.Pointer(encodingName)) = *(*uintptr)(unsafe.Pointer(bp + 4))
  27776. }
  27777. if encoding != 0 {
  27778. *(*uintptr)(unsafe.Pointer(encoding)) = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{encodingFinder})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 4)), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  27779. }
  27780. if !(_parsePseudoAttribute(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+8, bp+12, bp+4, bp) != 0) {
  27781. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27782. return 0
  27783. }
  27784. if !(*(*uintptr)(unsafe.Pointer(bp + 8)) != 0) {
  27785. return int32(1)
  27786. }
  27787. }
  27788. 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 + 12)), uintptr(unsafe.Pointer(&_KW_standalone))) != 0) || isGeneralTextEntity != 0 {
  27789. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  27790. return 0
  27791. }
  27792. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 4)), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), uintptr(unsafe.Pointer(&_KW_yes))) != 0 {
  27793. if standalone != 0 {
  27794. *(*int32)(unsafe.Pointer(standalone)) = int32(1)
  27795. }
  27796. } else {
  27797. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 4)), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), uintptr(unsafe.Pointer(&_KW_no))) != 0 {
  27798. if standalone != 0 {
  27799. *(*int32)(unsafe.Pointer(standalone)) = 0
  27800. }
  27801. } else {
  27802. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 4))
  27803. return 0
  27804. }
  27805. }
  27806. for _isSpace(tls, _toAscii(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end)) != 0 {
  27807. *(*uintptr)(unsafe.Pointer(bp)) += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27808. }
  27809. if *(*uintptr)(unsafe.Pointer(bp)) != end {
  27810. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27811. return 0
  27812. }
  27813. return int32(1)
  27814. }
  27815. func _checkCharRefNumber(tls *libc.TLS, result int32) (r int32) {
  27816. switch result >> libc.Int32FromInt32(8) {
  27817. case int32(0xD8):
  27818. fallthrough
  27819. case int32(0xD9):
  27820. fallthrough
  27821. case int32(0xDA):
  27822. fallthrough
  27823. case int32(0xDB):
  27824. fallthrough
  27825. case int32(0xDC):
  27826. fallthrough
  27827. case int32(0xDD):
  27828. fallthrough
  27829. case int32(0xDE):
  27830. fallthrough
  27831. case int32(0xDF):
  27832. return -int32(1)
  27833. case 0:
  27834. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 72 + uintptr(result)))) == int32(_BT_NONXML) {
  27835. return -int32(1)
  27836. }
  27837. case int32(0xFF):
  27838. if result == int32(0xFFFE) || result == int32(0xFFFF) {
  27839. return -int32(1)
  27840. }
  27841. break
  27842. }
  27843. return result
  27844. }
  27845. func XXmlUtf8Encode(tls *libc.TLS, c int32, buf uintptr) (r int32) {
  27846. if c < 0 {
  27847. return 0
  27848. } /* LCOV_EXCL_LINE: this case is always eliminated beforehand */
  27849. if c < 128 {
  27850. *(*uint8)(unsafe.Pointer(buf)) = libc.Uint8FromInt32(c | int32(_UTF8_cval1))
  27851. return int32(1)
  27852. }
  27853. if c < 2048 {
  27854. *(*uint8)(unsafe.Pointer(buf)) = libc.Uint8FromInt32(c>>libc.Int32FromInt32(6) | int32(_UTF8_cval2))
  27855. *(*uint8)(unsafe.Pointer(buf + 1)) = libc.Uint8FromInt32(c&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27856. return int32(2)
  27857. }
  27858. if c < 65536 {
  27859. *(*uint8)(unsafe.Pointer(buf)) = libc.Uint8FromInt32(c>>libc.Int32FromInt32(12) | int32(_UTF8_cval3))
  27860. *(*uint8)(unsafe.Pointer(buf + 1)) = libc.Uint8FromInt32(c>>libc.Int32FromInt32(6)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27861. *(*uint8)(unsafe.Pointer(buf + 2)) = libc.Uint8FromInt32(c&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27862. return int32(3)
  27863. }
  27864. if c < int32(0x110000) {
  27865. *(*uint8)(unsafe.Pointer(buf)) = libc.Uint8FromInt32(c>>libc.Int32FromInt32(18) | int32(_UTF8_cval4))
  27866. *(*uint8)(unsafe.Pointer(buf + 1)) = libc.Uint8FromInt32(c>>libc.Int32FromInt32(12)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27867. *(*uint8)(unsafe.Pointer(buf + 2)) = libc.Uint8FromInt32(c>>libc.Int32FromInt32(6)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27868. *(*uint8)(unsafe.Pointer(buf + 3)) = libc.Uint8FromInt32(c&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27869. return int32(4)
  27870. }
  27871. return 0 /* LCOV_EXCL_LINE: this case too is eliminated before calling */
  27872. }
  27873. func XXmlUtf16Encode(tls *libc.TLS, charNum int32, buf uintptr) (r int32) {
  27874. if charNum < 0 {
  27875. return 0
  27876. }
  27877. if charNum < int32(0x10000) {
  27878. *(*uint16)(unsafe.Pointer(buf)) = libc.Uint16FromInt32(charNum)
  27879. return int32(1)
  27880. }
  27881. if charNum < int32(0x110000) {
  27882. charNum -= int32(0x10000)
  27883. *(*uint16)(unsafe.Pointer(buf)) = libc.Uint16FromInt32(charNum>>libc.Int32FromInt32(10) + libc.Int32FromInt32(0xD800))
  27884. *(*uint16)(unsafe.Pointer(buf + 1*2)) = libc.Uint16FromInt32(charNum&libc.Int32FromInt32(0x3FF) + libc.Int32FromInt32(0xDC00))
  27885. return int32(2)
  27886. }
  27887. return 0
  27888. }
  27889. type Tunknown_encoding = struct {
  27890. Fnormal Tnormal_encoding
  27891. Fconvert TCONVERTER
  27892. FuserData uintptr
  27893. Futf16 [256]uint16
  27894. Futf8 [256][4]uint8
  27895. }
  27896. func XXmlSizeOfUnknownEncoding(tls *libc.TLS) (r int32) {
  27897. return int32(1908)
  27898. }
  27899. func _unknown_isName(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  27900. var c int32
  27901. var uenc uintptr
  27902. _, _ = c, uenc
  27903. uenc = enc
  27904. 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)
  27905. if c & ^libc.Int32FromInt32(0xFFFF) != 0 {
  27906. return 0
  27907. }
  27908. 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))))
  27909. }
  27910. func _unknown_isNmstrt(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  27911. var c int32
  27912. var uenc uintptr
  27913. _, _ = c, uenc
  27914. uenc = enc
  27915. 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)
  27916. if c & ^libc.Int32FromInt32(0xFFFF) != 0 {
  27917. return 0
  27918. }
  27919. 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))))
  27920. }
  27921. func _unknown_isInvalid(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  27922. var c int32
  27923. var uenc uintptr
  27924. _, _ = c, uenc
  27925. uenc = enc
  27926. 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)
  27927. return libc.BoolInt32(c & ^libc.Int32FromInt32(0xFFFF) != 0 || _checkCharRefNumber(tls, c) < 0)
  27928. }
  27929. func _unknown_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  27930. bp := tls.Alloc(16)
  27931. defer tls.Free(16)
  27932. var c, n int32
  27933. var uenc, utf8, v2 uintptr
  27934. var _ /* buf at bp+0 */ [4]uint8
  27935. _, _, _, _, _ = c, n, uenc, utf8, v2
  27936. uenc = enc
  27937. for {
  27938. if *(*uintptr)(unsafe.Pointer(fromP)) == fromLim {
  27939. return int32(_XML_CONVERT_COMPLETED)
  27940. }
  27941. utf8 = uenc + 884 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)))))*4
  27942. v2 = utf8
  27943. utf8++
  27944. n = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v2)))
  27945. if n == 0 {
  27946. 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)))
  27947. n = XXmlUtf8Encode(tls, c, bp)
  27948. if n > int32(toLim)-int32(*(*uintptr)(unsafe.Pointer(toP))) {
  27949. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  27950. }
  27951. utf8 = bp
  27952. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)))))))) - (int32(_BT_LEAD2) - libc.Int32FromInt32(2)))
  27953. } else {
  27954. if n > int32(toLim)-int32(*(*uintptr)(unsafe.Pointer(toP))) {
  27955. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  27956. }
  27957. *(*uintptr)(unsafe.Pointer(fromP))++
  27958. }
  27959. libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(toP)), utf8, libc.Uint32FromInt32(n))
  27960. *(*uintptr)(unsafe.Pointer(toP)) += uintptr(n)
  27961. goto _1
  27962. _1:
  27963. }
  27964. return r
  27965. }
  27966. func _unknown_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  27967. var c uint16
  27968. var uenc, v1, v2 uintptr
  27969. _, _, _, _ = c, uenc, v1, v2
  27970. uenc = enc
  27971. for *(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim {
  27972. c = *(*uint16)(unsafe.Pointer(uenc + 372 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)))))*2))
  27973. if libc.Int32FromUint16(c) == 0 {
  27974. 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))))
  27975. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)))))))) - (int32(_BT_LEAD2) - libc.Int32FromInt32(2)))
  27976. } else {
  27977. *(*uintptr)(unsafe.Pointer(fromP))++
  27978. }
  27979. v2 = toP
  27980. v1 = *(*uintptr)(unsafe.Pointer(v2))
  27981. *(*uintptr)(unsafe.Pointer(v2)) += 2
  27982. *(*uint16)(unsafe.Pointer(v1)) = c
  27983. }
  27984. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  27985. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  27986. } else {
  27987. return int32(_XML_CONVERT_COMPLETED)
  27988. }
  27989. return r
  27990. }
  27991. func XXmlInitUnknownEncoding(tls *libc.TLS, mem uintptr, table uintptr, convert TCONVERTER, userData uintptr) (r uintptr) {
  27992. var c, i, v3 int32
  27993. var e uintptr
  27994. _, _, _, _ = c, e, i, v3
  27995. e = mem
  27996. libc.Xmemcpy(tls, mem, uintptr(unsafe.Pointer(&_latin1_encoding)), uint32(364))
  27997. i = 0
  27998. for {
  27999. if !(i < int32(128)) {
  28000. break
  28001. }
  28002. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 72 + uintptr(i)))) != int32(_BT_OTHER) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 72 + uintptr(i)))) != int32(_BT_NONXML) && *(*int32)(unsafe.Pointer(table + uintptr(i)*4)) != i {
  28003. return uintptr(0)
  28004. }
  28005. goto _1
  28006. _1:
  28007. ;
  28008. i++
  28009. }
  28010. i = 0
  28011. for {
  28012. if !(i < int32(256)) {
  28013. break
  28014. }
  28015. c = *(*int32)(unsafe.Pointer(table + uintptr(i)*4))
  28016. if c == -int32(1) {
  28017. *(*uint8)(unsafe.Pointer(e + 72 + uintptr(i))) = uint8(_BT_MALFORM)
  28018. /* This shouldn't really get used. */
  28019. *(*uint16)(unsafe.Pointer(e + 372 + uintptr(i)*2)) = uint16(0xFFFF)
  28020. *(*uint8)(unsafe.Pointer(e + 884 + uintptr(i)*4)) = uint8(1)
  28021. *(*uint8)(unsafe.Pointer(e + 884 + uintptr(i)*4 + 1)) = uint8(0)
  28022. } else {
  28023. if c < 0 {
  28024. if c < -int32(4) {
  28025. return uintptr(0)
  28026. }
  28027. /* Multi-byte sequences need a converter function */
  28028. if !(convert != 0) {
  28029. return uintptr(0)
  28030. }
  28031. *(*uint8)(unsafe.Pointer(e + 72 + uintptr(i))) = libc.Uint8FromInt32(int32(_BT_LEAD2) - (c + libc.Int32FromInt32(2)))
  28032. *(*uint8)(unsafe.Pointer(e + 884 + uintptr(i)*4)) = uint8(0)
  28033. *(*uint16)(unsafe.Pointer(e + 372 + uintptr(i)*2)) = uint16(0)
  28034. } else {
  28035. if c < int32(0x80) {
  28036. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 72 + uintptr(c)))) != int32(_BT_OTHER) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 72 + uintptr(c)))) != int32(_BT_NONXML) && c != i {
  28037. return uintptr(0)
  28038. }
  28039. *(*uint8)(unsafe.Pointer(e + 72 + uintptr(i))) = *(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 72 + uintptr(c)))
  28040. *(*uint8)(unsafe.Pointer(e + 884 + uintptr(i)*4)) = uint8(1)
  28041. *(*uint8)(unsafe.Pointer(e + 884 + uintptr(i)*4 + 1)) = libc.Uint8FromInt32(c)
  28042. if c == 0 {
  28043. v3 = int32(0xFFFF)
  28044. } else {
  28045. v3 = c
  28046. }
  28047. *(*uint16)(unsafe.Pointer(e + 372 + uintptr(i)*2)) = libc.Uint16FromInt32(v3)
  28048. } else {
  28049. if _checkCharRefNumber(tls, c) < 0 {
  28050. *(*uint8)(unsafe.Pointer(e + 72 + uintptr(i))) = uint8(_BT_NONXML)
  28051. /* This shouldn't really get used. */
  28052. *(*uint16)(unsafe.Pointer(e + 372 + uintptr(i)*2)) = uint16(0xFFFF)
  28053. *(*uint8)(unsafe.Pointer(e + 884 + uintptr(i)*4)) = uint8(1)
  28054. *(*uint8)(unsafe.Pointer(e + 884 + uintptr(i)*4 + 1)) = uint8(0)
  28055. } else {
  28056. if c > int32(0xFFFF) {
  28057. return uintptr(0)
  28058. }
  28059. if _namingBitmap[libc.Int32FromUint8(_nmstrtPages[c>>int32(8)])<<int32(3)+c&int32(0xff)>>int32(5)]&(uint32(1)<<(c&int32(0xff)&int32(0x1F))) != 0 {
  28060. *(*uint8)(unsafe.Pointer(e + 72 + uintptr(i))) = uint8(_BT_NMSTRT)
  28061. } else {
  28062. if _namingBitmap[libc.Int32FromUint8(_namePages[c>>int32(8)])<<int32(3)+c&int32(0xff)>>int32(5)]&(uint32(1)<<(c&int32(0xff)&int32(0x1F))) != 0 {
  28063. *(*uint8)(unsafe.Pointer(e + 72 + uintptr(i))) = uint8(_BT_NAME)
  28064. } else {
  28065. *(*uint8)(unsafe.Pointer(e + 72 + uintptr(i))) = uint8(_BT_OTHER)
  28066. }
  28067. }
  28068. *(*uint8)(unsafe.Pointer(e + 884 + uintptr(i)*4)) = libc.Uint8FromInt32(XXmlUtf8Encode(tls, c, e+884+uintptr(i)*4+uintptr(1)))
  28069. *(*uint16)(unsafe.Pointer(e + 372 + uintptr(i)*2)) = libc.Uint16FromInt32(c)
  28070. }
  28071. }
  28072. }
  28073. }
  28074. goto _2
  28075. _2:
  28076. ;
  28077. i++
  28078. }
  28079. (*Tunknown_encoding)(unsafe.Pointer(e)).FuserData = userData
  28080. (*Tunknown_encoding)(unsafe.Pointer(e)).Fconvert = convert
  28081. if convert != 0 {
  28082. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisName2 = __ccgo_fp(_unknown_isName)
  28083. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisName3 = __ccgo_fp(_unknown_isName)
  28084. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisName4 = __ccgo_fp(_unknown_isName)
  28085. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisNmstrt2 = __ccgo_fp(_unknown_isNmstrt)
  28086. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisNmstrt3 = __ccgo_fp(_unknown_isNmstrt)
  28087. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisNmstrt4 = __ccgo_fp(_unknown_isNmstrt)
  28088. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisInvalid2 = __ccgo_fp(_unknown_isInvalid)
  28089. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisInvalid3 = __ccgo_fp(_unknown_isInvalid)
  28090. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisInvalid4 = __ccgo_fp(_unknown_isInvalid)
  28091. }
  28092. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.Fenc.Futf8Convert = __ccgo_fp(_unknown_toUtf8)
  28093. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.Fenc.Futf16Convert = __ccgo_fp(_unknown_toUtf16)
  28094. return e
  28095. }
  28096. const _UNKNOWN_ENC = -1
  28097. const _ISO_8859_1_ENC = 0
  28098. const _US_ASCII_ENC = 1
  28099. const _UTF_8_ENC = 2
  28100. const _UTF_16_ENC = 3
  28101. const _UTF_16BE_ENC = 4
  28102. const _UTF_16LE_ENC = 5
  28103. const
  28104. /* must match encodingNames up to here */
  28105. _NO_ENC = 6
  28106. var _KW_ISO_8859_1 = [11]uint8{
  28107. 0: uint8(m_ASCII_I),
  28108. 1: uint8(m_ASCII_S),
  28109. 2: uint8(m_ASCII_O),
  28110. 3: uint8(m_ASCII_MINUS1),
  28111. 4: uint8(m_ASCII_82),
  28112. 5: uint8(m_ASCII_82),
  28113. 6: uint8(m_ASCII_51),
  28114. 7: uint8(m_ASCII_92),
  28115. 8: uint8(m_ASCII_MINUS1),
  28116. 9: uint8(m_ASCII_12),
  28117. }
  28118. var _KW_US_ASCII = [9]uint8{
  28119. 0: uint8(m_ASCII_U1),
  28120. 1: uint8(m_ASCII_S),
  28121. 2: uint8(m_ASCII_MINUS1),
  28122. 3: uint8(m_ASCII_A),
  28123. 4: uint8(m_ASCII_S),
  28124. 5: uint8(m_ASCII_C),
  28125. 6: uint8(m_ASCII_I),
  28126. 7: uint8(m_ASCII_I),
  28127. }
  28128. var _KW_UTF_8 = [6]uint8{
  28129. 0: uint8(m_ASCII_U1),
  28130. 1: uint8(m_ASCII_T),
  28131. 2: uint8(m_ASCII_F),
  28132. 3: uint8(m_ASCII_MINUS1),
  28133. 4: uint8(m_ASCII_82),
  28134. }
  28135. var _KW_UTF_16 = [7]uint8{
  28136. 0: uint8(m_ASCII_U1),
  28137. 1: uint8(m_ASCII_T),
  28138. 2: uint8(m_ASCII_F),
  28139. 3: uint8(m_ASCII_MINUS1),
  28140. 4: uint8(m_ASCII_12),
  28141. 5: uint8(m_ASCII_61),
  28142. }
  28143. var _KW_UTF_16BE = [9]uint8{
  28144. 0: uint8(m_ASCII_U1),
  28145. 1: uint8(m_ASCII_T),
  28146. 2: uint8(m_ASCII_F),
  28147. 3: uint8(m_ASCII_MINUS1),
  28148. 4: uint8(m_ASCII_12),
  28149. 5: uint8(m_ASCII_61),
  28150. 6: uint8(m_ASCII_B1),
  28151. 7: uint8(m_ASCII_E),
  28152. }
  28153. var _KW_UTF_16LE = [9]uint8{
  28154. 0: uint8(m_ASCII_U1),
  28155. 1: uint8(m_ASCII_T),
  28156. 2: uint8(m_ASCII_F),
  28157. 3: uint8(m_ASCII_MINUS1),
  28158. 4: uint8(m_ASCII_12),
  28159. 5: uint8(m_ASCII_61),
  28160. 6: uint8(m_ASCII_L),
  28161. 7: uint8(m_ASCII_E),
  28162. }
  28163. func _getEncodingIndex(tls *libc.TLS, name uintptr) (r int32) {
  28164. var i int32
  28165. _ = i
  28166. if name == libc.UintptrFromInt32(0) {
  28167. return int32(_NO_ENC)
  28168. }
  28169. i = 0
  28170. for {
  28171. if !(i < libc.Int32FromUint32(libc.Uint32FromInt64(24)/libc.Uint32FromInt64(4))) {
  28172. break
  28173. }
  28174. if _streqci(tls, name, _encodingNames[i]) != 0 {
  28175. return i
  28176. }
  28177. goto _1
  28178. _1:
  28179. ;
  28180. i++
  28181. }
  28182. return int32(_UNKNOWN_ENC)
  28183. }
  28184. var _encodingNames = [6]uintptr{
  28185. 0: uintptr(unsafe.Pointer(&_KW_ISO_8859_1)),
  28186. 1: uintptr(unsafe.Pointer(&_KW_US_ASCII)),
  28187. 2: uintptr(unsafe.Pointer(&_KW_UTF_8)),
  28188. 3: uintptr(unsafe.Pointer(&_KW_UTF_16)),
  28189. 4: uintptr(unsafe.Pointer(&_KW_UTF_16BE)),
  28190. 5: uintptr(unsafe.Pointer(&_KW_UTF_16LE)),
  28191. }
  28192. /* For binary compatibility, we store the index of the encoding
  28193. specified at initialization in the isUtf16 member.
  28194. */
  28195. /* This is what detects the encoding. encodingTable maps from
  28196. encoding indices to encodings; INIT_ENC_INDEX(enc) is the index of
  28197. the external (protocol) specified encoding; state is
  28198. XML_CONTENT_STATE if we're parsing an external text entity, and
  28199. XML_PROLOG_STATE otherwise.
  28200. */
  28201. func _initScan(tls *libc.TLS, encodingTable uintptr, enc uintptr, state int32, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28202. var e int32
  28203. var encPtr uintptr
  28204. _, _ = e, encPtr
  28205. if ptr >= end {
  28206. return -int32(4)
  28207. }
  28208. encPtr = (*TINIT_ENCODING)(unsafe.Pointer(enc)).FencPtr
  28209. if ptr+uintptr(1) == end {
  28210. /* only a single byte available for auto-detection */
  28211. /* so we're parsing an external text entity... */
  28212. /* if UTF-16 was externally specified, then we need at least 2 bytes */
  28213. switch libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) {
  28214. case int32(_UTF_16_ENC):
  28215. fallthrough
  28216. case int32(_UTF_16LE_ENC):
  28217. fallthrough
  28218. case int32(_UTF_16BE_ENC):
  28219. return -int32(1)
  28220. }
  28221. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  28222. case int32(0xFE):
  28223. fallthrough
  28224. case int32(0xFF):
  28225. fallthrough
  28226. case int32(0xEF): /* possibly first byte of UTF-8 BOM */
  28227. if libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_ISO_8859_1_ENC) && state == int32(m_XML_CONTENT_STATE) {
  28228. break
  28229. }
  28230. /* fall through */
  28231. fallthrough
  28232. case 0x00:
  28233. fallthrough
  28234. case int32(0x3C):
  28235. return -int32(1)
  28236. }
  28237. } else {
  28238. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))<<libc.Int32FromInt32(8) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) {
  28239. case int32(0xFEFF):
  28240. if libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_ISO_8859_1_ENC) && state == int32(m_XML_CONTENT_STATE) {
  28241. break
  28242. }
  28243. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  28244. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16BE_ENC)*4))
  28245. return int32(m_XML_TOK_BOM)
  28246. /* 00 3C is handled in the default case */
  28247. fallthrough
  28248. case int32(0x3C00):
  28249. if (libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_UTF_16BE_ENC) || libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_UTF_16_ENC)) && state == int32(m_XML_CONTENT_STATE) {
  28250. break
  28251. }
  28252. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16LE_ENC)*4))
  28253. return (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(encPtr)) + uintptr(state)*4))})))(tls, *(*uintptr)(unsafe.Pointer(encPtr)), ptr, end, nextTokPtr)
  28254. case int32(0xFFFE):
  28255. if libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_ISO_8859_1_ENC) && state == int32(m_XML_CONTENT_STATE) {
  28256. break
  28257. }
  28258. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  28259. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16LE_ENC)*4))
  28260. return int32(m_XML_TOK_BOM)
  28261. case int32(0xEFBB):
  28262. /* Maybe a UTF-8 BOM (EF BB BF) */
  28263. /* If there's an explicitly specified (external) encoding
  28264. of ISO-8859-1 or some flavour of UTF-16
  28265. and this is an external text entity,
  28266. don't look for the BOM,
  28267. because it might be a legal data.
  28268. */
  28269. if state == int32(m_XML_CONTENT_STATE) {
  28270. e = libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16)
  28271. if e == int32(_ISO_8859_1_ENC) || e == int32(_UTF_16BE_ENC) || e == int32(_UTF_16LE_ENC) || e == int32(_UTF_16_ENC) {
  28272. break
  28273. }
  28274. }
  28275. if ptr+uintptr(2) == end {
  28276. return -int32(1)
  28277. }
  28278. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 2))) == int32(0xBF) {
  28279. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(3)
  28280. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_8_ENC)*4))
  28281. return int32(m_XML_TOK_BOM)
  28282. }
  28283. default:
  28284. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32('\000') {
  28285. /* 0 isn't a legal data character. Furthermore a document
  28286. entity can only start with ASCII characters. So the only
  28287. way this can fail to be big-endian UTF-16 if it it's an
  28288. external parsed general entity that's labelled as
  28289. UTF-16LE.
  28290. */
  28291. if state == int32(m_XML_CONTENT_STATE) && libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_UTF_16LE_ENC) {
  28292. break
  28293. }
  28294. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16BE_ENC)*4))
  28295. return (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(encPtr)) + uintptr(state)*4))})))(tls, *(*uintptr)(unsafe.Pointer(encPtr)), ptr, end, nextTokPtr)
  28296. } else {
  28297. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32('\000') {
  28298. /* We could recover here in the case:
  28299. - parsing an external entity
  28300. - second byte is 0
  28301. - no externally specified encoding
  28302. - no encoding declaration
  28303. by assuming UTF-16LE. But we don't, because this would mean when
  28304. presented just with a single byte, we couldn't reliably determine
  28305. whether we needed further bytes.
  28306. */
  28307. if state == int32(m_XML_CONTENT_STATE) {
  28308. break
  28309. }
  28310. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16LE_ENC)*4))
  28311. return (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(encPtr)) + uintptr(state)*4))})))(tls, *(*uintptr)(unsafe.Pointer(encPtr)), ptr, end, nextTokPtr)
  28312. }
  28313. }
  28314. break
  28315. }
  28316. }
  28317. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16))*4))
  28318. return (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(encPtr)) + uintptr(state)*4))})))(tls, *(*uintptr)(unsafe.Pointer(encPtr)), ptr, end, nextTokPtr)
  28319. }
  28320. /* This file is included!
  28321. __ __ _
  28322. ___\ \/ /_ __ __ _| |_
  28323. / _ \\ /| '_ \ / _` | __|
  28324. | __// \| |_) | (_| | |_
  28325. \___/_/\_\ .__/ \__,_|\__|
  28326. |_| XML parser
  28327. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  28328. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  28329. Copyright (c) 2002 Greg Stein <gstein@users.sourceforge.net>
  28330. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  28331. Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
  28332. Copyright (c) 2017-2021 Sebastian Pipping <sebastian@pipping.org>
  28333. Licensed under the MIT license:
  28334. Permission is hereby granted, free of charge, to any person obtaining
  28335. a copy of this software and associated documentation files (the
  28336. "Software"), to deal in the Software without restriction, including
  28337. without limitation the rights to use, copy, modify, merge, publish,
  28338. distribute, sublicense, and/or sell copies of the Software, and to permit
  28339. persons to whom the Software is furnished to do so, subject to the
  28340. following conditions:
  28341. The above copyright notice and this permission notice shall be included
  28342. in all copies or substantial portions of the Software.
  28343. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  28344. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  28345. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  28346. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  28347. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  28348. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  28349. USE OR OTHER DEALINGS IN THE SOFTWARE.
  28350. */
  28351. func XXmlGetUtf8InternalEncoding(tls *libc.TLS) (r uintptr) {
  28352. return uintptr(unsafe.Pointer(&_internal_utf8_encoding))
  28353. }
  28354. func XXmlGetUtf16InternalEncoding(tls *libc.TLS) (r uintptr) {
  28355. return uintptr(unsafe.Pointer(&_internal_little2_encoding))
  28356. }
  28357. var _encodings = [7]uintptr{
  28358. 0: uintptr(unsafe.Pointer(&_latin1_encoding)),
  28359. 1: uintptr(unsafe.Pointer(&_ascii_encoding)),
  28360. 2: uintptr(unsafe.Pointer(&_utf8_encoding)),
  28361. 3: uintptr(unsafe.Pointer(&_big2_encoding)),
  28362. 4: uintptr(unsafe.Pointer(&_big2_encoding)),
  28363. 5: uintptr(unsafe.Pointer(&_little2_encoding)),
  28364. 6: uintptr(unsafe.Pointer(&_utf8_encoding)),
  28365. }
  28366. func _initScanProlog(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28367. return _initScan(tls, uintptr(unsafe.Pointer(&_encodings)), enc, m_XML_PROLOG_STATE, ptr, end, nextTokPtr)
  28368. }
  28369. func _initScanContent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28370. return _initScan(tls, uintptr(unsafe.Pointer(&_encodings)), enc, int32(m_XML_CONTENT_STATE), ptr, end, nextTokPtr)
  28371. }
  28372. func XXmlInitEncoding(tls *libc.TLS, p uintptr, encPtr uintptr, name uintptr) (r int32) {
  28373. var i int32
  28374. _ = i
  28375. i = _getEncodingIndex(tls, name)
  28376. if i == int32(_UNKNOWN_ENC) {
  28377. return 0
  28378. }
  28379. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FisUtf16 = libc.Uint8FromInt32(i)
  28380. *(*TSCANNER)(unsafe.Pointer(p)) = __ccgo_fp(_initScanProlog)
  28381. *(*TSCANNER)(unsafe.Pointer(p + 1*4)) = __ccgo_fp(_initScanContent)
  28382. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FupdatePosition = __ccgo_fp(_initUpdatePosition)
  28383. (*TINIT_ENCODING)(unsafe.Pointer(p)).FencPtr = encPtr
  28384. *(*uintptr)(unsafe.Pointer(encPtr)) = p
  28385. return int32(1)
  28386. }
  28387. func _findEncoding(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr) (r uintptr) {
  28388. bp := tls.Alloc(144)
  28389. defer tls.Free(144)
  28390. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  28391. var i int32
  28392. var _ /* buf at bp+4 */ [128]uint8
  28393. var _ /* p at bp+132 */ uintptr
  28394. _ = i
  28395. *(*[128]uint8)(unsafe.Pointer(bp + 4)) = [128]uint8{}
  28396. *(*uintptr)(unsafe.Pointer(bp + 132)) = bp + 4
  28397. (*(*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+132, *(*uintptr)(unsafe.Pointer(bp + 132))+uintptr(m_ENCODING_MAX)-uintptr(1))
  28398. if *(*uintptr)(unsafe.Pointer(bp)) != end {
  28399. return uintptr(0)
  28400. }
  28401. *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 132)))) = uint8(0)
  28402. if _streqci(tls, bp+4, uintptr(unsafe.Pointer(&_KW_UTF_16))) != 0 && (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar == int32(2) {
  28403. return enc
  28404. }
  28405. i = _getEncodingIndex(tls, bp+4)
  28406. if i == int32(_UNKNOWN_ENC) {
  28407. return uintptr(0)
  28408. }
  28409. return _encodings[i]
  28410. }
  28411. 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) {
  28412. return _doParseXmlDecl(tls, __ccgo_fp(_findEncoding), isGeneralTextEntity, enc, ptr, end, badPtr, versionPtr, versionEndPtr, encodingName, encoding, standalone)
  28413. }
  28414. /* This file is included!
  28415. __ __ _
  28416. ___\ \/ /_ __ __ _| |_
  28417. / _ \\ /| '_ \ / _` | __|
  28418. | __// \| |_) | (_| | |_
  28419. \___/_/\_\ .__/ \__,_|\__|
  28420. |_| XML parser
  28421. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  28422. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  28423. Copyright (c) 2002 Greg Stein <gstein@users.sourceforge.net>
  28424. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  28425. Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
  28426. Copyright (c) 2017-2021 Sebastian Pipping <sebastian@pipping.org>
  28427. Licensed under the MIT license:
  28428. Permission is hereby granted, free of charge, to any person obtaining
  28429. a copy of this software and associated documentation files (the
  28430. "Software"), to deal in the Software without restriction, including
  28431. without limitation the rights to use, copy, modify, merge, publish,
  28432. distribute, sublicense, and/or sell copies of the Software, and to permit
  28433. persons to whom the Software is furnished to do so, subject to the
  28434. following conditions:
  28435. The above copyright notice and this permission notice shall be included
  28436. in all copies or substantial portions of the Software.
  28437. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  28438. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  28439. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  28440. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  28441. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  28442. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  28443. USE OR OTHER DEALINGS IN THE SOFTWARE.
  28444. */
  28445. func XXmlGetUtf8InternalEncodingNS(tls *libc.TLS) (r uintptr) {
  28446. return uintptr(unsafe.Pointer(&_internal_utf8_encoding_ns))
  28447. }
  28448. func XXmlGetUtf16InternalEncodingNS(tls *libc.TLS) (r uintptr) {
  28449. return uintptr(unsafe.Pointer(&_internal_little2_encoding_ns))
  28450. }
  28451. var _encodingsNS = [7]uintptr{
  28452. 0: uintptr(unsafe.Pointer(&_latin1_encoding_ns)),
  28453. 1: uintptr(unsafe.Pointer(&_ascii_encoding_ns)),
  28454. 2: uintptr(unsafe.Pointer(&_utf8_encoding_ns)),
  28455. 3: uintptr(unsafe.Pointer(&_big2_encoding_ns)),
  28456. 4: uintptr(unsafe.Pointer(&_big2_encoding_ns)),
  28457. 5: uintptr(unsafe.Pointer(&_little2_encoding_ns)),
  28458. 6: uintptr(unsafe.Pointer(&_utf8_encoding_ns)),
  28459. }
  28460. func _initScanPrologNS(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28461. return _initScan(tls, uintptr(unsafe.Pointer(&_encodingsNS)), enc, m_XML_PROLOG_STATE, ptr, end, nextTokPtr)
  28462. }
  28463. func _initScanContentNS(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28464. return _initScan(tls, uintptr(unsafe.Pointer(&_encodingsNS)), enc, int32(m_XML_CONTENT_STATE), ptr, end, nextTokPtr)
  28465. }
  28466. func XXmlInitEncodingNS(tls *libc.TLS, p uintptr, encPtr uintptr, name uintptr) (r int32) {
  28467. var i int32
  28468. _ = i
  28469. i = _getEncodingIndex(tls, name)
  28470. if i == int32(_UNKNOWN_ENC) {
  28471. return 0
  28472. }
  28473. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FisUtf16 = libc.Uint8FromInt32(i)
  28474. *(*TSCANNER)(unsafe.Pointer(p)) = __ccgo_fp(_initScanPrologNS)
  28475. *(*TSCANNER)(unsafe.Pointer(p + 1*4)) = __ccgo_fp(_initScanContentNS)
  28476. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FupdatePosition = __ccgo_fp(_initUpdatePosition)
  28477. (*TINIT_ENCODING)(unsafe.Pointer(p)).FencPtr = encPtr
  28478. *(*uintptr)(unsafe.Pointer(encPtr)) = p
  28479. return int32(1)
  28480. }
  28481. func _findEncodingNS(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr) (r uintptr) {
  28482. bp := tls.Alloc(144)
  28483. defer tls.Free(144)
  28484. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  28485. var i int32
  28486. var _ /* buf at bp+4 */ [128]uint8
  28487. var _ /* p at bp+132 */ uintptr
  28488. _ = i
  28489. *(*[128]uint8)(unsafe.Pointer(bp + 4)) = [128]uint8{}
  28490. *(*uintptr)(unsafe.Pointer(bp + 132)) = bp + 4
  28491. (*(*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+132, *(*uintptr)(unsafe.Pointer(bp + 132))+uintptr(m_ENCODING_MAX)-uintptr(1))
  28492. if *(*uintptr)(unsafe.Pointer(bp)) != end {
  28493. return uintptr(0)
  28494. }
  28495. *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 132)))) = uint8(0)
  28496. if _streqci(tls, bp+4, uintptr(unsafe.Pointer(&_KW_UTF_16))) != 0 && (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar == int32(2) {
  28497. return enc
  28498. }
  28499. i = _getEncodingIndex(tls, bp+4)
  28500. if i == int32(_UNKNOWN_ENC) {
  28501. return uintptr(0)
  28502. }
  28503. return _encodingsNS[i]
  28504. }
  28505. 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) {
  28506. return _doParseXmlDecl(tls, __ccgo_fp(_findEncodingNS), isGeneralTextEntity, enc, ptr, end, badPtr, versionPtr, versionEndPtr, encodingName, encoding, standalone)
  28507. }
  28508. func XXmlInitUnknownEncodingNS(tls *libc.TLS, mem uintptr, table uintptr, convert TCONVERTER, userData uintptr) (r uintptr) {
  28509. var enc uintptr
  28510. _ = enc
  28511. enc = XXmlInitUnknownEncoding(tls, mem, table, convert, userData)
  28512. if enc != 0 {
  28513. *(*uint8)(unsafe.Pointer(enc + 72 + 58)) = uint8(_BT_COLON)
  28514. }
  28515. return enc
  28516. }
  28517. func __ccgo_fp(f interface{}) uintptr {
  28518. type iface [2]uintptr
  28519. return (*iface)(unsafe.Pointer(&f))[1]
  28520. }
  28521. var __ccgo_ts = (*reflect.StringHeader)(unsafe.Pointer(&__ccgo_ts1)).Data
  28522. 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 (+%6d 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"