ccgo_darwin_amd64.go 1.1 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285
  1. // Code generated for darwin/amd64 by 'generator --prefix-enumerator=_ --prefix-external=x_ --prefix-field=F --prefix-macro=m_ --prefix-static-internal=_ --prefix-static-none=_ --prefix-tagged-enum=_ --prefix-tagged-struct=T --prefix-tagged-union=T --prefix-typename=T --prefix-undefined=_ -I /Users/jnml/src/modernc.org/builder/.exclude/modernc.org/libbsd/include/darwin/amd64 -extended-errors -ignore-unsupported-alignment -ignore-link-errors -lbsd -o libexpat.go --package-name libexpat lib/.libs/libexpat.a', DO NOT EDIT.
  2. //go:build darwin && amd64
  3. package libexpat
  4. import (
  5. "reflect"
  6. "unsafe"
  7. "modernc.org/libc"
  8. )
  9. var _ reflect.Type
  10. var _ unsafe.Pointer
  11. const m_ACCESSX_MAX_DESCRIPTORS = 100
  12. const m_ASCII_0 = 48
  13. const m_ASCII_1 = 49
  14. const m_ASCII_2 = 50
  15. const m_ASCII_3 = 51
  16. const m_ASCII_4 = 0x34
  17. const m_ASCII_5 = 0x35
  18. const m_ASCII_6 = 0x36
  19. const m_ASCII_7 = 0x37
  20. const m_ASCII_8 = 56
  21. const m_ASCII_9 = 57
  22. const m_ASCII_A = 65
  23. const m_ASCII_AMP = 0x26
  24. const m_ASCII_APOS = 0x27
  25. const m_ASCII_B = 0x42
  26. const m_ASCII_C = 67
  27. const m_ASCII_COLON = 58
  28. const m_ASCII_COMMA = 44
  29. const m_ASCII_D = 68
  30. const m_ASCII_E = 69
  31. const m_ASCII_EQUALS = 61
  32. const m_ASCII_EXCL = 33
  33. const m_ASCII_F = 70
  34. const m_ASCII_FF = 12
  35. const m_ASCII_G = 0x47
  36. const m_ASCII_GT = 0x3E
  37. const m_ASCII_H = 0x48
  38. const m_ASCII_HASH = 35
  39. const m_ASCII_I = 73
  40. const m_ASCII_J = 0x4A
  41. const m_ASCII_K = 75
  42. const m_ASCII_L = 76
  43. const m_ASCII_LPAREN = 40
  44. const m_ASCII_LSQB = 0x5B
  45. const m_ASCII_LT = 0x3C
  46. const m_ASCII_M = 77
  47. const m_ASCII_MINUS = 0x2D
  48. const m_ASCII_N = 78
  49. const m_ASCII_O = 79
  50. const m_ASCII_P = 0x50
  51. const m_ASCII_PERIOD = 46
  52. const m_ASCII_PIPE = 124
  53. const m_ASCII_Q = 0x51
  54. const m_ASCII_QUOT = 0x22
  55. const m_ASCII_R = 82
  56. const m_ASCII_RPAREN = 41
  57. const m_ASCII_RSQB = 0x5D
  58. const m_ASCII_S = 83
  59. const m_ASCII_SEMI = 0x3B
  60. const m_ASCII_SLASH = 47
  61. const m_ASCII_SPACE = 0x20
  62. const m_ASCII_T = 84
  63. const m_ASCII_TAB = 0x09
  64. const m_ASCII_U = 0x55
  65. const m_ASCII_UNDERSCORE = 0x5F
  66. const m_ASCII_V = 0x56
  67. const m_ASCII_W = 0x57
  68. const m_ASCII_X = 88
  69. const m_ASCII_Y = 89
  70. const m_ASCII_Z = 0x5A
  71. const m_ASCII_a = 97
  72. const m_ASCII_b = 0x62
  73. const m_ASCII_c = 99
  74. const m_ASCII_d = 0x64
  75. const m_ASCII_e = 101
  76. const m_ASCII_f = 0x66
  77. const m_ASCII_g = 103
  78. const m_ASCII_h = 104
  79. const m_ASCII_i = 0x69
  80. const m_ASCII_j = 0x6A
  81. const m_ASCII_k = 0x6B
  82. const m_ASCII_l = 108
  83. const m_ASCII_m = 109
  84. const m_ASCII_n = 110
  85. const m_ASCII_o = 111
  86. const m_ASCII_p = 112
  87. const m_ASCII_q = 0x71
  88. const m_ASCII_r = 114
  89. const m_ASCII_s = 115
  90. const m_ASCII_t = 116
  91. const m_ASCII_u = 0x75
  92. const m_ASCII_v = 0x76
  93. const m_ASCII_w = 119
  94. const m_ASCII_x = 120
  95. const m_ASCII_y = 0x79
  96. const m_ASCII_z = 0x7A
  97. const m_ATTRIBUTION_NAME_MAX = 255
  98. const m_AT_EACCESS = 0x0010
  99. const m_AT_FDONLY = 0x0400
  100. const m_AT_REALDEV = 0x0200
  101. const m_AT_REMOVEDIR = 0x0080
  102. const m_AT_SYMLINK_FOLLOW = 0x0040
  103. const m_AT_SYMLINK_NOFOLLOW = 0x0020
  104. const m_AT_SYMLINK_NOFOLLOW_ANY = 0x0800
  105. const m_BADSIG = "SIG_ERR"
  106. const m_BC_BASE_MAX = 99
  107. const m_BC_DIM_MAX = 2048
  108. const m_BC_SCALE_MAX = 99
  109. const m_BC_STRING_MAX = 1000
  110. const m_BIG_ENDIAN = "__DARWIN_BIG_ENDIAN"
  111. const m_BUFSIZ = 1024
  112. const m_BUS_ADRALN = 1
  113. const m_BUS_ADRERR = 2
  114. const m_BUS_NOOP = 0
  115. const m_BUS_OBJERR = 3
  116. const m_BYTEORDER = 1234
  117. const m_BYTE_ORDER = "__DARWIN_BYTE_ORDER"
  118. const m_CHARCLASS_NAME_MAX = 14
  119. const m_CHILD_MAX = 266
  120. const m_CLD_CONTINUED = 6
  121. const m_CLD_DUMPED = 3
  122. const m_CLD_EXITED = 1
  123. const m_CLD_KILLED = 2
  124. const m_CLD_NOOP = 0
  125. const m_CLD_STOPPED = 5
  126. const m_CLD_TRAPPED = 4
  127. const m_CLOCK_MONOTONIC = "_CLOCK_MONOTONIC"
  128. const m_CLOCK_MONOTONIC_RAW = "_CLOCK_MONOTONIC_RAW"
  129. const m_CLOCK_MONOTONIC_RAW_APPROX = "_CLOCK_MONOTONIC_RAW_APPROX"
  130. const m_CLOCK_PROCESS_CPUTIME_ID = "_CLOCK_PROCESS_CPUTIME_ID"
  131. const m_CLOCK_REALTIME = "_CLOCK_REALTIME"
  132. const m_CLOCK_THREAD_CPUTIME_ID = "_CLOCK_THREAD_CPUTIME_ID"
  133. const m_CLOCK_UPTIME_RAW = "_CLOCK_UPTIME_RAW"
  134. const m_CLOCK_UPTIME_RAW_APPROX = "_CLOCK_UPTIME_RAW_APPROX"
  135. const m_COLL_WEIGHTS_MAX = 2
  136. const m_CPF_IGNORE_MODE = 0x0002
  137. const m_CPF_OVERWRITE = 0x0001
  138. const m_CPUMON_MAKE_FATAL = 0x1000
  139. const m_DOMAIN = 1
  140. const m_DST_AUST = 2
  141. const m_DST_CAN = 6
  142. const m_DST_EET = 5
  143. const m_DST_MET = 4
  144. const m_DST_NONE = 0
  145. const m_DST_USA = 1
  146. const m_DST_WET = 3
  147. const m_E2BIG = 7
  148. const m_EACCES = 13
  149. const m_EADDRINUSE = 48
  150. const m_EADDRNOTAVAIL = 49
  151. const m_EAFNOSUPPORT = 47
  152. const m_EAGAIN = 35
  153. const m_EALREADY = 37
  154. const m_EAUTH = 80
  155. const m_EBADARCH = 86
  156. const m_EBADEXEC = 85
  157. const m_EBADF = 9
  158. const m_EBADMACHO = 88
  159. const m_EBADMSG = 94
  160. const m_EBADRPC = 72
  161. const m_EBUSY = 16
  162. const m_ECANCELED = 89
  163. const m_ECHILD = 10
  164. const m_ECONNABORTED = 53
  165. const m_ECONNREFUSED = 61
  166. const m_ECONNRESET = 54
  167. const m_EDEADLK = 11
  168. const m_EDESTADDRREQ = 39
  169. const m_EDEVERR = 83
  170. const m_EDOM = 33
  171. const m_EDQUOT = 69
  172. const m_EEXIST = 17
  173. const m_EFAULT = 14
  174. const m_EFBIG = 27
  175. const m_EFTYPE = 79
  176. const m_EHOSTDOWN = 64
  177. const m_EHOSTUNREACH = 65
  178. const m_EIDRM = 90
  179. const m_EILSEQ = 92
  180. const m_EINPROGRESS = 36
  181. const m_EINTR = 4
  182. const m_EINVAL = 22
  183. const m_EIO = 5
  184. const m_EISCONN = 56
  185. const m_EISDIR = 21
  186. const m_ELAST = 106
  187. const m_ELOOP = 62
  188. const m_EMFILE = 24
  189. const m_EMLINK = 31
  190. const m_EMSGSIZE = 40
  191. const m_EMULTIHOP = 95
  192. const m_ENAMETOOLONG = 63
  193. const m_ENEEDAUTH = 81
  194. const m_ENETDOWN = 50
  195. const m_ENETRESET = 52
  196. const m_ENETUNREACH = 51
  197. const m_ENFILE = 23
  198. const m_ENOATTR = 93
  199. const m_ENOBUFS = 55
  200. const m_ENODATA = 96
  201. const m_ENODEV = 19
  202. const m_ENOENT = 2
  203. const m_ENOEXEC = 8
  204. const m_ENOLCK = 77
  205. const m_ENOLINK = 97
  206. const m_ENOMEM = 12
  207. const m_ENOMSG = 91
  208. const m_ENOPOLICY = 103
  209. const m_ENOPROTOOPT = 42
  210. const m_ENOSPC = 28
  211. const m_ENOSR = 98
  212. const m_ENOSTR = 99
  213. const m_ENOSYS = 78
  214. const m_ENOTBLK = 15
  215. const m_ENOTCONN = 57
  216. const m_ENOTDIR = 20
  217. const m_ENOTEMPTY = 66
  218. const m_ENOTRECOVERABLE = 104
  219. const m_ENOTSOCK = 38
  220. const m_ENOTSUP = 45
  221. const m_ENOTTY = 25
  222. const m_ENXIO = 6
  223. const m_EOPNOTSUPP = 102
  224. const m_EOVERFLOW = 84
  225. const m_EOWNERDEAD = 105
  226. const m_EPERM = 1
  227. const m_EPFNOSUPPORT = 46
  228. const m_EPIPE = 32
  229. const m_EPROCLIM = 67
  230. const m_EPROCUNAVAIL = 76
  231. const m_EPROGMISMATCH = 75
  232. const m_EPROGUNAVAIL = 74
  233. const m_EPROTO = 100
  234. const m_EPROTONOSUPPORT = 43
  235. const m_EPROTOTYPE = 41
  236. const m_EPWROFF = 82
  237. const m_EQFULL = 106
  238. const m_EQUIV_CLASS_MAX = 2
  239. const m_ERANGE = 34
  240. const m_EREMOTE = 71
  241. const m_EROFS = 30
  242. const m_ERPCMISMATCH = 73
  243. const m_ESHLIBVERS = 87
  244. const m_ESHUTDOWN = 58
  245. const m_ESOCKTNOSUPPORT = 44
  246. const m_ESPIPE = 29
  247. const m_ESRCH = 3
  248. const m_ESTALE = 70
  249. const m_ETIME = 101
  250. const m_ETIMEDOUT = 60
  251. const m_ETOOMANYREFS = 59
  252. const m_ETXTBSY = 26
  253. const m_EUSERS = 68
  254. const m_EWOULDBLOCK = "EAGAIN"
  255. const m_EXDEV = 18
  256. const m_EXIT_FAILURE = 1
  257. const m_EXIT_SUCCESS = 0
  258. const m_EXPAND_SPARE = 24
  259. const m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT = 8388608
  260. const m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT = 100
  261. const m_EXPAT_CONFIG_H = 1
  262. const m_EXPR_NEST_MAX = 32
  263. const m_Expat_External_INCLUDED = 1
  264. const m_Expat_INCLUDED = 1
  265. const m_FAPPEND = "O_APPEND"
  266. const m_FASYNC = "O_ASYNC"
  267. const m_FCNTL_FS_SPECIFIC_BASE = 0x00010000
  268. const m_FD_CLOEXEC = 1
  269. const m_FD_SETSIZE = "__DARWIN_FD_SETSIZE"
  270. const m_FFDSYNC = "O_DSYNC"
  271. const m_FFSYNC = "O_FSYNC"
  272. const m_FILENAME_MAX = 1024
  273. const m_FILESEC_GUID = "FILESEC_UUID"
  274. const m_FNDELAY = "O_NONBLOCK"
  275. const m_FNONBLOCK = "O_NONBLOCK"
  276. const m_FOOTPRINT_INTERVAL_RESET = 0x1
  277. const m_FOPEN_MAX = 20
  278. const m_FPE_FLTDIV = 1
  279. const m_FPE_FLTINV = 5
  280. const m_FPE_FLTOVF = 2
  281. const m_FPE_FLTRES = 4
  282. const m_FPE_FLTSUB = 6
  283. const m_FPE_FLTUND = 3
  284. const m_FPE_INTDIV = 7
  285. const m_FPE_INTOVF = 8
  286. const m_FPE_NOOP = 0
  287. const m_FP_CHOP = 3
  288. const m_FP_INFINITE = 2
  289. const m_FP_NAN = 1
  290. const m_FP_NORMAL = 4
  291. const m_FP_PREC_24B = 0
  292. const m_FP_PREC_53B = 2
  293. const m_FP_PREC_64B = 3
  294. const m_FP_QNAN = "FP_NAN"
  295. const m_FP_RND_DOWN = 1
  296. const m_FP_RND_NEAR = 0
  297. const m_FP_RND_UP = 2
  298. const m_FP_SNAN = "FP_NAN"
  299. const m_FP_STATE_BYTES = 512
  300. const m_FP_SUBNORMAL = 5
  301. const m_FP_SUPERNORMAL = 6
  302. const m_FP_ZERO = 3
  303. const m_FREAD = 0x00000001
  304. const m_FWRITE = 0x00000002
  305. const m_F_ADDFILESIGS = 61
  306. const m_F_ADDFILESIGS_FOR_DYLD_SIM = 83
  307. const m_F_ADDFILESIGS_INFO = 103
  308. const m_F_ADDFILESIGS_RETURN = 97
  309. const m_F_ADDFILESUPPL = 104
  310. const m_F_ADDSIGS = 59
  311. const m_F_ADDSIGS_MAIN_BINARY = 113
  312. const m_F_ALLOCATEALL = 0x00000004
  313. const m_F_ALLOCATECONTIG = 0x00000002
  314. const m_F_ALLOCATEPERSIST = 0x00000008
  315. const m_F_ATTRIBUTION_TAG = 111
  316. const m_F_BARRIERFSYNC = 85
  317. const m_F_CHECK_LV = 98
  318. const m_F_CHKCLEAN = 41
  319. const m_F_CREATE_TAG = 0x00000001
  320. const m_F_DELETE_TAG = 0x00000002
  321. const m_F_DUPFD = 0
  322. const m_F_DUPFD_CLOEXEC = 67
  323. const m_F_FINDSIGS = 78
  324. const m_F_FLUSH_DATA = 40
  325. const m_F_FREEZE_FS = 53
  326. const m_F_FULLFSYNC = 51
  327. const m_F_GETCODEDIR = 72
  328. const m_F_GETFD = 1
  329. const m_F_GETFL = 3
  330. const m_F_GETLEASE = 107
  331. const m_F_GETLK = 7
  332. const m_F_GETLKPID = 66
  333. const m_F_GETNOSIGPIPE = 74
  334. const m_F_GETOWN = 5
  335. const m_F_GETPATH = 50
  336. const m_F_GETPATH_MTMINFO = 71
  337. const m_F_GETPATH_NOFIRMLINK = 102
  338. const m_F_GETPROTECTIONCLASS = 63
  339. const m_F_GETPROTECTIONLEVEL = 77
  340. const m_F_GETSIGSINFO = 105
  341. const m_F_GLOBAL_NOCACHE = 55
  342. const m_F_LOCK = 1
  343. const m_F_LOG2PHYS = 49
  344. const m_F_LOG2PHYS_EXT = 65
  345. const m_F_NOCACHE = 48
  346. const m_F_NODIRECT = 62
  347. const m_F_OFD_GETLK = 92
  348. const m_F_OFD_SETLK = 90
  349. const m_F_OFD_SETLKW = 91
  350. const m_F_OFD_SETLKWTIMEOUT = 93
  351. const m_F_OK = 0
  352. const m_F_PATHPKG_CHECK = 52
  353. const m_F_PEOFPOSMODE = 3
  354. const m_F_PREALLOCATE = 42
  355. const m_F_PUNCHHOLE = 99
  356. const m_F_QUERY_TAG = 0x00000004
  357. const m_F_RDADVISE = 44
  358. const m_F_RDAHEAD = 45
  359. const m_F_RDLCK = 1
  360. const m_F_SETBACKINGSTORE = 70
  361. const m_F_SETFD = 2
  362. const m_F_SETFL = 4
  363. const m_F_SETLEASE = 106
  364. const m_F_SETLK = 8
  365. const m_F_SETLKW = 9
  366. const m_F_SETLKWTIMEOUT = 10
  367. const m_F_SETNOSIGPIPE = 73
  368. const m_F_SETOWN = 6
  369. const m_F_SETPROTECTIONCLASS = 64
  370. const m_F_SETSIZE = 43
  371. const m_F_SINGLE_WRITER = 76
  372. const m_F_SPECULATIVE_READ = 101
  373. const m_F_TEST = 3
  374. const m_F_THAW_FS = 54
  375. const m_F_TLOCK = 2
  376. const m_F_TRANSCODEKEY = 75
  377. const m_F_TRANSFEREXTENTS = 110
  378. const m_F_TRIM_ACTIVE_FILE = 100
  379. const m_F_ULOCK = 0
  380. const m_F_UNLCK = 2
  381. const m_F_VOLPOSMODE = 4
  382. const m_F_WRLCK = 3
  383. const m_GETSIGSINFO_PLATFORM_BINARY = 1
  384. const m_GID_MAX = 2147483647
  385. const m_HAVE_ARC4RANDOM_BUF = 1
  386. const m_HAVE_CONFIG_H = 1
  387. const m_HAVE_DLFCN_H = 1
  388. const m_HAVE_FCNTL_H = 1
  389. const m_HAVE_GETPAGESIZE = 1
  390. const m_HAVE_INTTYPES_H = 1
  391. const m_HAVE_MMAP = 1
  392. const m_HAVE_STDINT_H = 1
  393. const m_HAVE_STDIO_H = 1
  394. const m_HAVE_STDLIB_H = 1
  395. const m_HAVE_STRINGS_H = 1
  396. const m_HAVE_STRING_H = 1
  397. const m_HAVE_SYS_PARAM_H = 1
  398. const m_HAVE_SYS_STAT_H = 1
  399. const m_HAVE_SYS_TYPES_H = 1
  400. const m_HAVE_UNISTD_H = 1
  401. const m_HUGE = "MAXFLOAT"
  402. const m_ILL_BADSTK = 8
  403. const m_ILL_COPROC = 7
  404. const m_ILL_ILLADR = 5
  405. const m_ILL_ILLOPC = 1
  406. const m_ILL_ILLOPN = 4
  407. const m_ILL_ILLTRP = 2
  408. const m_ILL_NOOP = 0
  409. const m_ILL_PRVOPC = 3
  410. const m_ILL_PRVREG = 6
  411. const m_INFINITY = "HUGE_VALF"
  412. const m_INIT_ATTS_SIZE = 16
  413. const m_INIT_ATTS_VERSION = 4294967295
  414. const m_INIT_BLOCK_SIZE = 1024
  415. const m_INIT_BUFFER_SIZE = 1024
  416. const m_INIT_DATA_BUF_SIZE = 1024
  417. const m_INIT_POWER = 6
  418. const m_INIT_SCAFFOLD_ELEMENTS = 32
  419. const m_INIT_TAG_BUF_SIZE = 32
  420. const m_INTMAX_MAX = "__INTMAX_MAX__"
  421. const m_INTPTR_MAX = "__INTPTR_MAX__"
  422. const m_INT_FAST16_MAX = "__INT_LEAST16_MAX"
  423. const m_INT_FAST16_MIN = "__INT_LEAST16_MIN"
  424. const m_INT_FAST32_MAX = "__INT_LEAST32_MAX"
  425. const m_INT_FAST32_MIN = "__INT_LEAST32_MIN"
  426. const m_INT_FAST64_MAX = "__INT_LEAST64_MAX"
  427. const m_INT_FAST64_MIN = "__INT_LEAST64_MIN"
  428. const m_INT_FAST8_MAX = "__INT_LEAST8_MAX"
  429. const m_INT_FAST8_MIN = "__INT_LEAST8_MIN"
  430. const m_INT_LEAST16_MAX = "__INT_LEAST16_MAX"
  431. const m_INT_LEAST16_MIN = "__INT_LEAST16_MIN"
  432. const m_INT_LEAST32_MAX = "__INT_LEAST32_MAX"
  433. const m_INT_LEAST32_MIN = "__INT_LEAST32_MIN"
  434. const m_INT_LEAST64_MAX = "__INT_LEAST64_MAX"
  435. const m_INT_LEAST64_MIN = "__INT_LEAST64_MIN"
  436. const m_INT_LEAST8_MAX = "__INT_LEAST8_MAX"
  437. const m_INT_LEAST8_MIN = "__INT_LEAST8_MIN"
  438. const m_IOPOL_APPLICATION = "IOPOL_STANDARD"
  439. const m_IOPOL_ATIME_UPDATES_DEFAULT = 0
  440. const m_IOPOL_ATIME_UPDATES_OFF = 1
  441. const m_IOPOL_DEFAULT = 0
  442. const m_IOPOL_IMPORTANT = 1
  443. const m_IOPOL_MATERIALIZE_DATALESS_FILES_DEFAULT = 0
  444. const m_IOPOL_MATERIALIZE_DATALESS_FILES_OFF = 1
  445. const m_IOPOL_MATERIALIZE_DATALESS_FILES_ON = 2
  446. const m_IOPOL_NORMAL = "IOPOL_IMPORTANT"
  447. const m_IOPOL_PASSIVE = 2
  448. const m_IOPOL_SCOPE_DARWIN_BG = 2
  449. const m_IOPOL_SCOPE_PROCESS = 0
  450. const m_IOPOL_SCOPE_THREAD = 1
  451. const m_IOPOL_STANDARD = 5
  452. const m_IOPOL_THROTTLE = 3
  453. const m_IOPOL_TYPE_DISK = 0
  454. const m_IOPOL_TYPE_VFS_ALLOW_LOW_SPACE_WRITES = 9
  455. const m_IOPOL_TYPE_VFS_ATIME_UPDATES = 2
  456. const m_IOPOL_TYPE_VFS_DISALLOW_RW_FOR_O_EVTONLY = 10
  457. const m_IOPOL_TYPE_VFS_IGNORE_CONTENT_PROTECTION = 6
  458. const m_IOPOL_TYPE_VFS_IGNORE_PERMISSIONS = 7
  459. const m_IOPOL_TYPE_VFS_MATERIALIZE_DATALESS_FILES = 3
  460. const m_IOPOL_TYPE_VFS_SKIP_MTIME_UPDATE = 8
  461. const m_IOPOL_TYPE_VFS_STATFS_NO_DATA_VOLUME = 4
  462. const m_IOPOL_TYPE_VFS_TRIGGER_RESOLVE = 5
  463. const m_IOPOL_UTILITY = 4
  464. const m_IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_OFF = 0
  465. const m_IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_ON = 1
  466. const m_IOPOL_VFS_CONTENT_PROTECTION_DEFAULT = 0
  467. const m_IOPOL_VFS_CONTENT_PROTECTION_IGNORE = 1
  468. const m_IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_DEFAULT = 0
  469. const m_IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_ON = 1
  470. const m_IOPOL_VFS_IGNORE_PERMISSIONS_OFF = 0
  471. const m_IOPOL_VFS_IGNORE_PERMISSIONS_ON = 1
  472. const m_IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_DEFAULT = 0
  473. const m_IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_ON = 1
  474. const m_IOPOL_VFS_SKIP_MTIME_UPDATE_IGNORE = 2
  475. const m_IOPOL_VFS_SKIP_MTIME_UPDATE_OFF = 0
  476. const m_IOPOL_VFS_SKIP_MTIME_UPDATE_ON = 1
  477. const m_IOPOL_VFS_STATFS_FORCE_NO_DATA_VOLUME = 1
  478. const m_IOPOL_VFS_STATFS_NO_DATA_VOLUME_DEFAULT = 0
  479. const m_IOPOL_VFS_TRIGGER_RESOLVE_DEFAULT = 0
  480. const m_IOPOL_VFS_TRIGGER_RESOLVE_OFF = 1
  481. const m_ITIMER_PROF = 2
  482. const m_ITIMER_REAL = 0
  483. const m_ITIMER_VIRTUAL = 1
  484. const m_LINE_MAX = 2048
  485. const m_LINK_MAX = 32767
  486. const m_LITTLE_ENDIAN = "__DARWIN_LITTLE_ENDIAN"
  487. const m_LOCK_EX = 0x02
  488. const m_LOCK_NB = 0x04
  489. const m_LOCK_SH = 0x01
  490. const m_LOCK_UN = 0x08
  491. const m_LT_OBJDIR = ".libs/"
  492. const m_L_INCR = "SEEK_CUR"
  493. const m_L_SET = "SEEK_SET"
  494. const m_L_XTND = "SEEK_END"
  495. const m_L_ctermid = 1024
  496. const m_L_tmpnam = 1024
  497. const m_MAC_OS_VERSION_11_0 = "__MAC_11_0"
  498. const m_MAC_OS_VERSION_11_1 = "__MAC_11_1"
  499. const m_MAC_OS_VERSION_11_3 = "__MAC_11_3"
  500. const m_MAC_OS_VERSION_11_4 = "__MAC_11_4"
  501. const m_MAC_OS_VERSION_11_5 = "__MAC_11_5"
  502. const m_MAC_OS_VERSION_11_6 = "__MAC_11_6"
  503. const m_MAC_OS_VERSION_12_0 = "__MAC_12_0"
  504. const m_MAC_OS_VERSION_12_1 = "__MAC_12_1"
  505. const m_MAC_OS_VERSION_12_2 = "__MAC_12_2"
  506. const m_MAC_OS_VERSION_12_3 = "__MAC_12_3"
  507. const m_MAC_OS_VERSION_12_4 = "__MAC_12_4"
  508. const m_MAC_OS_VERSION_12_5 = "__MAC_12_5"
  509. const m_MAC_OS_VERSION_12_6 = "__MAC_12_6"
  510. const m_MAC_OS_VERSION_12_7 = "__MAC_12_7"
  511. const m_MAC_OS_VERSION_13_0 = "__MAC_13_0"
  512. const m_MAC_OS_VERSION_13_1 = "__MAC_13_1"
  513. const m_MAC_OS_VERSION_13_2 = "__MAC_13_2"
  514. const m_MAC_OS_VERSION_13_3 = "__MAC_13_3"
  515. const m_MAC_OS_VERSION_13_4 = "__MAC_13_4"
  516. const m_MAC_OS_VERSION_13_5 = "__MAC_13_5"
  517. const m_MAC_OS_VERSION_13_6 = "__MAC_13_6"
  518. const m_MAC_OS_VERSION_13_7 = "__MAC_13_7"
  519. const m_MAC_OS_VERSION_14_0 = "__MAC_14_0"
  520. const m_MAC_OS_VERSION_14_1 = "__MAC_14_1"
  521. const m_MAC_OS_VERSION_14_2 = "__MAC_14_2"
  522. const m_MAC_OS_VERSION_14_3 = "__MAC_14_3"
  523. const m_MAC_OS_VERSION_14_4 = "__MAC_14_4"
  524. const m_MAC_OS_VERSION_14_5 = "__MAC_14_5"
  525. const m_MAC_OS_VERSION_14_6 = "__MAC_14_6"
  526. const m_MAC_OS_VERSION_14_7 = "__MAC_14_7"
  527. const m_MAC_OS_VERSION_15_0 = "__MAC_15_0"
  528. const m_MAC_OS_VERSION_15_1 = "__MAC_15_1"
  529. const m_MAC_OS_VERSION_15_2 = "__MAC_15_2"
  530. const m_MAC_OS_VERSION_15_3 = "__MAC_15_3"
  531. const m_MAC_OS_VERSION_15_4 = "__MAC_15_4"
  532. const m_MAC_OS_X_VERSION_10_0 = "__MAC_10_0"
  533. const m_MAC_OS_X_VERSION_10_1 = "__MAC_10_1"
  534. const m_MAC_OS_X_VERSION_10_10 = "__MAC_10_10"
  535. const m_MAC_OS_X_VERSION_10_10_2 = "__MAC_10_10_2"
  536. const m_MAC_OS_X_VERSION_10_10_3 = "__MAC_10_10_3"
  537. const m_MAC_OS_X_VERSION_10_11 = "__MAC_10_11"
  538. const m_MAC_OS_X_VERSION_10_11_2 = "__MAC_10_11_2"
  539. const m_MAC_OS_X_VERSION_10_11_3 = "__MAC_10_11_3"
  540. const m_MAC_OS_X_VERSION_10_11_4 = "__MAC_10_11_4"
  541. const m_MAC_OS_X_VERSION_10_12 = "__MAC_10_12"
  542. const m_MAC_OS_X_VERSION_10_12_1 = "__MAC_10_12_1"
  543. const m_MAC_OS_X_VERSION_10_12_2 = "__MAC_10_12_2"
  544. const m_MAC_OS_X_VERSION_10_12_4 = "__MAC_10_12_4"
  545. const m_MAC_OS_X_VERSION_10_13 = "__MAC_10_13"
  546. const m_MAC_OS_X_VERSION_10_13_1 = "__MAC_10_13_1"
  547. const m_MAC_OS_X_VERSION_10_13_2 = "__MAC_10_13_2"
  548. const m_MAC_OS_X_VERSION_10_13_4 = "__MAC_10_13_4"
  549. const m_MAC_OS_X_VERSION_10_14 = "__MAC_10_14"
  550. const m_MAC_OS_X_VERSION_10_14_1 = "__MAC_10_14_1"
  551. const m_MAC_OS_X_VERSION_10_14_4 = "__MAC_10_14_4"
  552. const m_MAC_OS_X_VERSION_10_14_5 = "__MAC_10_14_5"
  553. const m_MAC_OS_X_VERSION_10_14_6 = "__MAC_10_14_6"
  554. const m_MAC_OS_X_VERSION_10_15 = "__MAC_10_15"
  555. const m_MAC_OS_X_VERSION_10_15_1 = "__MAC_10_15_1"
  556. const m_MAC_OS_X_VERSION_10_15_4 = "__MAC_10_15_4"
  557. const m_MAC_OS_X_VERSION_10_16 = "__MAC_10_16"
  558. const m_MAC_OS_X_VERSION_10_2 = "__MAC_10_2"
  559. const m_MAC_OS_X_VERSION_10_3 = "__MAC_10_3"
  560. const m_MAC_OS_X_VERSION_10_4 = "__MAC_10_4"
  561. const m_MAC_OS_X_VERSION_10_5 = "__MAC_10_5"
  562. const m_MAC_OS_X_VERSION_10_6 = "__MAC_10_6"
  563. const m_MAC_OS_X_VERSION_10_7 = "__MAC_10_7"
  564. const m_MAC_OS_X_VERSION_10_8 = "__MAC_10_8"
  565. const m_MAC_OS_X_VERSION_10_9 = "__MAC_10_9"
  566. const m_MATH_ERREXCEPT = 2
  567. const m_MATH_ERRNO = 1
  568. const m_MAXFLOAT = "0x1.fffffep+127f"
  569. const m_MAX_CANON = 1024
  570. const m_MAX_INPUT = 1024
  571. const m_MB_CUR_MAX = "__mb_cur_max"
  572. const m_MB_LEN_MAX = 1
  573. const m_MINSIGSTKSZ = 32768
  574. const m_M_1_PI = 0.318309886183790671537767526745028724
  575. const m_M_2_PI = 0.636619772367581343075535053490057448
  576. const m_M_2_SQRTPI = 1.12837916709551257389615890312154517
  577. const m_M_E = 2.71828182845904523536028747135266250
  578. const m_M_LN10 = 2.30258509299404568401799145468436421
  579. const m_M_LN2 = 0.693147180559945309417232121458176568
  580. const m_M_LOG10E = 0.434294481903251827651128918916605082
  581. const m_M_LOG2E = 1.44269504088896340735992468100189214
  582. const m_M_PI = 3.14159265358979323846264338327950288
  583. const m_M_PI_2 = 1.57079632679489661923132169163975144
  584. const m_M_PI_4 = 0.785398163397448309615660845819875721
  585. const m_M_SQRT1_2 = 0.707106781186547524400844362104849039
  586. const m_M_SQRT2 = 1.41421356237309504880168872420969808
  587. const m_NAME_MAX = 255
  588. const m_NBBY = "__DARWIN_NBBY"
  589. const m_NDEBUG = 1
  590. const m_NFDBITS = "__DARWIN_NFDBITS"
  591. const m_NGROUPS_MAX = 16
  592. const m_NSIG = "__DARWIN_NSIG"
  593. const m_NZERO = 20
  594. const m_OPEN_MAX = 10240
  595. const m_OVERFLOW = 3
  596. const m_O_ACCMODE = 0x0003
  597. const m_O_ALERT = 0x20000000
  598. const m_O_APPEND = 0x00000008
  599. const m_O_ASYNC = 0x00000040
  600. const m_O_CLOEXEC = 0x01000000
  601. const m_O_CREAT = 0x00000200
  602. const m_O_DIRECTORY = 0x00100000
  603. const m_O_DP_AUTHENTICATE = 0x0004
  604. const m_O_DP_GETRAWENCRYPTED = 0x0001
  605. const m_O_DP_GETRAWUNENCRYPTED = 0x0002
  606. const m_O_DSYNC = 0x400000
  607. const m_O_EVTONLY = 0x00008000
  608. const m_O_EXCL = 0x00000800
  609. const m_O_EXEC = 0x40000000
  610. const m_O_EXLOCK = 0x00000020
  611. const m_O_FSYNC = "O_SYNC"
  612. const m_O_NDELAY = "O_NONBLOCK"
  613. const m_O_NOCTTY = 0x00020000
  614. const m_O_NOFOLLOW = 0x00000100
  615. const m_O_NOFOLLOW_ANY = 0x20000000
  616. const m_O_NONBLOCK = 0x00000004
  617. const m_O_POPUP = 0x80000000
  618. const m_O_RDONLY = 0x0000
  619. const m_O_RDWR = 0x0002
  620. const m_O_RESOLVE_BENEATH = 0x00001000
  621. const m_O_SHLOCK = 0x00000010
  622. const m_O_SYMLINK = 0x00200000
  623. const m_O_SYNC = 0x0080
  624. const m_O_TRUNC = 0x00000400
  625. const m_O_WRONLY = 0x0001
  626. const m_PACKAGE = "expat"
  627. const m_PACKAGE_BUGREPORT = "expat-bugs@libexpat.org"
  628. const m_PACKAGE_NAME = "expat"
  629. const m_PACKAGE_STRING = "expat 2.5.0"
  630. const m_PACKAGE_TARNAME = "expat"
  631. const m_PACKAGE_URL = ""
  632. const m_PACKAGE_VERSION = "2.5.0"
  633. const m_PATH_MAX = 1024
  634. const m_PDP_ENDIAN = "__DARWIN_PDP_ENDIAN"
  635. const m_PIPE_BUF = 512
  636. const m_PLOSS = 6
  637. const m_POLL_ERR = 4
  638. const m_POLL_HUP = 6
  639. const m_POLL_IN = 1
  640. const m_POLL_MSG = 3
  641. const m_POLL_OUT = 2
  642. const m_POLL_PRI = 5
  643. const m_PRIO_DARWIN_BG = 0x1000
  644. const m_PRIO_DARWIN_NONUI = 0x1001
  645. const m_PRIO_DARWIN_PROCESS = 4
  646. const m_PRIO_DARWIN_THREAD = 3
  647. const m_PRIO_MAX = 20
  648. const m_PRIO_PGRP = 1
  649. const m_PRIO_PROCESS = 0
  650. const m_PRIO_USER = 2
  651. const m_PTRDIFF_MAX = "__PTRDIFF_MAX__"
  652. const m_P_tmpdir = "/var/tmp/"
  653. const m_RAND_MAX = 0x7fffffff
  654. const m_RENAME_EXCL = 0x00000004
  655. const m_RENAME_NOFOLLOW_ANY = 0x00000010
  656. const m_RENAME_RESERVED1 = 0x00000008
  657. const m_RENAME_SECLUDE = 0x00000001
  658. const m_RENAME_SWAP = 0x00000002
  659. const m_RE_DUP_MAX = 255
  660. const m_RLIMIT_AS = 5
  661. const m_RLIMIT_CORE = 4
  662. const m_RLIMIT_CPU = 0
  663. const m_RLIMIT_CPU_USAGE_MONITOR = 0x2
  664. const m_RLIMIT_DATA = 2
  665. const m_RLIMIT_FOOTPRINT_INTERVAL = 0x4
  666. const m_RLIMIT_FSIZE = 1
  667. const m_RLIMIT_MEMLOCK = 6
  668. const m_RLIMIT_NOFILE = 8
  669. const m_RLIMIT_NPROC = 7
  670. const m_RLIMIT_RSS = "RLIMIT_AS"
  671. const m_RLIMIT_STACK = 3
  672. const m_RLIMIT_THREAD_CPULIMITS = 0x3
  673. const m_RLIMIT_WAKEUPS_MONITOR = 0x1
  674. const m_RLIM_NLIMITS = 9
  675. const m_RLIM_SAVED_CUR = "RLIM_INFINITY"
  676. const m_RLIM_SAVED_MAX = "RLIM_INFINITY"
  677. const m_RUSAGE_INFO_CURRENT = "RUSAGE_INFO_V6"
  678. const m_RUSAGE_INFO_V0 = 0
  679. const m_RUSAGE_INFO_V1 = 1
  680. const m_RUSAGE_INFO_V2 = 2
  681. const m_RUSAGE_INFO_V3 = 3
  682. const m_RUSAGE_INFO_V4 = 4
  683. const m_RUSAGE_INFO_V5 = 5
  684. const m_RUSAGE_INFO_V6 = 6
  685. const m_RUSAGE_SELF = 0
  686. const m_RU_PROC_RUNS_RESLIDE = 0x00000001
  687. const m_SA_64REGSET = 0x0200
  688. const m_SA_NOCLDSTOP = 0x0008
  689. const m_SA_NOCLDWAIT = 0x0020
  690. const m_SA_NODEFER = 0x0010
  691. const m_SA_ONSTACK = 0x0001
  692. const m_SA_RESETHAND = 0x0004
  693. const m_SA_RESTART = 0x0002
  694. const m_SA_SIGINFO = 0x0040
  695. const m_SA_USERTRAMP = 0x0100
  696. const m_SEEK_CUR = 1
  697. const m_SEEK_DATA = 4
  698. const m_SEEK_END = 2
  699. const m_SEEK_HOLE = 3
  700. const m_SEEK_SET = 0
  701. const m_SEGV_ACCERR = 2
  702. const m_SEGV_MAPERR = 1
  703. const m_SEGV_NOOP = 0
  704. const m_SIGABRT = 6
  705. const m_SIGALRM = 14
  706. const m_SIGBUS = 10
  707. const m_SIGCHLD = 20
  708. const m_SIGCONT = 19
  709. const m_SIGEMT = 7
  710. const m_SIGEV_NONE = 0
  711. const m_SIGEV_SIGNAL = 1
  712. const m_SIGEV_THREAD = 3
  713. const m_SIGFPE = 8
  714. const m_SIGHUP = 1
  715. const m_SIGILL = 4
  716. const m_SIGINFO = 29
  717. const m_SIGINT = 2
  718. const m_SIGIO = 23
  719. const m_SIGIOT = "SIGABRT"
  720. const m_SIGKILL = 9
  721. const m_SIGPIPE = 13
  722. const m_SIGPROF = 27
  723. const m_SIGQUIT = 3
  724. const m_SIGSEGV = 11
  725. const m_SIGSTKSZ = 131072
  726. const m_SIGSTOP = 17
  727. const m_SIGSYS = 12
  728. const m_SIGTERM = 15
  729. const m_SIGTRAP = 5
  730. const m_SIGTSTP = 18
  731. const m_SIGTTIN = 21
  732. const m_SIGTTOU = 22
  733. const m_SIGURG = 16
  734. const m_SIGUSR1 = 30
  735. const m_SIGUSR2 = 31
  736. const m_SIGVTALRM = 26
  737. const m_SIGWINCH = 28
  738. const m_SIGXCPU = 24
  739. const m_SIGXFSZ = 25
  740. const m_SIG_BLOCK = 1
  741. const m_SIG_SETMASK = 3
  742. const m_SIG_UNBLOCK = 2
  743. const m_SING = 2
  744. const m_SIP_KEYLEN = 16
  745. const m_SIZE_MAX = "__SIZE_MAX__"
  746. const m_SI_ASYNCIO = 0x10004
  747. const m_SI_MESGQ = 0x10005
  748. const m_SI_QUEUE = 0x10002
  749. const m_SI_TIMER = 0x10003
  750. const m_SI_USER = 0x10001
  751. const m_SS_DISABLE = 0x0004
  752. const m_SS_ONSTACK = 0x0001
  753. const m_STDC_HEADERS = 1
  754. const m_STDERR_FILENO = 2
  755. const m_STDIN_FILENO = 0
  756. const m_STDOUT_FILENO = 1
  757. const m_SV_INTERRUPT = "SA_RESTART"
  758. const m_SV_NOCLDSTOP = "SA_NOCLDSTOP"
  759. const m_SV_NODEFER = "SA_NODEFER"
  760. const m_SV_ONSTACK = "SA_ONSTACK"
  761. const m_SV_RESETHAND = "SA_RESETHAND"
  762. const m_SV_SIGINFO = "SA_SIGINFO"
  763. const m_SYNC_VOLUME_FULLSYNC = 0x01
  764. const m_SYNC_VOLUME_WAIT = 0x02
  765. const m_S_IEXEC = "S_IXUSR"
  766. const m_S_IFBLK = 0060000
  767. const m_S_IFCHR = 0020000
  768. const m_S_IFDIR = 0040000
  769. const m_S_IFIFO = 0010000
  770. const m_S_IFLNK = 0120000
  771. const m_S_IFMT = 0170000
  772. const m_S_IFREG = 0100000
  773. const m_S_IFSOCK = 0140000
  774. const m_S_IFWHT = 0160000
  775. const m_S_IREAD = "S_IRUSR"
  776. const m_S_IRGRP = 0000040
  777. const m_S_IROTH = 0000004
  778. const m_S_IRUSR = 0000400
  779. const m_S_IRWXG = 0000070
  780. const m_S_IRWXO = 0000007
  781. const m_S_IRWXU = 0000700
  782. const m_S_ISGID = 0002000
  783. const m_S_ISTXT = "S_ISVTX"
  784. const m_S_ISUID = 0004000
  785. const m_S_ISVTX = 0001000
  786. const m_S_IWGRP = 0000020
  787. const m_S_IWOTH = 0000002
  788. const m_S_IWRITE = "S_IWUSR"
  789. const m_S_IWUSR = 0000200
  790. const m_S_IXGRP = 0000010
  791. const m_S_IXOTH = 0000001
  792. const m_S_IXUSR = 0000100
  793. const m_TARGET_IPHONE_SIMULATOR = 0
  794. const m_TARGET_OS_ARROW = 0
  795. const m_TARGET_OS_BRIDGE = 0
  796. const m_TARGET_OS_DRIVERKIT = 0
  797. const m_TARGET_OS_EMBEDDED = 0
  798. const m_TARGET_OS_IOS = 0
  799. const m_TARGET_OS_IOSMAC = 0
  800. const m_TARGET_OS_IPHONE = 0
  801. const m_TARGET_OS_LINUX = 0
  802. const m_TARGET_OS_MAC = 1
  803. const m_TARGET_OS_MACCATALYST = 0
  804. const m_TARGET_OS_NANO = 0
  805. const m_TARGET_OS_OSX = 1
  806. const m_TARGET_OS_SIMULATOR = 0
  807. const m_TARGET_OS_TV = 0
  808. const m_TARGET_OS_UIKITFORMAC = 0
  809. const m_TARGET_OS_UNIX = 0
  810. const m_TARGET_OS_VISION = 0
  811. const m_TARGET_OS_WATCH = 0
  812. const m_TARGET_OS_WIN32 = 0
  813. const m_TARGET_OS_WINDOWS = 0
  814. const m_TARGET_OS_XR = 0
  815. const m_TIME_UTC = 1
  816. const m_TLOSS = 5
  817. const m_TMP_MAX = 308915776
  818. const m_TRAP_BRKPT = 1
  819. const m_TRAP_TRACE = 2
  820. const m_UID_MAX = 2147483647
  821. const m_UINTMAX_MAX = "__UINTMAX_MAX__"
  822. const m_UINTPTR_MAX = "__UINTPTR_MAX__"
  823. const m_UINT_FAST16_MAX = "__UINT_LEAST16_MAX"
  824. const m_UINT_FAST32_MAX = "__UINT_LEAST32_MAX"
  825. const m_UINT_FAST64_MAX = "__UINT_LEAST64_MAX"
  826. const m_UINT_FAST8_MAX = "__UINT_LEAST8_MAX"
  827. const m_UINT_LEAST16_MAX = "__UINT_LEAST16_MAX"
  828. const m_UINT_LEAST32_MAX = "__UINT_LEAST32_MAX"
  829. const m_UINT_LEAST64_MAX = "__UINT_LEAST64_MAX"
  830. const m_UINT_LEAST8_MAX = "__UINT_LEAST8_MAX"
  831. const m_UNDERFLOW = 4
  832. const m_USER_FSIGNATURES_CDHASH_LEN = 20
  833. const m_VERSION = "2.5.0"
  834. const m_WAIT_MYPGRP = 0
  835. const m_WAKEMON_DISABLE = 0x02
  836. const m_WAKEMON_ENABLE = 0x01
  837. const m_WAKEMON_GET_PARAMS = 0x04
  838. const m_WAKEMON_MAKE_FATAL = 0x10
  839. const m_WAKEMON_SET_DEFAULTS = 0x08
  840. const m_WCHAR_MAX = "__WCHAR_MAX__"
  841. const m_WCONTINUED = 0x00000010
  842. const m_WCOREFLAG = 0200
  843. const m_WEXITED = 0x00000004
  844. const m_WNOHANG = 0x00000001
  845. const m_WNOWAIT = 0x00000020
  846. const m_WSTOPPED = 0x00000008
  847. const m_WUNTRACED = 0x00000002
  848. const m_XML_ATTRIBUTE_VALUE_LITERAL = 0
  849. const m_XML_BUILDING_EXPAT = 1
  850. const m_XML_CDATA_SECTION_STATE = 2
  851. const m_XML_CONTENT_STATE = 1
  852. const m_XML_CONTEXT_BYTES = 1024
  853. const m_XML_DEV_URANDOM = 1
  854. const m_XML_DTD = 1
  855. const m_XML_ENABLE_VISIBILITY = 0
  856. const m_XML_ENCODE_MAX = "XML_UTF8_ENCODE_MAX"
  857. const m_XML_ENTITY_VALUE_LITERAL = 1
  858. const m_XML_GetErrorByteIndex = "XML_GetCurrentByteIndex"
  859. const m_XML_GetErrorColumnNumber = "XML_GetCurrentColumnNumber"
  860. const m_XML_GetErrorLineNumber = "XML_GetCurrentLineNumber"
  861. const m_XML_IGNORE_SECTION_STATE = 3
  862. const m_XML_MAJOR_VERSION = 2
  863. const m_XML_MICRO_VERSION = 0
  864. const m_XML_MINOR_VERSION = 5
  865. const m_XML_NS = 1
  866. const m_XML_N_LITERAL_TYPES = 2
  867. const m_XML_N_STATES = 4
  868. const m_XML_PROLOG_STATE = 0
  869. const m_XML_TOK_ATTRIBUTE_VALUE_S = 39
  870. const m_XML_TOK_BOM = 14
  871. const m_XML_TOK_CDATA_SECT_CLOSE = 40
  872. const m_XML_TOK_CDATA_SECT_OPEN = 8
  873. const m_XML_TOK_CHAR_REF = 10
  874. const m_XML_TOK_CLOSE_BRACKET = 26
  875. const m_XML_TOK_CLOSE_PAREN = 24
  876. const m_XML_TOK_CLOSE_PAREN_ASTERISK = 36
  877. const m_XML_TOK_CLOSE_PAREN_PLUS = 37
  878. const m_XML_TOK_CLOSE_PAREN_QUESTION = 35
  879. const m_XML_TOK_COMMA = 38
  880. const m_XML_TOK_COMMENT = 13
  881. const m_XML_TOK_COND_SECT_CLOSE = 34
  882. const m_XML_TOK_COND_SECT_OPEN = 33
  883. const m_XML_TOK_DATA_CHARS = 6
  884. const m_XML_TOK_DATA_NEWLINE = 7
  885. const m_XML_TOK_DECL_CLOSE = 17
  886. const m_XML_TOK_DECL_OPEN = 16
  887. const m_XML_TOK_EMPTY_ELEMENT_NO_ATTS = 4
  888. const m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS = 3
  889. const m_XML_TOK_END_TAG = 5
  890. const m_XML_TOK_ENTITY_REF = 9
  891. const m_XML_TOK_IGNORE_SECT = 42
  892. const m_XML_TOK_INSTANCE_START = 29
  893. const m_XML_TOK_INVALID = 0
  894. const m_XML_TOK_LITERAL = 27
  895. const m_XML_TOK_NAME = 18
  896. const m_XML_TOK_NAME_ASTERISK = 31
  897. const m_XML_TOK_NAME_PLUS = 32
  898. const m_XML_TOK_NAME_QUESTION = 30
  899. const m_XML_TOK_NMTOKEN = 19
  900. const m_XML_TOK_OPEN_BRACKET = 25
  901. const m_XML_TOK_OPEN_PAREN = 23
  902. const m_XML_TOK_OR = 21
  903. const m_XML_TOK_PARAM_ENTITY_REF = 28
  904. const m_XML_TOK_PERCENT = 22
  905. const m_XML_TOK_PI = 11
  906. const m_XML_TOK_POUND_NAME = 20
  907. const m_XML_TOK_PREFIXED_NAME = 41
  908. const m_XML_TOK_PROLOG_S = 15
  909. const m_XML_TOK_START_TAG_NO_ATTS = 2
  910. const m_XML_TOK_START_TAG_WITH_ATTS = 1
  911. const m_XML_TOK_XML_DECL = 12
  912. const m_XML_UTF16_ENCODE_MAX = 2
  913. const m_XML_UTF8_ENCODE_MAX = 4
  914. const m_X_TLOSS = 1.41484755040568800000e+16
  915. const m_XmlConvert = "XmlUtf8Convert"
  916. const m_XmlEncode = "XmlUtf8Encode"
  917. const m_XmlGetInternalEncoding = "XmlGetUtf8InternalEncoding"
  918. const m_XmlGetInternalEncodingNS = "XmlGetUtf8InternalEncodingNS"
  919. const m_XmlRole_INCLUDED = 1
  920. const m_XmlTok_INCLUDED = 1
  921. const m__CS_DARWIN_USER_CACHE_DIR = 65538
  922. const m__CS_DARWIN_USER_DIR = 65536
  923. const m__CS_DARWIN_USER_TEMP_DIR = 65537
  924. const m__CS_PATH = 1
  925. const m__CS_POSIX_V6_ILP32_OFF32_CFLAGS = 2
  926. const m__CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 3
  927. const m__CS_POSIX_V6_ILP32_OFF32_LIBS = 4
  928. const m__CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 5
  929. const m__CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 6
  930. const m__CS_POSIX_V6_ILP32_OFFBIG_LIBS = 7
  931. const m__CS_POSIX_V6_LP64_OFF64_CFLAGS = 8
  932. const m__CS_POSIX_V6_LP64_OFF64_LDFLAGS = 9
  933. const m__CS_POSIX_V6_LP64_OFF64_LIBS = 10
  934. const m__CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 11
  935. const m__CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 12
  936. const m__CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 13
  937. const m__CS_POSIX_V6_WIDTH_RESTRICTED_ENVS = 14
  938. const m__CS_XBS5_ILP32_OFF32_CFLAGS = 20
  939. const m__CS_XBS5_ILP32_OFF32_LDFLAGS = 21
  940. const m__CS_XBS5_ILP32_OFF32_LIBS = 22
  941. const m__CS_XBS5_ILP32_OFF32_LINTFLAGS = 23
  942. const m__CS_XBS5_ILP32_OFFBIG_CFLAGS = 24
  943. const m__CS_XBS5_ILP32_OFFBIG_LDFLAGS = 25
  944. const m__CS_XBS5_ILP32_OFFBIG_LIBS = 26
  945. const m__CS_XBS5_ILP32_OFFBIG_LINTFLAGS = 27
  946. const m__CS_XBS5_LP64_OFF64_CFLAGS = 28
  947. const m__CS_XBS5_LP64_OFF64_LDFLAGS = 29
  948. const m__CS_XBS5_LP64_OFF64_LIBS = 30
  949. const m__CS_XBS5_LP64_OFF64_LINTFLAGS = 31
  950. const m__CS_XBS5_LPBIG_OFFBIG_CFLAGS = 32
  951. const m__CS_XBS5_LPBIG_OFFBIG_LDFLAGS = 33
  952. const m__CS_XBS5_LPBIG_OFFBIG_LIBS = 34
  953. const m__CS_XBS5_LPBIG_OFFBIG_LINTFLAGS = 35
  954. const m__DARWIN_FEATURE_64_BIT_INODE = 1
  955. const m__DARWIN_FEATURE_ONLY_UNIX_CONFORMANCE = 1
  956. const m__DARWIN_FEATURE_UNIX_CONFORMANCE = 3
  957. const m__FORTIFY_SOURCE = 2
  958. const m__GNU_SOURCE = 1
  959. const m__I386_SIGNAL_H_ = 1
  960. const m__IOFBF = 0
  961. const m__IOLBF = 1
  962. const m__IONBF = 2
  963. const m__LIBC_COUNT__MB_LEN_MAX = "_LIBC_UNSAFE_INDEXABLE"
  964. const m__LIBC_COUNT__PATH_MAX = "_LIBC_UNSAFE_INDEXABLE"
  965. const m__LP64 = 1
  966. const m__PC_2_SYMLINKS = 15
  967. const m__PC_ALLOC_SIZE_MIN = 16
  968. const m__PC_ASYNC_IO = 17
  969. const m__PC_AUTH_OPAQUE_NP = 14
  970. const m__PC_CASE_PRESERVING = 12
  971. const m__PC_CASE_SENSITIVE = 11
  972. const m__PC_CHOWN_RESTRICTED = 7
  973. const m__PC_EXTENDED_SECURITY_NP = 13
  974. const m__PC_FILESIZEBITS = 18
  975. const m__PC_LINK_MAX = 1
  976. const m__PC_MAX_CANON = 2
  977. const m__PC_MAX_INPUT = 3
  978. const m__PC_MIN_HOLE_SIZE = 27
  979. const m__PC_NAME_CHARS_MAX = 10
  980. const m__PC_NAME_MAX = 4
  981. const m__PC_NO_TRUNC = 8
  982. const m__PC_PATH_MAX = 5
  983. const m__PC_PIPE_BUF = 6
  984. const m__PC_PRIO_IO = 19
  985. const m__PC_REC_INCR_XFER_SIZE = 20
  986. const m__PC_REC_MAX_XFER_SIZE = 21
  987. const m__PC_REC_MIN_XFER_SIZE = 22
  988. const m__PC_REC_XFER_ALIGN = 23
  989. const m__PC_SYMLINK_MAX = 24
  990. const m__PC_SYNC_IO = 25
  991. const m__PC_VDISABLE = 9
  992. const m__PC_XATTR_SIZE_BITS = 26
  993. const m__POSIX2_CHAR_TERM = 200112
  994. const m__POSIX2_C_BIND = 200112
  995. const m__POSIX2_C_DEV = 200112
  996. const m__POSIX2_FORT_RUN = 200112
  997. const m__POSIX2_LOCALEDEF = 200112
  998. const m__POSIX2_SW_DEV = 200112
  999. const m__POSIX2_UPE = 200112
  1000. const m__POSIX2_VERSION = 200112
  1001. const m__POSIX_CHOWN_RESTRICTED = 200112
  1002. const m__POSIX_FSYNC = 200112
  1003. const m__POSIX_IPV6 = 200112
  1004. const m__POSIX_JOB_CONTROL = 200112
  1005. const m__POSIX_MAPPED_FILES = 200112
  1006. const m__POSIX_MEMORY_PROTECTION = 200112
  1007. const m__POSIX_NO_TRUNC = 200112
  1008. const m__POSIX_READER_WRITER_LOCKS = 200112
  1009. const m__POSIX_REGEXP = 200112
  1010. const m__POSIX_SAVED_IDS = 200112
  1011. const m__POSIX_SHELL = 200112
  1012. const m__POSIX_SPAWN = 200112
  1013. const m__POSIX_THREADS = 200112
  1014. const m__POSIX_THREAD_ATTR_STACKADDR = 200112
  1015. const m__POSIX_THREAD_ATTR_STACKSIZE = 200112
  1016. const m__POSIX_THREAD_KEYS_MAX = 128
  1017. const m__POSIX_THREAD_PROCESS_SHARED = 200112
  1018. const m__POSIX_THREAD_SAFE_FUNCTIONS = 200112
  1019. const m__POSIX_V6_ILP32_OFF32 = "__ILP32_OFF32"
  1020. const m__POSIX_V6_ILP32_OFFBIG = "__ILP32_OFFBIG"
  1021. const m__POSIX_V6_LP64_OFF64 = "__LP64_OFF64"
  1022. const m__POSIX_V6_LPBIG_OFFBIG = "__LPBIG_OFFBIG"
  1023. const m__POSIX_V7_ILP32_OFF32 = "__ILP32_OFF32"
  1024. const m__POSIX_V7_ILP32_OFFBIG = "__ILP32_OFFBIG"
  1025. const m__POSIX_V7_LP64_OFF64 = "__LP64_OFF64"
  1026. const m__POSIX_V7_LPBIG_OFFBIG = "__LPBIG_OFFBIG"
  1027. const m__POSIX_VERSION = 200112
  1028. const m__QUAD_HIGHWORD = 1
  1029. const m__QUAD_LOWWORD = 0
  1030. const m__RLIMIT_POSIX_FLAG = 0x1000
  1031. const m__SC_2_CHAR_TERM = 20
  1032. const m__SC_2_C_BIND = 18
  1033. const m__SC_2_C_DEV = 19
  1034. const m__SC_2_FORT_DEV = 21
  1035. const m__SC_2_FORT_RUN = 22
  1036. const m__SC_2_LOCALEDEF = 23
  1037. const m__SC_2_PBS = 59
  1038. const m__SC_2_PBS_ACCOUNTING = 60
  1039. const m__SC_2_PBS_CHECKPOINT = 61
  1040. const m__SC_2_PBS_LOCATE = 62
  1041. const m__SC_2_PBS_MESSAGE = 63
  1042. const m__SC_2_PBS_TRACK = 64
  1043. const m__SC_2_SW_DEV = 24
  1044. const m__SC_2_UPE = 25
  1045. const m__SC_2_VERSION = 17
  1046. const m__SC_ADVISORY_INFO = 65
  1047. const m__SC_AIO_LISTIO_MAX = 42
  1048. const m__SC_AIO_MAX = 43
  1049. const m__SC_AIO_PRIO_DELTA_MAX = 44
  1050. const m__SC_ARG_MAX = 1
  1051. const m__SC_ASYNCHRONOUS_IO = 28
  1052. const m__SC_ATEXIT_MAX = 107
  1053. const m__SC_BARRIERS = 66
  1054. const m__SC_BC_BASE_MAX = 9
  1055. const m__SC_BC_DIM_MAX = 10
  1056. const m__SC_BC_SCALE_MAX = 11
  1057. const m__SC_BC_STRING_MAX = 12
  1058. const m__SC_CHILD_MAX = 2
  1059. const m__SC_CLK_TCK = 3
  1060. const m__SC_CLOCK_SELECTION = 67
  1061. const m__SC_COLL_WEIGHTS_MAX = 13
  1062. const m__SC_CPUTIME = 68
  1063. const m__SC_DELAYTIMER_MAX = 45
  1064. const m__SC_EXPR_NEST_MAX = 14
  1065. const m__SC_FILE_LOCKING = 69
  1066. const m__SC_FSYNC = 38
  1067. const m__SC_GETGR_R_SIZE_MAX = 70
  1068. const m__SC_GETPW_R_SIZE_MAX = 71
  1069. const m__SC_HOST_NAME_MAX = 72
  1070. const m__SC_IOV_MAX = 56
  1071. const m__SC_IPV6 = 118
  1072. const m__SC_JOB_CONTROL = 6
  1073. const m__SC_LINE_MAX = 15
  1074. const m__SC_LOGIN_NAME_MAX = 73
  1075. const m__SC_MAPPED_FILES = 47
  1076. const m__SC_MEMLOCK = 30
  1077. const m__SC_MEMLOCK_RANGE = 31
  1078. const m__SC_MEMORY_PROTECTION = 32
  1079. const m__SC_MESSAGE_PASSING = 33
  1080. const m__SC_MONOTONIC_CLOCK = 74
  1081. const m__SC_MQ_OPEN_MAX = 46
  1082. const m__SC_MQ_PRIO_MAX = 75
  1083. const m__SC_NGROUPS_MAX = 4
  1084. const m__SC_NPROCESSORS_CONF = 57
  1085. const m__SC_NPROCESSORS_ONLN = 58
  1086. const m__SC_OPEN_MAX = 5
  1087. const m__SC_PAGESIZE = 29
  1088. const m__SC_PAGE_SIZE = "_SC_PAGESIZE"
  1089. const m__SC_PASS_MAX = 131
  1090. const m__SC_PHYS_PAGES = 200
  1091. const m__SC_PRIORITIZED_IO = 34
  1092. const m__SC_PRIORITY_SCHEDULING = 35
  1093. const m__SC_RAW_SOCKETS = 119
  1094. const m__SC_READER_WRITER_LOCKS = 76
  1095. const m__SC_REALTIME_SIGNALS = 36
  1096. const m__SC_REGEXP = 77
  1097. const m__SC_RE_DUP_MAX = 16
  1098. const m__SC_RTSIG_MAX = 48
  1099. const m__SC_SAVED_IDS = 7
  1100. const m__SC_SEMAPHORES = 37
  1101. const m__SC_SEM_NSEMS_MAX = 49
  1102. const m__SC_SEM_VALUE_MAX = 50
  1103. const m__SC_SHARED_MEMORY_OBJECTS = 39
  1104. const m__SC_SHELL = 78
  1105. const m__SC_SIGQUEUE_MAX = 51
  1106. const m__SC_SPAWN = 79
  1107. const m__SC_SPIN_LOCKS = 80
  1108. const m__SC_SPORADIC_SERVER = 81
  1109. const m__SC_SS_REPL_MAX = 126
  1110. const m__SC_STREAM_MAX = 26
  1111. const m__SC_SYMLOOP_MAX = 120
  1112. const m__SC_SYNCHRONIZED_IO = 40
  1113. const m__SC_THREADS = 96
  1114. const m__SC_THREAD_ATTR_STACKADDR = 82
  1115. const m__SC_THREAD_ATTR_STACKSIZE = 83
  1116. const m__SC_THREAD_CPUTIME = 84
  1117. const m__SC_THREAD_DESTRUCTOR_ITERATIONS = 85
  1118. const m__SC_THREAD_KEYS_MAX = 86
  1119. const m__SC_THREAD_PRIORITY_SCHEDULING = 89
  1120. const m__SC_THREAD_PRIO_INHERIT = 87
  1121. const m__SC_THREAD_PRIO_PROTECT = 88
  1122. const m__SC_THREAD_PROCESS_SHARED = 90
  1123. const m__SC_THREAD_SAFE_FUNCTIONS = 91
  1124. const m__SC_THREAD_SPORADIC_SERVER = 92
  1125. const m__SC_THREAD_STACK_MIN = 93
  1126. const m__SC_THREAD_THREADS_MAX = 94
  1127. const m__SC_TIMEOUTS = 95
  1128. const m__SC_TIMERS = 41
  1129. const m__SC_TIMER_MAX = 52
  1130. const m__SC_TRACE = 97
  1131. const m__SC_TRACE_EVENT_FILTER = 98
  1132. const m__SC_TRACE_EVENT_NAME_MAX = 127
  1133. const m__SC_TRACE_INHERIT = 99
  1134. const m__SC_TRACE_LOG = 100
  1135. const m__SC_TRACE_NAME_MAX = 128
  1136. const m__SC_TRACE_SYS_MAX = 129
  1137. const m__SC_TRACE_USER_EVENT_MAX = 130
  1138. const m__SC_TTY_NAME_MAX = 101
  1139. const m__SC_TYPED_MEMORY_OBJECTS = 102
  1140. const m__SC_TZNAME_MAX = 27
  1141. const m__SC_V6_ILP32_OFF32 = 103
  1142. const m__SC_V6_ILP32_OFFBIG = 104
  1143. const m__SC_V6_LP64_OFF64 = 105
  1144. const m__SC_V6_LPBIG_OFFBIG = 106
  1145. const m__SC_VERSION = 8
  1146. const m__SC_XBS5_ILP32_OFF32 = 122
  1147. const m__SC_XBS5_ILP32_OFFBIG = 123
  1148. const m__SC_XBS5_LP64_OFF64 = 124
  1149. const m__SC_XBS5_LPBIG_OFFBIG = 125
  1150. const m__SC_XOPEN_CRYPT = 108
  1151. const m__SC_XOPEN_ENH_I18N = 109
  1152. const m__SC_XOPEN_LEGACY = 110
  1153. const m__SC_XOPEN_REALTIME = 111
  1154. const m__SC_XOPEN_REALTIME_THREADS = 112
  1155. const m__SC_XOPEN_SHM = 113
  1156. const m__SC_XOPEN_STREAMS = 114
  1157. const m__SC_XOPEN_UNIX = 115
  1158. const m__SC_XOPEN_VERSION = 116
  1159. const m__SC_XOPEN_XCU_VERSION = 121
  1160. const m__STRUCT_MCONTEXT = "_STRUCT_MCONTEXT64"
  1161. const m__V6_ILP32_OFF32 = "__ILP32_OFF32"
  1162. const m__V6_ILP32_OFFBIG = "__ILP32_OFFBIG"
  1163. const m__V6_LP64_OFF64 = "__LP64_OFF64"
  1164. const m__V6_LPBIG_OFFBIG = "__LPBIG_OFFBIG"
  1165. const m__WSTOPPED = 0177
  1166. const m__X86_INSTRUCTION_STATE_CACHELINE_SIZE = 64
  1167. const m__XBS5_ILP32_OFF32 = "__ILP32_OFF32"
  1168. const m__XBS5_ILP32_OFFBIG = "__ILP32_OFFBIG"
  1169. const m__XBS5_LP64_OFF64 = "__LP64_OFF64"
  1170. const m__XBS5_LPBIG_OFFBIG = "__LPBIG_OFFBIG"
  1171. const m__XOPEN_CRYPT = 1
  1172. const m__XOPEN_ENH_I18N = 1
  1173. const m__XOPEN_SHM = 1
  1174. const m__XOPEN_UNIX = 1
  1175. const m__XOPEN_VERSION = 600
  1176. const m__XOPEN_XCU_VERSION = 4
  1177. const m___API_TO_BE_DEPRECATED = 100000
  1178. const m___API_TO_BE_DEPRECATED_DRIVERKIT = 100000
  1179. const m___API_TO_BE_DEPRECATED_IOS = 100000
  1180. const m___API_TO_BE_DEPRECATED_IOSAPPLICATIONEXTENSION = 100000
  1181. const m___API_TO_BE_DEPRECATED_KERNELKIT = 100000
  1182. const m___API_TO_BE_DEPRECATED_MACCATALYST = 100000
  1183. const m___API_TO_BE_DEPRECATED_MACCATALYSTAPPLICATIONEXTENSION = 100000
  1184. const m___API_TO_BE_DEPRECATED_MACOS = 100000
  1185. const m___API_TO_BE_DEPRECATED_MACOSAPPLICATIONEXTENSION = 100000
  1186. const m___API_TO_BE_DEPRECATED_TVOS = 100000
  1187. const m___API_TO_BE_DEPRECATED_TVOSAPPLICATIONEXTENSION = 100000
  1188. const m___API_TO_BE_DEPRECATED_VISIONOS = 100000
  1189. const m___API_TO_BE_DEPRECATED_VISIONOSAPPLICATIONEXTENSION = 100000
  1190. const m___API_TO_BE_DEPRECATED_WATCHOS = 100000
  1191. const m___API_TO_BE_DEPRECATED_WATCHOSAPPLICATIONEXTENSION = 100000
  1192. const m___APPLE_CC__ = 6000
  1193. const m___APPLE__ = 1
  1194. const m___ATOMIC_ACQUIRE = 2
  1195. const m___ATOMIC_ACQ_REL = 4
  1196. const m___ATOMIC_CONSUME = 1
  1197. const m___ATOMIC_RELAXED = 0
  1198. const m___ATOMIC_RELEASE = 3
  1199. const m___ATOMIC_SEQ_CST = 5
  1200. const m___AVAILABILITY_FILE = "AvailabilityVersions.h"
  1201. const m___AVAILABILITY_VERSIONS_VERSION_HASH = 93585900
  1202. const m___AVAILABILITY_VERSIONS_VERSION_STRING = "Local"
  1203. const m___BIGGEST_ALIGNMENT__ = 16
  1204. const m___BITINT_MAXWIDTH__ = 8388608
  1205. const m___BLOCKS__ = 1
  1206. const m___BOOL_WIDTH__ = 8
  1207. const m___BRIDGEOS_2_0 = 20000
  1208. const m___BRIDGEOS_3_0 = 30000
  1209. const m___BRIDGEOS_3_1 = 30100
  1210. const m___BRIDGEOS_3_4 = 30400
  1211. const m___BRIDGEOS_4_0 = 40000
  1212. const m___BRIDGEOS_4_1 = 40100
  1213. const m___BRIDGEOS_5_0 = 50000
  1214. const m___BRIDGEOS_5_1 = 50100
  1215. const m___BRIDGEOS_5_3 = 50300
  1216. const m___BRIDGEOS_6_0 = 60000
  1217. const m___BRIDGEOS_6_2 = 60200
  1218. const m___BRIDGEOS_6_4 = 60400
  1219. const m___BRIDGEOS_6_5 = 60500
  1220. const m___BRIDGEOS_6_6 = 60600
  1221. const m___BRIDGEOS_7_0 = 70000
  1222. const m___BRIDGEOS_7_1 = 70100
  1223. const m___BRIDGEOS_7_2 = 70200
  1224. const m___BRIDGEOS_7_3 = 70300
  1225. const m___BRIDGEOS_7_4 = 70400
  1226. const m___BRIDGEOS_7_6 = 70600
  1227. const m___BRIDGEOS_8_0 = 80000
  1228. const m___BRIDGEOS_8_1 = 80100
  1229. const m___BRIDGEOS_8_2 = 80200
  1230. const m___BRIDGEOS_8_3 = 80300
  1231. const m___BRIDGEOS_8_4 = 80400
  1232. const m___BRIDGEOS_8_5 = 80500
  1233. const m___BRIDGEOS_8_6 = 80600
  1234. const m___BRIDGEOS_9_0 = 90000
  1235. const m___BRIDGEOS_9_1 = 90100
  1236. const m___BRIDGEOS_9_2 = 90200
  1237. const m___BRIDGEOS_9_3 = 90300
  1238. const m___BRIDGEOS_9_4 = 90400
  1239. const m___BYTE_ORDER__ = "__ORDER_LITTLE_ENDIAN__"
  1240. const m___CCGO__ = 1
  1241. const m___CHAR_BIT__ = 8
  1242. const m___CLANG_ATOMIC_BOOL_LOCK_FREE = 2
  1243. const m___CLANG_ATOMIC_CHAR16_T_LOCK_FREE = 2
  1244. const m___CLANG_ATOMIC_CHAR32_T_LOCK_FREE = 2
  1245. const m___CLANG_ATOMIC_CHAR_LOCK_FREE = 2
  1246. const m___CLANG_ATOMIC_INT_LOCK_FREE = 2
  1247. const m___CLANG_ATOMIC_LLONG_LOCK_FREE = 2
  1248. const m___CLANG_ATOMIC_LONG_LOCK_FREE = 2
  1249. const m___CLANG_ATOMIC_POINTER_LOCK_FREE = 2
  1250. const m___CLANG_ATOMIC_SHORT_LOCK_FREE = 2
  1251. const m___CLANG_ATOMIC_WCHAR_T_LOCK_FREE = 2
  1252. const m___CONSTANT_CFSTRINGS__ = 1
  1253. const m___DARWIN_64_BIT_INO_T = 1
  1254. const m___DARWIN_BIG_ENDIAN = 4321
  1255. const m___DARWIN_BYTE_ORDER = "__DARWIN_LITTLE_ENDIAN"
  1256. const m___DARWIN_C_ANSI = 010000
  1257. const m___DARWIN_C_FULL = 900000
  1258. const m___DARWIN_C_LEVEL = "__DARWIN_C_FULL"
  1259. const m___DARWIN_FD_SETSIZE = 1024
  1260. const m___DARWIN_LITTLE_ENDIAN = 1234
  1261. const m___DARWIN_NBBY = 8
  1262. const m___DARWIN_NON_CANCELABLE = 0
  1263. const m___DARWIN_NO_LONG_LONG = 0
  1264. const m___DARWIN_NSIG = 32
  1265. const m___DARWIN_ONLY_64_BIT_INO_T = 0
  1266. const m___DARWIN_ONLY_UNIX_CONFORMANCE = 1
  1267. const m___DARWIN_ONLY_VERS_1050 = 0
  1268. const m___DARWIN_PDP_ENDIAN = 3412
  1269. const m___DARWIN_SUF_1050 = "$1050"
  1270. const m___DARWIN_SUF_64_BIT_INO_T = "$INODE64"
  1271. const m___DARWIN_SUF_EXTSN = "$DARWIN_EXTSN"
  1272. const m___DARWIN_UNIX03 = 1
  1273. const m___DARWIN_VERS_1050 = 1
  1274. const m___DARWIN_WCHAR_MAX = "__WCHAR_MAX__"
  1275. const m___DBL_DECIMAL_DIG__ = 17
  1276. const m___DBL_DENORM_MIN__ = 4.9406564584124654e-324
  1277. const m___DBL_DIG__ = 15
  1278. const m___DBL_EPSILON__ = 2.2204460492503131e-16
  1279. const m___DBL_HAS_DENORM__ = 1
  1280. const m___DBL_HAS_INFINITY__ = 1
  1281. const m___DBL_HAS_QUIET_NAN__ = 1
  1282. const m___DBL_MANT_DIG__ = 53
  1283. const m___DBL_MAX_10_EXP__ = 308
  1284. const m___DBL_MAX_EXP__ = 1024
  1285. const m___DBL_MAX__ = 1.7976931348623157e+308
  1286. const m___DBL_MIN__ = 2.2250738585072014e-308
  1287. const m___DBL_NORM_MAX__ = 1.7976931348623157e+308
  1288. const m___DECIMAL_DIG__ = "__LDBL_DECIMAL_DIG__"
  1289. const m___DRIVERKIT_19_0 = 190000
  1290. const m___DRIVERKIT_20_0 = 200000
  1291. const m___DRIVERKIT_21_0 = 210000
  1292. const m___DRIVERKIT_22_0 = 220000
  1293. const m___DRIVERKIT_22_4 = 220400
  1294. const m___DRIVERKIT_22_5 = 220500
  1295. const m___DRIVERKIT_22_6 = 220600
  1296. const m___DRIVERKIT_23_0 = 230000
  1297. const m___DRIVERKIT_23_1 = 230100
  1298. const m___DRIVERKIT_23_2 = 230200
  1299. const m___DRIVERKIT_23_3 = 230300
  1300. const m___DRIVERKIT_23_4 = 230400
  1301. const m___DRIVERKIT_23_5 = 230500
  1302. const m___DRIVERKIT_23_6 = 230600
  1303. const m___DRIVERKIT_24_0 = 240000
  1304. const m___DRIVERKIT_24_1 = 240100
  1305. const m___DRIVERKIT_24_2 = 240200
  1306. const m___DRIVERKIT_24_3 = 240300
  1307. const m___DRIVERKIT_24_4 = 240400
  1308. const m___DYNAMIC__ = 1
  1309. const m___ENABLE_LEGACY_MAC_AVAILABILITY = 1
  1310. const m___ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ = 150000
  1311. const m___ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ = 150000
  1312. const m___FINITE_MATH_ONLY__ = 0
  1313. const m___FLT16_DECIMAL_DIG__ = 5
  1314. const m___FLT16_DENORM_MIN__ = 5.9604644775390625e-8
  1315. const m___FLT16_DIG__ = 3
  1316. const m___FLT16_EPSILON__ = 9.765625e-4
  1317. const m___FLT16_HAS_DENORM__ = 1
  1318. const m___FLT16_HAS_INFINITY__ = 1
  1319. const m___FLT16_HAS_QUIET_NAN__ = 1
  1320. const m___FLT16_MANT_DIG__ = 11
  1321. const m___FLT16_MAX_10_EXP__ = 4
  1322. const m___FLT16_MAX_EXP__ = 16
  1323. const m___FLT16_MAX__ = 6.5504e+4
  1324. const m___FLT16_MIN__ = 6.103515625e-5
  1325. const m___FLT16_NORM_MAX__ = 6.5504e+4
  1326. const m___FLT_DECIMAL_DIG__ = 9
  1327. const m___FLT_DENORM_MIN__ = 1.40129846e-45
  1328. const m___FLT_DIG__ = 6
  1329. const m___FLT_EPSILON__ = 1.19209290e-7
  1330. const m___FLT_HAS_DENORM__ = 1
  1331. const m___FLT_HAS_INFINITY__ = 1
  1332. const m___FLT_HAS_QUIET_NAN__ = 1
  1333. const m___FLT_MANT_DIG__ = 24
  1334. const m___FLT_MAX_10_EXP__ = 38
  1335. const m___FLT_MAX_EXP__ = 128
  1336. const m___FLT_MAX__ = 3.40282347e+38
  1337. const m___FLT_MIN__ = 1.17549435e-38
  1338. const m___FLT_NORM_MAX__ = 3.40282347e+38
  1339. const m___FLT_RADIX__ = 2
  1340. const m___FPCLASS_NEGINF = 0x0004
  1341. const m___FPCLASS_NEGNORMAL = 0x0008
  1342. const m___FPCLASS_NEGSUBNORMAL = 0x0010
  1343. const m___FPCLASS_NEGZERO = 0x0020
  1344. const m___FPCLASS_POSINF = 0x0200
  1345. const m___FPCLASS_POSNORMAL = 0x0100
  1346. const m___FPCLASS_POSSUBNORMAL = 0x0080
  1347. const m___FPCLASS_POSZERO = 0x0040
  1348. const m___FPCLASS_QNAN = 0x0002
  1349. const m___FPCLASS_SNAN = 0x0001
  1350. const m___FUNCTION__ = "__func__"
  1351. const m___FXSR__ = 1
  1352. const m___GCC_ASM_FLAG_OUTPUTS__ = 1
  1353. const m___GCC_ATOMIC_BOOL_LOCK_FREE = 2
  1354. const m___GCC_ATOMIC_CHAR16_T_LOCK_FREE = 2
  1355. const m___GCC_ATOMIC_CHAR32_T_LOCK_FREE = 2
  1356. const m___GCC_ATOMIC_CHAR_LOCK_FREE = 2
  1357. const m___GCC_ATOMIC_INT_LOCK_FREE = 2
  1358. const m___GCC_ATOMIC_LLONG_LOCK_FREE = 2
  1359. const m___GCC_ATOMIC_LONG_LOCK_FREE = 2
  1360. const m___GCC_ATOMIC_POINTER_LOCK_FREE = 2
  1361. const m___GCC_ATOMIC_SHORT_LOCK_FREE = 2
  1362. const m___GCC_ATOMIC_TEST_AND_SET_TRUEVAL = 1
  1363. const m___GCC_ATOMIC_WCHAR_T_LOCK_FREE = 2
  1364. const m___GCC_CONSTRUCTIVE_SIZE = 64
  1365. const m___GCC_DESTRUCTIVE_SIZE = 64
  1366. const m___GCC_HAVE_DWARF2_CFI_ASM = 1
  1367. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 = 1
  1368. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 = 1
  1369. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 = 1
  1370. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 = 1
  1371. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 = 1
  1372. const m___GNUC_MINOR__ = 2
  1373. const m___GNUC_PATCHLEVEL__ = 1
  1374. const m___GNUC_STDC_INLINE__ = 1
  1375. const m___GNUC__ = 4
  1376. const m___GXX_ABI_VERSION = 1002
  1377. const m___INT16_FMTd__ = "hd"
  1378. const m___INT16_FMTi__ = "hi"
  1379. const m___INT16_MAX__ = 32767
  1380. const m___INT16_TYPE__ = "short"
  1381. const m___INT32_FMTd__ = "d"
  1382. const m___INT32_FMTi__ = "i"
  1383. const m___INT32_MAX__ = 2147483647
  1384. const m___INT32_TYPE__ = "int"
  1385. const m___INT64_C_SUFFIX__ = "LL"
  1386. const m___INT64_FMTd__ = "lld"
  1387. const m___INT64_FMTi__ = "lli"
  1388. const m___INT64_MAX__ = 9223372036854775807
  1389. const m___INT8_FMTd__ = "hhd"
  1390. const m___INT8_FMTi__ = "hhi"
  1391. const m___INT8_MAX__ = 127
  1392. const m___INTMAX_C_SUFFIX__ = "L"
  1393. const m___INTMAX_FMTd__ = "ld"
  1394. const m___INTMAX_FMTi__ = "li"
  1395. const m___INTMAX_MAX__ = 9223372036854775807
  1396. const m___INTMAX_WIDTH__ = 64
  1397. const m___INTPTR_FMTd__ = "ld"
  1398. const m___INTPTR_FMTi__ = "li"
  1399. const m___INTPTR_MAX__ = 9223372036854775807
  1400. const m___INTPTR_WIDTH__ = 64
  1401. const m___INT_FAST16_FMTd__ = "hd"
  1402. const m___INT_FAST16_FMTi__ = "hi"
  1403. const m___INT_FAST16_MAX__ = 32767
  1404. const m___INT_FAST16_TYPE__ = "short"
  1405. const m___INT_FAST16_WIDTH__ = 16
  1406. const m___INT_FAST32_FMTd__ = "d"
  1407. const m___INT_FAST32_FMTi__ = "i"
  1408. const m___INT_FAST32_MAX__ = 2147483647
  1409. const m___INT_FAST32_TYPE__ = "int"
  1410. const m___INT_FAST32_WIDTH__ = 32
  1411. const m___INT_FAST64_FMTd__ = "lld"
  1412. const m___INT_FAST64_FMTi__ = "lli"
  1413. const m___INT_FAST64_MAX__ = 9223372036854775807
  1414. const m___INT_FAST64_WIDTH__ = 64
  1415. const m___INT_FAST8_FMTd__ = "hhd"
  1416. const m___INT_FAST8_FMTi__ = "hhi"
  1417. const m___INT_FAST8_MAX__ = 127
  1418. const m___INT_FAST8_WIDTH__ = 8
  1419. const m___INT_LEAST16_FMTd__ = "hd"
  1420. const m___INT_LEAST16_FMTi__ = "hi"
  1421. const m___INT_LEAST16_MAX__ = 32767
  1422. const m___INT_LEAST16_TYPE__ = "short"
  1423. const m___INT_LEAST16_WIDTH__ = 16
  1424. const m___INT_LEAST32_FMTd__ = "d"
  1425. const m___INT_LEAST32_FMTi__ = "i"
  1426. const m___INT_LEAST32_MAX__ = 2147483647
  1427. const m___INT_LEAST32_TYPE__ = "int"
  1428. const m___INT_LEAST32_WIDTH__ = 32
  1429. const m___INT_LEAST64_FMTd__ = "lld"
  1430. const m___INT_LEAST64_FMTi__ = "lli"
  1431. const m___INT_LEAST64_MAX = "INT64_MAX"
  1432. const m___INT_LEAST64_MAX__ = 9223372036854775807
  1433. const m___INT_LEAST64_MIN = "INT64_MIN"
  1434. const m___INT_LEAST64_WIDTH__ = 64
  1435. const m___INT_LEAST8_FMTd__ = "hhd"
  1436. const m___INT_LEAST8_FMTi__ = "hhi"
  1437. const m___INT_LEAST8_MAX__ = 127
  1438. const m___INT_LEAST8_WIDTH__ = 8
  1439. const m___INT_MAX__ = 2147483647
  1440. const m___INT_WIDTH__ = 32
  1441. const m___IPHONE_10_0 = 100000
  1442. const m___IPHONE_10_1 = 100100
  1443. const m___IPHONE_10_2 = 100200
  1444. const m___IPHONE_10_3 = 100300
  1445. const m___IPHONE_11_0 = 110000
  1446. const m___IPHONE_11_1 = 110100
  1447. const m___IPHONE_11_2 = 110200
  1448. const m___IPHONE_11_3 = 110300
  1449. const m___IPHONE_11_4 = 110400
  1450. const m___IPHONE_12_0 = 120000
  1451. const m___IPHONE_12_1 = 120100
  1452. const m___IPHONE_12_2 = 120200
  1453. const m___IPHONE_12_3 = 120300
  1454. const m___IPHONE_12_4 = 120400
  1455. const m___IPHONE_13_0 = 130000
  1456. const m___IPHONE_13_1 = 130100
  1457. const m___IPHONE_13_2 = 130200
  1458. const m___IPHONE_13_3 = 130300
  1459. const m___IPHONE_13_4 = 130400
  1460. const m___IPHONE_13_5 = 130500
  1461. const m___IPHONE_13_6 = 130600
  1462. const m___IPHONE_13_7 = 130700
  1463. const m___IPHONE_14_0 = 140000
  1464. const m___IPHONE_14_1 = 140100
  1465. const m___IPHONE_14_2 = 140200
  1466. const m___IPHONE_14_3 = 140300
  1467. const m___IPHONE_14_4 = 140400
  1468. const m___IPHONE_14_5 = 140500
  1469. const m___IPHONE_14_6 = 140600
  1470. const m___IPHONE_14_7 = 140700
  1471. const m___IPHONE_14_8 = 140800
  1472. const m___IPHONE_15_0 = 150000
  1473. const m___IPHONE_15_1 = 150100
  1474. const m___IPHONE_15_2 = 150200
  1475. const m___IPHONE_15_3 = 150300
  1476. const m___IPHONE_15_4 = 150400
  1477. const m___IPHONE_15_5 = 150500
  1478. const m___IPHONE_15_6 = 150600
  1479. const m___IPHONE_15_7 = 150700
  1480. const m___IPHONE_15_8 = 150800
  1481. const m___IPHONE_16_0 = 160000
  1482. const m___IPHONE_16_1 = 160100
  1483. const m___IPHONE_16_2 = 160200
  1484. const m___IPHONE_16_3 = 160300
  1485. const m___IPHONE_16_4 = 160400
  1486. const m___IPHONE_16_5 = 160500
  1487. const m___IPHONE_16_6 = 160600
  1488. const m___IPHONE_16_7 = 160700
  1489. const m___IPHONE_17_0 = 170000
  1490. const m___IPHONE_17_1 = 170100
  1491. const m___IPHONE_17_2 = 170200
  1492. const m___IPHONE_17_3 = 170300
  1493. const m___IPHONE_17_4 = 170400
  1494. const m___IPHONE_17_5 = 170500
  1495. const m___IPHONE_17_6 = 170600
  1496. const m___IPHONE_17_7 = 170700
  1497. const m___IPHONE_18_0 = 180000
  1498. const m___IPHONE_18_1 = 180100
  1499. const m___IPHONE_18_2 = 180200
  1500. const m___IPHONE_18_3 = 180300
  1501. const m___IPHONE_18_4 = 180400
  1502. const m___IPHONE_2_0 = 20000
  1503. const m___IPHONE_2_1 = 20100
  1504. const m___IPHONE_2_2 = 20200
  1505. const m___IPHONE_3_0 = 30000
  1506. const m___IPHONE_3_1 = 30100
  1507. const m___IPHONE_3_2 = 30200
  1508. const m___IPHONE_4_0 = 40000
  1509. const m___IPHONE_4_1 = 40100
  1510. const m___IPHONE_4_2 = 40200
  1511. const m___IPHONE_4_3 = 40300
  1512. const m___IPHONE_5_0 = 50000
  1513. const m___IPHONE_5_1 = 50100
  1514. const m___IPHONE_6_0 = 60000
  1515. const m___IPHONE_6_1 = 60100
  1516. const m___IPHONE_7_0 = 70000
  1517. const m___IPHONE_7_1 = 70100
  1518. const m___IPHONE_8_0 = 80000
  1519. const m___IPHONE_8_1 = 80100
  1520. const m___IPHONE_8_2 = 80200
  1521. const m___IPHONE_8_3 = 80300
  1522. const m___IPHONE_8_4 = 80400
  1523. const m___IPHONE_9_0 = 90000
  1524. const m___IPHONE_9_1 = 90100
  1525. const m___IPHONE_9_2 = 90200
  1526. const m___IPHONE_9_3 = 90300
  1527. const m___LAHF_SAHF__ = 1
  1528. const m___LASTBRANCH_MAX = 32
  1529. const m___LDBL_DECIMAL_DIG__ = 17
  1530. const m___LDBL_DENORM_MIN__ = 4.9406564584124654e-324
  1531. const m___LDBL_DIG__ = 15
  1532. const m___LDBL_EPSILON__ = 2.2204460492503131e-16
  1533. const m___LDBL_HAS_DENORM__ = 1
  1534. const m___LDBL_HAS_INFINITY__ = 1
  1535. const m___LDBL_HAS_QUIET_NAN__ = 1
  1536. const m___LDBL_MANT_DIG__ = 53
  1537. const m___LDBL_MAX_10_EXP__ = 308
  1538. const m___LDBL_MAX_EXP__ = 1024
  1539. const m___LDBL_MAX__ = 1.7976931348623157e+308
  1540. const m___LDBL_MIN__ = 2.2250738585072014e-308
  1541. const m___LDBL_NORM_MAX__ = 1.7976931348623157e+308
  1542. const m___LITTLE_ENDIAN__ = 1
  1543. const m___LLONG_WIDTH__ = 64
  1544. const m___LONG_LONG_MAX__ = 9223372036854775807
  1545. const m___LONG_MAX__ = 9223372036854775807
  1546. const m___LONG_WIDTH__ = 64
  1547. const m___LP64_OFF64 = 1
  1548. const m___LP64__ = 1
  1549. const m___LPBIG_OFFBIG = 1
  1550. const m___MACH__ = 1
  1551. const m___MAC_10_0 = 1000
  1552. const m___MAC_10_1 = 1010
  1553. const m___MAC_10_10 = 101000
  1554. const m___MAC_10_10_2 = 101002
  1555. const m___MAC_10_10_3 = 101003
  1556. const m___MAC_10_11 = 101100
  1557. const m___MAC_10_11_2 = 101102
  1558. const m___MAC_10_11_3 = 101103
  1559. const m___MAC_10_11_4 = 101104
  1560. const m___MAC_10_12 = 101200
  1561. const m___MAC_10_12_1 = 101201
  1562. const m___MAC_10_12_2 = 101202
  1563. const m___MAC_10_12_4 = 101204
  1564. const m___MAC_10_13 = 101300
  1565. const m___MAC_10_13_1 = 101301
  1566. const m___MAC_10_13_2 = 101302
  1567. const m___MAC_10_13_4 = 101304
  1568. const m___MAC_10_14 = 101400
  1569. const m___MAC_10_14_1 = 101401
  1570. const m___MAC_10_14_4 = 101404
  1571. const m___MAC_10_14_5 = 101405
  1572. const m___MAC_10_14_6 = 101406
  1573. const m___MAC_10_15 = 101500
  1574. const m___MAC_10_15_1 = 101501
  1575. const m___MAC_10_15_4 = 101504
  1576. const m___MAC_10_16 = 101600
  1577. const m___MAC_10_2 = 1020
  1578. const m___MAC_10_3 = 1030
  1579. const m___MAC_10_4 = 1040
  1580. const m___MAC_10_5 = 1050
  1581. const m___MAC_10_6 = 1060
  1582. const m___MAC_10_7 = 1070
  1583. const m___MAC_10_8 = 1080
  1584. const m___MAC_10_9 = 1090
  1585. const m___MAC_11_0 = 110000
  1586. const m___MAC_11_1 = 110100
  1587. const m___MAC_11_3 = 110300
  1588. const m___MAC_11_4 = 110400
  1589. const m___MAC_11_5 = 110500
  1590. const m___MAC_11_6 = 110600
  1591. const m___MAC_12_0 = 120000
  1592. const m___MAC_12_1 = 120100
  1593. const m___MAC_12_2 = 120200
  1594. const m___MAC_12_3 = 120300
  1595. const m___MAC_12_4 = 120400
  1596. const m___MAC_12_5 = 120500
  1597. const m___MAC_12_6 = 120600
  1598. const m___MAC_12_7 = 120700
  1599. const m___MAC_13_0 = 130000
  1600. const m___MAC_13_1 = 130100
  1601. const m___MAC_13_2 = 130200
  1602. const m___MAC_13_3 = 130300
  1603. const m___MAC_13_4 = 130400
  1604. const m___MAC_13_5 = 130500
  1605. const m___MAC_13_6 = 130600
  1606. const m___MAC_13_7 = 130700
  1607. const m___MAC_14_0 = 140000
  1608. const m___MAC_14_1 = 140100
  1609. const m___MAC_14_2 = 140200
  1610. const m___MAC_14_3 = 140300
  1611. const m___MAC_14_4 = 140400
  1612. const m___MAC_14_5 = 140500
  1613. const m___MAC_14_6 = 140600
  1614. const m___MAC_14_7 = 140700
  1615. const m___MAC_15_0 = 150000
  1616. const m___MAC_15_1 = 150100
  1617. const m___MAC_15_2 = 150200
  1618. const m___MAC_15_3 = 150300
  1619. const m___MAC_15_4 = 150400
  1620. const m___MAC_OS_X_VERSION_MAX_ALLOWED = "__MAC_15_4"
  1621. const m___MAC_OS_X_VERSION_MIN_REQUIRED = "__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__"
  1622. const m___MEMORY_SCOPE_DEVICE = 1
  1623. const m___MEMORY_SCOPE_SINGLE = 4
  1624. const m___MEMORY_SCOPE_SYSTEM = 0
  1625. const m___MEMORY_SCOPE_WRKGRP = 2
  1626. const m___MEMORY_SCOPE_WVFRNT = 3
  1627. const m___MMX__ = 1
  1628. const m___NO_INLINE__ = 1
  1629. const m___NO_MATH_ERRNO__ = 1
  1630. const m___NO_MATH_INLINES = 1
  1631. const m___OBJC_BOOL_IS_BOOL = 0
  1632. const m___OPENCL_MEMORY_SCOPE_ALL_SVM_DEVICES = 3
  1633. const m___OPENCL_MEMORY_SCOPE_DEVICE = 2
  1634. const m___OPENCL_MEMORY_SCOPE_SUB_GROUP = 4
  1635. const m___OPENCL_MEMORY_SCOPE_WORK_GROUP = 1
  1636. const m___OPENCL_MEMORY_SCOPE_WORK_ITEM = 0
  1637. const m___ORDER_BIG_ENDIAN__ = 4321
  1638. const m___ORDER_LITTLE_ENDIAN__ = 1234
  1639. const m___ORDER_PDP_ENDIAN__ = 3412
  1640. const m___PIC__ = 2
  1641. const m___POINTER_WIDTH__ = 64
  1642. const m___PRAGMA_REDEFINE_EXTNAME = 1
  1643. const m___PRETTY_FUNCTION__ = "__func__"
  1644. const m___PTHREAD_ATTR_SIZE__ = 56
  1645. const m___PTHREAD_CONDATTR_SIZE__ = 8
  1646. const m___PTHREAD_COND_SIZE__ = 40
  1647. const m___PTHREAD_MUTEXATTR_SIZE__ = 8
  1648. const m___PTHREAD_MUTEX_SIZE__ = 56
  1649. const m___PTHREAD_ONCE_SIZE__ = 8
  1650. const m___PTHREAD_RWLOCKATTR_SIZE__ = 16
  1651. const m___PTHREAD_RWLOCK_SIZE__ = 192
  1652. const m___PTHREAD_SIZE__ = 8176
  1653. const m___PTRDIFF_FMTd__ = "ld"
  1654. const m___PTRDIFF_FMTi__ = "li"
  1655. const m___PTRDIFF_MAX__ = 9223372036854775807
  1656. const m___PTRDIFF_WIDTH__ = 64
  1657. const m___SALC = 0x4000
  1658. const m___SAPP = 0x0100
  1659. const m___SCHAR_MAX__ = 127
  1660. const m___SEG_FS = 1
  1661. const m___SEG_GS = 1
  1662. const m___SEOF = 0x0020
  1663. const m___SERR = 0x0040
  1664. const m___SHRT_MAX__ = 32767
  1665. const m___SHRT_WIDTH__ = 16
  1666. const m___SIGN = 0x8000
  1667. const m___SIG_ATOMIC_MAX__ = 2147483647
  1668. const m___SIG_ATOMIC_WIDTH__ = 32
  1669. const m___SIZEOF_DOUBLE__ = 8
  1670. const m___SIZEOF_FLOAT__ = 4
  1671. const m___SIZEOF_INT128__ = 16
  1672. const m___SIZEOF_INT__ = 4
  1673. const m___SIZEOF_LONG_DOUBLE__ = 8
  1674. const m___SIZEOF_LONG_LONG__ = 8
  1675. const m___SIZEOF_LONG__ = 8
  1676. const m___SIZEOF_POINTER__ = 8
  1677. const m___SIZEOF_PTRDIFF_T__ = 8
  1678. const m___SIZEOF_SHORT__ = 2
  1679. const m___SIZEOF_SIZE_T__ = 8
  1680. const m___SIZEOF_WCHAR_T__ = 4
  1681. const m___SIZEOF_WINT_T__ = 4
  1682. const m___SIZE_FMTX__ = "lX"
  1683. const m___SIZE_FMTo__ = "lo"
  1684. const m___SIZE_FMTu__ = "lu"
  1685. const m___SIZE_FMTx__ = "lx"
  1686. const m___SIZE_MAX__ = 18446744073709551615
  1687. const m___SIZE_WIDTH__ = 64
  1688. const m___SLBF = 0x0001
  1689. const m___SMBF = 0x0080
  1690. const m___SMOD = 0x2000
  1691. const m___SNBF = 0x0002
  1692. const m___SNPT = 0x0800
  1693. const m___SOFF = 0x1000
  1694. const m___SOPT = 0x0400
  1695. const m___SRD = 0x0004
  1696. const m___SRW = 0x0010
  1697. const m___SSE2_MATH__ = 1
  1698. const m___SSE2__ = 1
  1699. const m___SSE3__ = 1
  1700. const m___SSE4_1__ = 1
  1701. const m___SSE_MATH__ = 1
  1702. const m___SSE__ = 1
  1703. const m___SSP__ = 1
  1704. const m___SSSE3__ = 1
  1705. const m___SSTR = 0x0200
  1706. const m___STDC_EMBED_EMPTY__ = 2
  1707. const m___STDC_EMBED_FOUND__ = 1
  1708. const m___STDC_EMBED_NOT_FOUND__ = 0
  1709. const m___STDC_HOSTED__ = 1
  1710. const m___STDC_NO_THREADS__ = 1
  1711. const m___STDC_UTF_16__ = 1
  1712. const m___STDC_UTF_32__ = 1
  1713. const m___STDC_VERSION__ = 201710
  1714. const m___STDC_WANT_LIB_EXT1__ = 1
  1715. const m___STDC__ = 1
  1716. const m___SWR = 0x0008
  1717. const m___TVOS_10_0 = 100000
  1718. const m___TVOS_10_0_1 = 100001
  1719. const m___TVOS_10_1 = 100100
  1720. const m___TVOS_10_2 = 100200
  1721. const m___TVOS_11_0 = 110000
  1722. const m___TVOS_11_1 = 110100
  1723. const m___TVOS_11_2 = 110200
  1724. const m___TVOS_11_3 = 110300
  1725. const m___TVOS_11_4 = 110400
  1726. const m___TVOS_12_0 = 120000
  1727. const m___TVOS_12_1 = 120100
  1728. const m___TVOS_12_2 = 120200
  1729. const m___TVOS_12_3 = 120300
  1730. const m___TVOS_12_4 = 120400
  1731. const m___TVOS_13_0 = 130000
  1732. const m___TVOS_13_2 = 130200
  1733. const m___TVOS_13_3 = 130300
  1734. const m___TVOS_13_4 = 130400
  1735. const m___TVOS_14_0 = 140000
  1736. const m___TVOS_14_1 = 140100
  1737. const m___TVOS_14_2 = 140200
  1738. const m___TVOS_14_3 = 140300
  1739. const m___TVOS_14_5 = 140500
  1740. const m___TVOS_14_6 = 140600
  1741. const m___TVOS_14_7 = 140700
  1742. const m___TVOS_15_0 = 150000
  1743. const m___TVOS_15_1 = 150100
  1744. const m___TVOS_15_2 = 150200
  1745. const m___TVOS_15_3 = 150300
  1746. const m___TVOS_15_4 = 150400
  1747. const m___TVOS_15_5 = 150500
  1748. const m___TVOS_15_6 = 150600
  1749. const m___TVOS_16_0 = 160000
  1750. const m___TVOS_16_1 = 160100
  1751. const m___TVOS_16_2 = 160200
  1752. const m___TVOS_16_3 = 160300
  1753. const m___TVOS_16_4 = 160400
  1754. const m___TVOS_16_5 = 160500
  1755. const m___TVOS_16_6 = 160600
  1756. const m___TVOS_17_0 = 170000
  1757. const m___TVOS_17_1 = 170100
  1758. const m___TVOS_17_2 = 170200
  1759. const m___TVOS_17_3 = 170300
  1760. const m___TVOS_17_4 = 170400
  1761. const m___TVOS_17_5 = 170500
  1762. const m___TVOS_17_6 = 170600
  1763. const m___TVOS_18_0 = 180000
  1764. const m___TVOS_18_1 = 180100
  1765. const m___TVOS_18_2 = 180200
  1766. const m___TVOS_18_3 = 180300
  1767. const m___TVOS_18_4 = 180400
  1768. const m___TVOS_9_0 = 90000
  1769. const m___TVOS_9_1 = 90100
  1770. const m___TVOS_9_2 = 90200
  1771. const m___UINT16_FMTX__ = "hX"
  1772. const m___UINT16_FMTo__ = "ho"
  1773. const m___UINT16_FMTu__ = "hu"
  1774. const m___UINT16_FMTx__ = "hx"
  1775. const m___UINT16_MAX__ = 65535
  1776. const m___UINT32_C_SUFFIX__ = "U"
  1777. const m___UINT32_FMTX__ = "X"
  1778. const m___UINT32_FMTo__ = "o"
  1779. const m___UINT32_FMTu__ = "u"
  1780. const m___UINT32_FMTx__ = "x"
  1781. const m___UINT32_MAX__ = 4294967295
  1782. const m___UINT64_C_SUFFIX__ = "ULL"
  1783. const m___UINT64_FMTX__ = "llX"
  1784. const m___UINT64_FMTo__ = "llo"
  1785. const m___UINT64_FMTu__ = "llu"
  1786. const m___UINT64_FMTx__ = "llx"
  1787. const m___UINT64_MAX__ = "18446744073709551615U"
  1788. const m___UINT8_FMTX__ = "hhX"
  1789. const m___UINT8_FMTo__ = "hho"
  1790. const m___UINT8_FMTu__ = "hhu"
  1791. const m___UINT8_FMTx__ = "hhx"
  1792. const m___UINT8_MAX__ = 255
  1793. const m___UINTMAX_C_SUFFIX__ = "UL"
  1794. const m___UINTMAX_FMTX__ = "lX"
  1795. const m___UINTMAX_FMTo__ = "lo"
  1796. const m___UINTMAX_FMTu__ = "lu"
  1797. const m___UINTMAX_FMTx__ = "lx"
  1798. const m___UINTMAX_MAX__ = 18446744073709551615
  1799. const m___UINTMAX_WIDTH__ = 64
  1800. const m___UINTPTR_FMTX__ = "lX"
  1801. const m___UINTPTR_FMTo__ = "lo"
  1802. const m___UINTPTR_FMTu__ = "lu"
  1803. const m___UINTPTR_FMTx__ = "lx"
  1804. const m___UINTPTR_MAX__ = 18446744073709551615
  1805. const m___UINTPTR_WIDTH__ = 64
  1806. const m___UINT_FAST16_FMTX__ = "hX"
  1807. const m___UINT_FAST16_FMTo__ = "ho"
  1808. const m___UINT_FAST16_FMTu__ = "hu"
  1809. const m___UINT_FAST16_FMTx__ = "hx"
  1810. const m___UINT_FAST16_MAX__ = 65535
  1811. const m___UINT_FAST32_FMTX__ = "X"
  1812. const m___UINT_FAST32_FMTo__ = "o"
  1813. const m___UINT_FAST32_FMTu__ = "u"
  1814. const m___UINT_FAST32_FMTx__ = "x"
  1815. const m___UINT_FAST32_MAX__ = 4294967295
  1816. const m___UINT_FAST64_FMTX__ = "llX"
  1817. const m___UINT_FAST64_FMTo__ = "llo"
  1818. const m___UINT_FAST64_FMTu__ = "llu"
  1819. const m___UINT_FAST64_FMTx__ = "llx"
  1820. const m___UINT_FAST64_MAX__ = "18446744073709551615U"
  1821. const m___UINT_FAST8_FMTX__ = "hhX"
  1822. const m___UINT_FAST8_FMTo__ = "hho"
  1823. const m___UINT_FAST8_FMTu__ = "hhu"
  1824. const m___UINT_FAST8_FMTx__ = "hhx"
  1825. const m___UINT_FAST8_MAX__ = 255
  1826. const m___UINT_LEAST16_FMTX__ = "hX"
  1827. const m___UINT_LEAST16_FMTo__ = "ho"
  1828. const m___UINT_LEAST16_FMTu__ = "hu"
  1829. const m___UINT_LEAST16_FMTx__ = "hx"
  1830. const m___UINT_LEAST16_MAX__ = 65535
  1831. const m___UINT_LEAST32_FMTX__ = "X"
  1832. const m___UINT_LEAST32_FMTo__ = "o"
  1833. const m___UINT_LEAST32_FMTu__ = "u"
  1834. const m___UINT_LEAST32_FMTx__ = "x"
  1835. const m___UINT_LEAST32_MAX__ = 4294967295
  1836. const m___UINT_LEAST64_FMTX__ = "llX"
  1837. const m___UINT_LEAST64_FMTo__ = "llo"
  1838. const m___UINT_LEAST64_FMTu__ = "llu"
  1839. const m___UINT_LEAST64_FMTx__ = "llx"
  1840. const m___UINT_LEAST64_MAX = "UINT64_MAX"
  1841. const m___UINT_LEAST64_MAX__ = "18446744073709551615U"
  1842. const m___UINT_LEAST8_FMTX__ = "hhX"
  1843. const m___UINT_LEAST8_FMTo__ = "hho"
  1844. const m___UINT_LEAST8_FMTu__ = "hhu"
  1845. const m___UINT_LEAST8_FMTx__ = "hhx"
  1846. const m___UINT_LEAST8_MAX__ = 255
  1847. const m___USER_LABEL_PREFIX__ = "_"
  1848. const m___VERSION__ = "Apple LLVM 17.0.0 (clang-1700.0.13.3)"
  1849. const m___VISIONOS_1_0 = 10000
  1850. const m___VISIONOS_1_1 = 10100
  1851. const m___VISIONOS_1_2 = 10200
  1852. const m___VISIONOS_1_3 = 10300
  1853. const m___VISIONOS_2_0 = 20000
  1854. const m___VISIONOS_2_1 = 20100
  1855. const m___VISIONOS_2_2 = 20200
  1856. const m___VISIONOS_2_3 = 20300
  1857. const m___VISIONOS_2_4 = 20400
  1858. const m___WATCHOS_10_0 = 100000
  1859. const m___WATCHOS_10_1 = 100100
  1860. const m___WATCHOS_10_2 = 100200
  1861. const m___WATCHOS_10_3 = 100300
  1862. const m___WATCHOS_10_4 = 100400
  1863. const m___WATCHOS_10_5 = 100500
  1864. const m___WATCHOS_10_6 = 100600
  1865. const m___WATCHOS_10_7 = 100700
  1866. const m___WATCHOS_11_0 = 110000
  1867. const m___WATCHOS_11_1 = 110100
  1868. const m___WATCHOS_11_2 = 110200
  1869. const m___WATCHOS_11_3 = 110300
  1870. const m___WATCHOS_11_4 = 110400
  1871. const m___WATCHOS_1_0 = 10000
  1872. const m___WATCHOS_2_0 = 20000
  1873. const m___WATCHOS_2_1 = 20100
  1874. const m___WATCHOS_2_2 = 20200
  1875. const m___WATCHOS_3_0 = 30000
  1876. const m___WATCHOS_3_1 = 30100
  1877. const m___WATCHOS_3_1_1 = 30101
  1878. const m___WATCHOS_3_2 = 30200
  1879. const m___WATCHOS_4_0 = 40000
  1880. const m___WATCHOS_4_1 = 40100
  1881. const m___WATCHOS_4_2 = 40200
  1882. const m___WATCHOS_4_3 = 40300
  1883. const m___WATCHOS_5_0 = 50000
  1884. const m___WATCHOS_5_1 = 50100
  1885. const m___WATCHOS_5_2 = 50200
  1886. const m___WATCHOS_5_3 = 50300
  1887. const m___WATCHOS_6_0 = 60000
  1888. const m___WATCHOS_6_1 = 60100
  1889. const m___WATCHOS_6_2 = 60200
  1890. const m___WATCHOS_7_0 = 70000
  1891. const m___WATCHOS_7_1 = 70100
  1892. const m___WATCHOS_7_2 = 70200
  1893. const m___WATCHOS_7_3 = 70300
  1894. const m___WATCHOS_7_4 = 70400
  1895. const m___WATCHOS_7_5 = 70500
  1896. const m___WATCHOS_7_6 = 70600
  1897. const m___WATCHOS_8_0 = 80000
  1898. const m___WATCHOS_8_1 = 80100
  1899. const m___WATCHOS_8_3 = 80300
  1900. const m___WATCHOS_8_4 = 80400
  1901. const m___WATCHOS_8_5 = 80500
  1902. const m___WATCHOS_8_6 = 80600
  1903. const m___WATCHOS_8_7 = 80700
  1904. const m___WATCHOS_8_8 = 80800
  1905. const m___WATCHOS_9_0 = 90000
  1906. const m___WATCHOS_9_1 = 90100
  1907. const m___WATCHOS_9_2 = 90200
  1908. const m___WATCHOS_9_3 = 90300
  1909. const m___WATCHOS_9_4 = 90400
  1910. const m___WATCHOS_9_5 = 90500
  1911. const m___WATCHOS_9_6 = 90600
  1912. const m___WCHAR_MAX__ = 2147483647
  1913. const m___WCHAR_TYPE__ = "int"
  1914. const m___WCHAR_WIDTH__ = 32
  1915. const m___WINT_MAX__ = 2147483647
  1916. const m___WINT_TYPE__ = "int"
  1917. const m___WINT_WIDTH__ = 32
  1918. const m___amd64 = 1
  1919. const m___amd64__ = 1
  1920. const m___apple_build_version__ = 17000013
  1921. const m___clang__ = 1
  1922. const m___clang_literal_encoding__ = "UTF-8"
  1923. const m___clang_major__ = 17
  1924. const m___clang_minor__ = 0
  1925. const m___clang_patchlevel__ = 0
  1926. const m___clang_version__ = "17.0.0 (clang-1700.0.13.3)"
  1927. const m___clang_wide_literal_encoding__ = "UTF-32"
  1928. const m___code_model_small__ = 1
  1929. const m___const = "const"
  1930. const m___core2 = 1
  1931. const m___core2__ = 1
  1932. const m___has_bounds_safety_attributes = 0
  1933. const m___has_ptrcheck = 0
  1934. const m___has_safe_buffers = 0
  1935. const m___header_inline = "inline"
  1936. const m___llvm__ = 1
  1937. const m___nonnull = "_Nonnull"
  1938. const m___null_unspecified = "_Null_unspecified"
  1939. const m___nullable = "_Nullable"
  1940. const m___pic__ = 2
  1941. const m___restrict = "restrict"
  1942. const m___restrict_arr = "restrict"
  1943. const m___signed = "signed"
  1944. const m___tune_core2__ = 1
  1945. const m___volatile = "volatile"
  1946. const m___x86_64 = 1
  1947. const m___x86_64__ = 1
  1948. const m_inline = "__inline"
  1949. const m_ru_first = "ru_ixrss"
  1950. const m_ru_last = "ru_nivcsw"
  1951. const m_static_assert = "_Static_assert"
  1952. const m_stderr = "__stderrp"
  1953. const m_stdin = "__stdinp"
  1954. const m_stdout = "__stdoutp"
  1955. const m_sv_onstack = "sv_flags"
  1956. type t__builtin_va_list = uintptr
  1957. type t__predefined_size_t = uint64
  1958. type t__predefined_wchar_t = int32
  1959. type t__predefined_ptrdiff_t = int64
  1960. type Tptrdiff_t = int64
  1961. type Tsize_t = uint64
  1962. type Twchar_t = int32
  1963. type Tmax_align_t = float64
  1964. type t__int8_t = int8
  1965. type t__uint8_t = uint8
  1966. type t__int16_t = int16
  1967. type t__uint16_t = uint16
  1968. type t__int32_t = int32
  1969. type t__uint32_t = uint32
  1970. type t__int64_t = int64
  1971. type t__uint64_t = uint64
  1972. type t__darwin_intptr_t = int64
  1973. type t__darwin_natural_t = uint32
  1974. type t__darwin_ct_rune_t = int32
  1975. type t__mbstate_t = struct {
  1976. F_mbstateL [0]int64
  1977. F__mbstate8 [128]int8
  1978. }
  1979. type t__darwin_mbstate_t = struct {
  1980. F_mbstateL [0]int64
  1981. F__mbstate8 [128]int8
  1982. }
  1983. type t__darwin_ptrdiff_t = int64
  1984. type t__darwin_size_t = uint64
  1985. type t__darwin_va_list = uintptr
  1986. type t__darwin_wchar_t = int32
  1987. type t__darwin_rune_t = int32
  1988. type t__darwin_wint_t = int32
  1989. type t__darwin_clock_t = uint64
  1990. type t__darwin_socklen_t = uint32
  1991. type t__darwin_ssize_t = int64
  1992. type t__darwin_time_t = int64
  1993. type t__darwin_blkcnt_t = int64
  1994. type t__darwin_blksize_t = int32
  1995. type t__darwin_dev_t = int32
  1996. type t__darwin_fsblkcnt_t = uint32
  1997. type t__darwin_fsfilcnt_t = uint32
  1998. type t__darwin_gid_t = uint32
  1999. type t__darwin_id_t = uint32
  2000. type t__darwin_ino64_t = uint64
  2001. type t__darwin_ino_t = uint64
  2002. type t__darwin_mach_port_name_t = uint32
  2003. type t__darwin_mach_port_t = uint32
  2004. type t__darwin_mode_t = uint16
  2005. type t__darwin_off_t = int64
  2006. type t__darwin_pid_t = int32
  2007. type t__darwin_sigset_t = uint32
  2008. type t__darwin_suseconds_t = int32
  2009. type t__darwin_uid_t = uint32
  2010. type t__darwin_useconds_t = uint32
  2011. type t__darwin_uuid_t = [16]uint8
  2012. type t__darwin_uuid_string_t = [37]int8
  2013. type t__darwin_pthread_handler_rec = struct {
  2014. F__routine uintptr
  2015. F__arg uintptr
  2016. F__next uintptr
  2017. }
  2018. type T_opaque_pthread_attr_t = struct {
  2019. F__sig int64
  2020. F__opaque [56]int8
  2021. }
  2022. type T_opaque_pthread_cond_t = struct {
  2023. F__sig int64
  2024. F__opaque [40]int8
  2025. }
  2026. type T_opaque_pthread_condattr_t = struct {
  2027. F__sig int64
  2028. F__opaque [8]int8
  2029. }
  2030. type T_opaque_pthread_mutex_t = struct {
  2031. F__sig int64
  2032. F__opaque [56]int8
  2033. }
  2034. type T_opaque_pthread_mutexattr_t = struct {
  2035. F__sig int64
  2036. F__opaque [8]int8
  2037. }
  2038. type T_opaque_pthread_once_t = struct {
  2039. F__sig int64
  2040. F__opaque [8]int8
  2041. }
  2042. type T_opaque_pthread_rwlock_t = struct {
  2043. F__sig int64
  2044. F__opaque [192]int8
  2045. }
  2046. type T_opaque_pthread_rwlockattr_t = struct {
  2047. F__sig int64
  2048. F__opaque [16]int8
  2049. }
  2050. type T_opaque_pthread_t = struct {
  2051. F__sig int64
  2052. F__cleanup_stack uintptr
  2053. F__opaque [8176]int8
  2054. }
  2055. type t__darwin_pthread_attr_t = struct {
  2056. F__sig int64
  2057. F__opaque [56]int8
  2058. }
  2059. type t__darwin_pthread_cond_t = struct {
  2060. F__sig int64
  2061. F__opaque [40]int8
  2062. }
  2063. type t__darwin_pthread_condattr_t = struct {
  2064. F__sig int64
  2065. F__opaque [8]int8
  2066. }
  2067. type t__darwin_pthread_key_t = uint64
  2068. type t__darwin_pthread_mutex_t = struct {
  2069. F__sig int64
  2070. F__opaque [56]int8
  2071. }
  2072. type t__darwin_pthread_mutexattr_t = struct {
  2073. F__sig int64
  2074. F__opaque [8]int8
  2075. }
  2076. type t__darwin_pthread_once_t = struct {
  2077. F__sig int64
  2078. F__opaque [8]int8
  2079. }
  2080. type t__darwin_pthread_rwlock_t = struct {
  2081. F__sig int64
  2082. F__opaque [192]int8
  2083. }
  2084. type t__darwin_pthread_rwlockattr_t = struct {
  2085. F__sig int64
  2086. F__opaque [16]int8
  2087. }
  2088. type t__darwin_pthread_t = uintptr
  2089. type t__darwin_nl_item = int32
  2090. type t__darwin_wctrans_t = int32
  2091. type t__darwin_wctype_t = uint32
  2092. type Tint8_t = int8
  2093. type Tint16_t = int16
  2094. type Tint32_t = int32
  2095. type Tint64_t = int64
  2096. type Tu_int8_t = uint8
  2097. type Tu_int16_t = uint16
  2098. type Tu_int32_t = uint32
  2099. type Tu_int64_t = uint64
  2100. type Tregister_t = int64
  2101. type Tintptr_t = int64
  2102. type Tuintptr_t = uint64
  2103. type Tuser_addr_t = uint64
  2104. type Tuser_size_t = uint64
  2105. type Tuser_ssize_t = int64
  2106. type Tuser_long_t = int64
  2107. type Tuser_ulong_t = uint64
  2108. type Tuser_time_t = int64
  2109. type Tuser_off_t = int64
  2110. type Tsyscall_arg_t = uint64
  2111. type Trsize_t = uint64
  2112. type Terrno_t = int32
  2113. type Tssize_t = int64
  2114. type Tva_list = uintptr
  2115. type Tfpos_t = int64
  2116. type t__sbuf = struct {
  2117. F_base uintptr
  2118. F_size int32
  2119. }
  2120. type TFILE = struct {
  2121. F_p uintptr
  2122. F_r int32
  2123. F_w int32
  2124. F_flags int16
  2125. F_file int16
  2126. F_bf t__sbuf
  2127. F_lbfsize int32
  2128. F_cookie uintptr
  2129. F_close uintptr
  2130. F_read uintptr
  2131. F_seek uintptr
  2132. F_write uintptr
  2133. F_ub t__sbuf
  2134. F_extra uintptr
  2135. F_ur int32
  2136. F_ubuf [3]uint8
  2137. F_nbuf [1]uint8
  2138. F_lb t__sbuf
  2139. F_blksize int32
  2140. F_offset Tfpos_t
  2141. }
  2142. type t__sFILE = TFILE
  2143. type Toff_t = int64
  2144. type Tidtype_t = int32
  2145. const _P_ALL = 0
  2146. const _P_PID = 1
  2147. const _P_PGID = 2
  2148. type Tpid_t = int32
  2149. type Tid_t = uint32
  2150. type Tsig_atomic_t = int32
  2151. type t__darwin_i386_thread_state = struct {
  2152. F__eax uint32
  2153. F__ebx uint32
  2154. F__ecx uint32
  2155. F__edx uint32
  2156. F__edi uint32
  2157. F__esi uint32
  2158. F__ebp uint32
  2159. F__esp uint32
  2160. F__ss uint32
  2161. F__eflags uint32
  2162. F__eip uint32
  2163. F__cs uint32
  2164. F__ds uint32
  2165. F__es uint32
  2166. F__fs uint32
  2167. F__gs uint32
  2168. }
  2169. type t__darwin_fp_control = struct {
  2170. F__ccgo0 uint16
  2171. }
  2172. type t__darwin_fp_control_t = struct {
  2173. F__ccgo0 uint16
  2174. }
  2175. type t__darwin_fp_status = struct {
  2176. F__ccgo0 uint16
  2177. }
  2178. type t__darwin_fp_status_t = struct {
  2179. F__ccgo0 uint16
  2180. }
  2181. type t__darwin_mmst_reg = struct {
  2182. F__mmst_reg [10]int8
  2183. F__mmst_rsrv [6]int8
  2184. }
  2185. type t__darwin_xmm_reg = struct {
  2186. F__xmm_reg [16]int8
  2187. }
  2188. type t__darwin_ymm_reg = struct {
  2189. F__ymm_reg [32]int8
  2190. }
  2191. type t__darwin_zmm_reg = struct {
  2192. F__zmm_reg [64]int8
  2193. }
  2194. type t__darwin_opmask_reg = struct {
  2195. F__opmask_reg [8]int8
  2196. }
  2197. type t__darwin_i386_float_state = struct {
  2198. F__fpu_reserved [2]int32
  2199. F__fpu_fcw t__darwin_fp_control
  2200. F__fpu_fsw t__darwin_fp_status
  2201. F__fpu_ftw t__uint8_t
  2202. F__fpu_rsrv1 t__uint8_t
  2203. F__fpu_fop t__uint16_t
  2204. F__fpu_ip t__uint32_t
  2205. F__fpu_cs t__uint16_t
  2206. F__fpu_rsrv2 t__uint16_t
  2207. F__fpu_dp t__uint32_t
  2208. F__fpu_ds t__uint16_t
  2209. F__fpu_rsrv3 t__uint16_t
  2210. F__fpu_mxcsr t__uint32_t
  2211. F__fpu_mxcsrmask t__uint32_t
  2212. F__fpu_stmm0 t__darwin_mmst_reg
  2213. F__fpu_stmm1 t__darwin_mmst_reg
  2214. F__fpu_stmm2 t__darwin_mmst_reg
  2215. F__fpu_stmm3 t__darwin_mmst_reg
  2216. F__fpu_stmm4 t__darwin_mmst_reg
  2217. F__fpu_stmm5 t__darwin_mmst_reg
  2218. F__fpu_stmm6 t__darwin_mmst_reg
  2219. F__fpu_stmm7 t__darwin_mmst_reg
  2220. F__fpu_xmm0 t__darwin_xmm_reg
  2221. F__fpu_xmm1 t__darwin_xmm_reg
  2222. F__fpu_xmm2 t__darwin_xmm_reg
  2223. F__fpu_xmm3 t__darwin_xmm_reg
  2224. F__fpu_xmm4 t__darwin_xmm_reg
  2225. F__fpu_xmm5 t__darwin_xmm_reg
  2226. F__fpu_xmm6 t__darwin_xmm_reg
  2227. F__fpu_xmm7 t__darwin_xmm_reg
  2228. F__fpu_rsrv4 [224]int8
  2229. F__fpu_reserved1 int32
  2230. }
  2231. type t__darwin_i386_avx_state = struct {
  2232. F__fpu_reserved [2]int32
  2233. F__fpu_fcw t__darwin_fp_control
  2234. F__fpu_fsw t__darwin_fp_status
  2235. F__fpu_ftw t__uint8_t
  2236. F__fpu_rsrv1 t__uint8_t
  2237. F__fpu_fop t__uint16_t
  2238. F__fpu_ip t__uint32_t
  2239. F__fpu_cs t__uint16_t
  2240. F__fpu_rsrv2 t__uint16_t
  2241. F__fpu_dp t__uint32_t
  2242. F__fpu_ds t__uint16_t
  2243. F__fpu_rsrv3 t__uint16_t
  2244. F__fpu_mxcsr t__uint32_t
  2245. F__fpu_mxcsrmask t__uint32_t
  2246. F__fpu_stmm0 t__darwin_mmst_reg
  2247. F__fpu_stmm1 t__darwin_mmst_reg
  2248. F__fpu_stmm2 t__darwin_mmst_reg
  2249. F__fpu_stmm3 t__darwin_mmst_reg
  2250. F__fpu_stmm4 t__darwin_mmst_reg
  2251. F__fpu_stmm5 t__darwin_mmst_reg
  2252. F__fpu_stmm6 t__darwin_mmst_reg
  2253. F__fpu_stmm7 t__darwin_mmst_reg
  2254. F__fpu_xmm0 t__darwin_xmm_reg
  2255. F__fpu_xmm1 t__darwin_xmm_reg
  2256. F__fpu_xmm2 t__darwin_xmm_reg
  2257. F__fpu_xmm3 t__darwin_xmm_reg
  2258. F__fpu_xmm4 t__darwin_xmm_reg
  2259. F__fpu_xmm5 t__darwin_xmm_reg
  2260. F__fpu_xmm6 t__darwin_xmm_reg
  2261. F__fpu_xmm7 t__darwin_xmm_reg
  2262. F__fpu_rsrv4 [224]int8
  2263. F__fpu_reserved1 int32
  2264. F__avx_reserved1 [64]int8
  2265. F__fpu_ymmh0 t__darwin_xmm_reg
  2266. F__fpu_ymmh1 t__darwin_xmm_reg
  2267. F__fpu_ymmh2 t__darwin_xmm_reg
  2268. F__fpu_ymmh3 t__darwin_xmm_reg
  2269. F__fpu_ymmh4 t__darwin_xmm_reg
  2270. F__fpu_ymmh5 t__darwin_xmm_reg
  2271. F__fpu_ymmh6 t__darwin_xmm_reg
  2272. F__fpu_ymmh7 t__darwin_xmm_reg
  2273. }
  2274. type t__darwin_i386_avx512_state = struct {
  2275. F__fpu_reserved [2]int32
  2276. F__fpu_fcw t__darwin_fp_control
  2277. F__fpu_fsw t__darwin_fp_status
  2278. F__fpu_ftw t__uint8_t
  2279. F__fpu_rsrv1 t__uint8_t
  2280. F__fpu_fop t__uint16_t
  2281. F__fpu_ip t__uint32_t
  2282. F__fpu_cs t__uint16_t
  2283. F__fpu_rsrv2 t__uint16_t
  2284. F__fpu_dp t__uint32_t
  2285. F__fpu_ds t__uint16_t
  2286. F__fpu_rsrv3 t__uint16_t
  2287. F__fpu_mxcsr t__uint32_t
  2288. F__fpu_mxcsrmask t__uint32_t
  2289. F__fpu_stmm0 t__darwin_mmst_reg
  2290. F__fpu_stmm1 t__darwin_mmst_reg
  2291. F__fpu_stmm2 t__darwin_mmst_reg
  2292. F__fpu_stmm3 t__darwin_mmst_reg
  2293. F__fpu_stmm4 t__darwin_mmst_reg
  2294. F__fpu_stmm5 t__darwin_mmst_reg
  2295. F__fpu_stmm6 t__darwin_mmst_reg
  2296. F__fpu_stmm7 t__darwin_mmst_reg
  2297. F__fpu_xmm0 t__darwin_xmm_reg
  2298. F__fpu_xmm1 t__darwin_xmm_reg
  2299. F__fpu_xmm2 t__darwin_xmm_reg
  2300. F__fpu_xmm3 t__darwin_xmm_reg
  2301. F__fpu_xmm4 t__darwin_xmm_reg
  2302. F__fpu_xmm5 t__darwin_xmm_reg
  2303. F__fpu_xmm6 t__darwin_xmm_reg
  2304. F__fpu_xmm7 t__darwin_xmm_reg
  2305. F__fpu_rsrv4 [224]int8
  2306. F__fpu_reserved1 int32
  2307. F__avx_reserved1 [64]int8
  2308. F__fpu_ymmh0 t__darwin_xmm_reg
  2309. F__fpu_ymmh1 t__darwin_xmm_reg
  2310. F__fpu_ymmh2 t__darwin_xmm_reg
  2311. F__fpu_ymmh3 t__darwin_xmm_reg
  2312. F__fpu_ymmh4 t__darwin_xmm_reg
  2313. F__fpu_ymmh5 t__darwin_xmm_reg
  2314. F__fpu_ymmh6 t__darwin_xmm_reg
  2315. F__fpu_ymmh7 t__darwin_xmm_reg
  2316. F__fpu_k0 t__darwin_opmask_reg
  2317. F__fpu_k1 t__darwin_opmask_reg
  2318. F__fpu_k2 t__darwin_opmask_reg
  2319. F__fpu_k3 t__darwin_opmask_reg
  2320. F__fpu_k4 t__darwin_opmask_reg
  2321. F__fpu_k5 t__darwin_opmask_reg
  2322. F__fpu_k6 t__darwin_opmask_reg
  2323. F__fpu_k7 t__darwin_opmask_reg
  2324. F__fpu_zmmh0 t__darwin_ymm_reg
  2325. F__fpu_zmmh1 t__darwin_ymm_reg
  2326. F__fpu_zmmh2 t__darwin_ymm_reg
  2327. F__fpu_zmmh3 t__darwin_ymm_reg
  2328. F__fpu_zmmh4 t__darwin_ymm_reg
  2329. F__fpu_zmmh5 t__darwin_ymm_reg
  2330. F__fpu_zmmh6 t__darwin_ymm_reg
  2331. F__fpu_zmmh7 t__darwin_ymm_reg
  2332. }
  2333. type t__darwin_i386_exception_state = struct {
  2334. F__trapno t__uint16_t
  2335. F__cpu t__uint16_t
  2336. F__err t__uint32_t
  2337. F__faultvaddr t__uint32_t
  2338. }
  2339. type t__darwin_x86_debug_state32 = struct {
  2340. F__dr0 uint32
  2341. F__dr1 uint32
  2342. F__dr2 uint32
  2343. F__dr3 uint32
  2344. F__dr4 uint32
  2345. F__dr5 uint32
  2346. F__dr6 uint32
  2347. F__dr7 uint32
  2348. }
  2349. type t__x86_instruction_state = struct {
  2350. F__insn_stream_valid_bytes int32
  2351. F__insn_offset int32
  2352. F__out_of_synch int32
  2353. F__insn_bytes [2380]t__uint8_t
  2354. F__insn_cacheline [64]t__uint8_t
  2355. }
  2356. type t__last_branch_record = struct {
  2357. F__from_ip t__uint64_t
  2358. F__to_ip t__uint64_t
  2359. F__ccgo16 uint32
  2360. }
  2361. type t__last_branch_state = struct {
  2362. F__lbr_count int32
  2363. F__ccgo4 uint32
  2364. F__lbrs [32]t__last_branch_record
  2365. }
  2366. type t__x86_pagein_state = struct {
  2367. F__pagein_error int32
  2368. }
  2369. type t__darwin_x86_thread_state64 = struct {
  2370. F__rax t__uint64_t
  2371. F__rbx t__uint64_t
  2372. F__rcx t__uint64_t
  2373. F__rdx t__uint64_t
  2374. F__rdi t__uint64_t
  2375. F__rsi t__uint64_t
  2376. F__rbp t__uint64_t
  2377. F__rsp t__uint64_t
  2378. F__r8 t__uint64_t
  2379. F__r9 t__uint64_t
  2380. F__r10 t__uint64_t
  2381. F__r11 t__uint64_t
  2382. F__r12 t__uint64_t
  2383. F__r13 t__uint64_t
  2384. F__r14 t__uint64_t
  2385. F__r15 t__uint64_t
  2386. F__rip t__uint64_t
  2387. F__rflags t__uint64_t
  2388. F__cs t__uint64_t
  2389. F__fs t__uint64_t
  2390. F__gs t__uint64_t
  2391. }
  2392. type t__darwin_x86_thread_full_state64 = struct {
  2393. F__ss64 t__darwin_x86_thread_state64
  2394. F__ds t__uint64_t
  2395. F__es t__uint64_t
  2396. F__ss t__uint64_t
  2397. F__gsbase t__uint64_t
  2398. }
  2399. type t__darwin_x86_float_state64 = struct {
  2400. F__fpu_reserved [2]int32
  2401. F__fpu_fcw t__darwin_fp_control
  2402. F__fpu_fsw t__darwin_fp_status
  2403. F__fpu_ftw t__uint8_t
  2404. F__fpu_rsrv1 t__uint8_t
  2405. F__fpu_fop t__uint16_t
  2406. F__fpu_ip t__uint32_t
  2407. F__fpu_cs t__uint16_t
  2408. F__fpu_rsrv2 t__uint16_t
  2409. F__fpu_dp t__uint32_t
  2410. F__fpu_ds t__uint16_t
  2411. F__fpu_rsrv3 t__uint16_t
  2412. F__fpu_mxcsr t__uint32_t
  2413. F__fpu_mxcsrmask t__uint32_t
  2414. F__fpu_stmm0 t__darwin_mmst_reg
  2415. F__fpu_stmm1 t__darwin_mmst_reg
  2416. F__fpu_stmm2 t__darwin_mmst_reg
  2417. F__fpu_stmm3 t__darwin_mmst_reg
  2418. F__fpu_stmm4 t__darwin_mmst_reg
  2419. F__fpu_stmm5 t__darwin_mmst_reg
  2420. F__fpu_stmm6 t__darwin_mmst_reg
  2421. F__fpu_stmm7 t__darwin_mmst_reg
  2422. F__fpu_xmm0 t__darwin_xmm_reg
  2423. F__fpu_xmm1 t__darwin_xmm_reg
  2424. F__fpu_xmm2 t__darwin_xmm_reg
  2425. F__fpu_xmm3 t__darwin_xmm_reg
  2426. F__fpu_xmm4 t__darwin_xmm_reg
  2427. F__fpu_xmm5 t__darwin_xmm_reg
  2428. F__fpu_xmm6 t__darwin_xmm_reg
  2429. F__fpu_xmm7 t__darwin_xmm_reg
  2430. F__fpu_xmm8 t__darwin_xmm_reg
  2431. F__fpu_xmm9 t__darwin_xmm_reg
  2432. F__fpu_xmm10 t__darwin_xmm_reg
  2433. F__fpu_xmm11 t__darwin_xmm_reg
  2434. F__fpu_xmm12 t__darwin_xmm_reg
  2435. F__fpu_xmm13 t__darwin_xmm_reg
  2436. F__fpu_xmm14 t__darwin_xmm_reg
  2437. F__fpu_xmm15 t__darwin_xmm_reg
  2438. F__fpu_rsrv4 [96]int8
  2439. F__fpu_reserved1 int32
  2440. }
  2441. type t__darwin_x86_avx_state64 = struct {
  2442. F__fpu_reserved [2]int32
  2443. F__fpu_fcw t__darwin_fp_control
  2444. F__fpu_fsw t__darwin_fp_status
  2445. F__fpu_ftw t__uint8_t
  2446. F__fpu_rsrv1 t__uint8_t
  2447. F__fpu_fop t__uint16_t
  2448. F__fpu_ip t__uint32_t
  2449. F__fpu_cs t__uint16_t
  2450. F__fpu_rsrv2 t__uint16_t
  2451. F__fpu_dp t__uint32_t
  2452. F__fpu_ds t__uint16_t
  2453. F__fpu_rsrv3 t__uint16_t
  2454. F__fpu_mxcsr t__uint32_t
  2455. F__fpu_mxcsrmask t__uint32_t
  2456. F__fpu_stmm0 t__darwin_mmst_reg
  2457. F__fpu_stmm1 t__darwin_mmst_reg
  2458. F__fpu_stmm2 t__darwin_mmst_reg
  2459. F__fpu_stmm3 t__darwin_mmst_reg
  2460. F__fpu_stmm4 t__darwin_mmst_reg
  2461. F__fpu_stmm5 t__darwin_mmst_reg
  2462. F__fpu_stmm6 t__darwin_mmst_reg
  2463. F__fpu_stmm7 t__darwin_mmst_reg
  2464. F__fpu_xmm0 t__darwin_xmm_reg
  2465. F__fpu_xmm1 t__darwin_xmm_reg
  2466. F__fpu_xmm2 t__darwin_xmm_reg
  2467. F__fpu_xmm3 t__darwin_xmm_reg
  2468. F__fpu_xmm4 t__darwin_xmm_reg
  2469. F__fpu_xmm5 t__darwin_xmm_reg
  2470. F__fpu_xmm6 t__darwin_xmm_reg
  2471. F__fpu_xmm7 t__darwin_xmm_reg
  2472. F__fpu_xmm8 t__darwin_xmm_reg
  2473. F__fpu_xmm9 t__darwin_xmm_reg
  2474. F__fpu_xmm10 t__darwin_xmm_reg
  2475. F__fpu_xmm11 t__darwin_xmm_reg
  2476. F__fpu_xmm12 t__darwin_xmm_reg
  2477. F__fpu_xmm13 t__darwin_xmm_reg
  2478. F__fpu_xmm14 t__darwin_xmm_reg
  2479. F__fpu_xmm15 t__darwin_xmm_reg
  2480. F__fpu_rsrv4 [96]int8
  2481. F__fpu_reserved1 int32
  2482. F__avx_reserved1 [64]int8
  2483. F__fpu_ymmh0 t__darwin_xmm_reg
  2484. F__fpu_ymmh1 t__darwin_xmm_reg
  2485. F__fpu_ymmh2 t__darwin_xmm_reg
  2486. F__fpu_ymmh3 t__darwin_xmm_reg
  2487. F__fpu_ymmh4 t__darwin_xmm_reg
  2488. F__fpu_ymmh5 t__darwin_xmm_reg
  2489. F__fpu_ymmh6 t__darwin_xmm_reg
  2490. F__fpu_ymmh7 t__darwin_xmm_reg
  2491. F__fpu_ymmh8 t__darwin_xmm_reg
  2492. F__fpu_ymmh9 t__darwin_xmm_reg
  2493. F__fpu_ymmh10 t__darwin_xmm_reg
  2494. F__fpu_ymmh11 t__darwin_xmm_reg
  2495. F__fpu_ymmh12 t__darwin_xmm_reg
  2496. F__fpu_ymmh13 t__darwin_xmm_reg
  2497. F__fpu_ymmh14 t__darwin_xmm_reg
  2498. F__fpu_ymmh15 t__darwin_xmm_reg
  2499. }
  2500. type t__darwin_x86_avx512_state64 = struct {
  2501. F__fpu_reserved [2]int32
  2502. F__fpu_fcw t__darwin_fp_control
  2503. F__fpu_fsw t__darwin_fp_status
  2504. F__fpu_ftw t__uint8_t
  2505. F__fpu_rsrv1 t__uint8_t
  2506. F__fpu_fop t__uint16_t
  2507. F__fpu_ip t__uint32_t
  2508. F__fpu_cs t__uint16_t
  2509. F__fpu_rsrv2 t__uint16_t
  2510. F__fpu_dp t__uint32_t
  2511. F__fpu_ds t__uint16_t
  2512. F__fpu_rsrv3 t__uint16_t
  2513. F__fpu_mxcsr t__uint32_t
  2514. F__fpu_mxcsrmask t__uint32_t
  2515. F__fpu_stmm0 t__darwin_mmst_reg
  2516. F__fpu_stmm1 t__darwin_mmst_reg
  2517. F__fpu_stmm2 t__darwin_mmst_reg
  2518. F__fpu_stmm3 t__darwin_mmst_reg
  2519. F__fpu_stmm4 t__darwin_mmst_reg
  2520. F__fpu_stmm5 t__darwin_mmst_reg
  2521. F__fpu_stmm6 t__darwin_mmst_reg
  2522. F__fpu_stmm7 t__darwin_mmst_reg
  2523. F__fpu_xmm0 t__darwin_xmm_reg
  2524. F__fpu_xmm1 t__darwin_xmm_reg
  2525. F__fpu_xmm2 t__darwin_xmm_reg
  2526. F__fpu_xmm3 t__darwin_xmm_reg
  2527. F__fpu_xmm4 t__darwin_xmm_reg
  2528. F__fpu_xmm5 t__darwin_xmm_reg
  2529. F__fpu_xmm6 t__darwin_xmm_reg
  2530. F__fpu_xmm7 t__darwin_xmm_reg
  2531. F__fpu_xmm8 t__darwin_xmm_reg
  2532. F__fpu_xmm9 t__darwin_xmm_reg
  2533. F__fpu_xmm10 t__darwin_xmm_reg
  2534. F__fpu_xmm11 t__darwin_xmm_reg
  2535. F__fpu_xmm12 t__darwin_xmm_reg
  2536. F__fpu_xmm13 t__darwin_xmm_reg
  2537. F__fpu_xmm14 t__darwin_xmm_reg
  2538. F__fpu_xmm15 t__darwin_xmm_reg
  2539. F__fpu_rsrv4 [96]int8
  2540. F__fpu_reserved1 int32
  2541. F__avx_reserved1 [64]int8
  2542. F__fpu_ymmh0 t__darwin_xmm_reg
  2543. F__fpu_ymmh1 t__darwin_xmm_reg
  2544. F__fpu_ymmh2 t__darwin_xmm_reg
  2545. F__fpu_ymmh3 t__darwin_xmm_reg
  2546. F__fpu_ymmh4 t__darwin_xmm_reg
  2547. F__fpu_ymmh5 t__darwin_xmm_reg
  2548. F__fpu_ymmh6 t__darwin_xmm_reg
  2549. F__fpu_ymmh7 t__darwin_xmm_reg
  2550. F__fpu_ymmh8 t__darwin_xmm_reg
  2551. F__fpu_ymmh9 t__darwin_xmm_reg
  2552. F__fpu_ymmh10 t__darwin_xmm_reg
  2553. F__fpu_ymmh11 t__darwin_xmm_reg
  2554. F__fpu_ymmh12 t__darwin_xmm_reg
  2555. F__fpu_ymmh13 t__darwin_xmm_reg
  2556. F__fpu_ymmh14 t__darwin_xmm_reg
  2557. F__fpu_ymmh15 t__darwin_xmm_reg
  2558. F__fpu_k0 t__darwin_opmask_reg
  2559. F__fpu_k1 t__darwin_opmask_reg
  2560. F__fpu_k2 t__darwin_opmask_reg
  2561. F__fpu_k3 t__darwin_opmask_reg
  2562. F__fpu_k4 t__darwin_opmask_reg
  2563. F__fpu_k5 t__darwin_opmask_reg
  2564. F__fpu_k6 t__darwin_opmask_reg
  2565. F__fpu_k7 t__darwin_opmask_reg
  2566. F__fpu_zmmh0 t__darwin_ymm_reg
  2567. F__fpu_zmmh1 t__darwin_ymm_reg
  2568. F__fpu_zmmh2 t__darwin_ymm_reg
  2569. F__fpu_zmmh3 t__darwin_ymm_reg
  2570. F__fpu_zmmh4 t__darwin_ymm_reg
  2571. F__fpu_zmmh5 t__darwin_ymm_reg
  2572. F__fpu_zmmh6 t__darwin_ymm_reg
  2573. F__fpu_zmmh7 t__darwin_ymm_reg
  2574. F__fpu_zmmh8 t__darwin_ymm_reg
  2575. F__fpu_zmmh9 t__darwin_ymm_reg
  2576. F__fpu_zmmh10 t__darwin_ymm_reg
  2577. F__fpu_zmmh11 t__darwin_ymm_reg
  2578. F__fpu_zmmh12 t__darwin_ymm_reg
  2579. F__fpu_zmmh13 t__darwin_ymm_reg
  2580. F__fpu_zmmh14 t__darwin_ymm_reg
  2581. F__fpu_zmmh15 t__darwin_ymm_reg
  2582. F__fpu_zmm16 t__darwin_zmm_reg
  2583. F__fpu_zmm17 t__darwin_zmm_reg
  2584. F__fpu_zmm18 t__darwin_zmm_reg
  2585. F__fpu_zmm19 t__darwin_zmm_reg
  2586. F__fpu_zmm20 t__darwin_zmm_reg
  2587. F__fpu_zmm21 t__darwin_zmm_reg
  2588. F__fpu_zmm22 t__darwin_zmm_reg
  2589. F__fpu_zmm23 t__darwin_zmm_reg
  2590. F__fpu_zmm24 t__darwin_zmm_reg
  2591. F__fpu_zmm25 t__darwin_zmm_reg
  2592. F__fpu_zmm26 t__darwin_zmm_reg
  2593. F__fpu_zmm27 t__darwin_zmm_reg
  2594. F__fpu_zmm28 t__darwin_zmm_reg
  2595. F__fpu_zmm29 t__darwin_zmm_reg
  2596. F__fpu_zmm30 t__darwin_zmm_reg
  2597. F__fpu_zmm31 t__darwin_zmm_reg
  2598. }
  2599. type t__darwin_x86_exception_state64 = struct {
  2600. F__trapno t__uint16_t
  2601. F__cpu t__uint16_t
  2602. F__err t__uint32_t
  2603. F__faultvaddr t__uint64_t
  2604. }
  2605. type t__darwin_x86_debug_state64 = struct {
  2606. F__dr0 t__uint64_t
  2607. F__dr1 t__uint64_t
  2608. F__dr2 t__uint64_t
  2609. F__dr3 t__uint64_t
  2610. F__dr4 t__uint64_t
  2611. F__dr5 t__uint64_t
  2612. F__dr6 t__uint64_t
  2613. F__dr7 t__uint64_t
  2614. }
  2615. type t__darwin_x86_cpmu_state64 = struct {
  2616. F__ctrs [16]t__uint64_t
  2617. }
  2618. type t__darwin_mcontext32 = struct {
  2619. F__es t__darwin_i386_exception_state
  2620. F__ss t__darwin_i386_thread_state
  2621. F__fs t__darwin_i386_float_state
  2622. }
  2623. type t__darwin_mcontext_avx32 = struct {
  2624. F__es t__darwin_i386_exception_state
  2625. F__ss t__darwin_i386_thread_state
  2626. F__fs t__darwin_i386_avx_state
  2627. }
  2628. type t__darwin_mcontext_avx512_32 = struct {
  2629. F__es t__darwin_i386_exception_state
  2630. F__ss t__darwin_i386_thread_state
  2631. F__fs t__darwin_i386_avx512_state
  2632. }
  2633. type t__darwin_mcontext64 = struct {
  2634. F__es t__darwin_x86_exception_state64
  2635. F__ss t__darwin_x86_thread_state64
  2636. F__fs t__darwin_x86_float_state64
  2637. }
  2638. type t__darwin_mcontext64_full = struct {
  2639. F__es t__darwin_x86_exception_state64
  2640. F__ss t__darwin_x86_thread_full_state64
  2641. F__fs t__darwin_x86_float_state64
  2642. }
  2643. type t__darwin_mcontext_avx64 = struct {
  2644. F__es t__darwin_x86_exception_state64
  2645. F__ss t__darwin_x86_thread_state64
  2646. F__fs t__darwin_x86_avx_state64
  2647. }
  2648. type t__darwin_mcontext_avx64_full = struct {
  2649. F__es t__darwin_x86_exception_state64
  2650. F__ss t__darwin_x86_thread_full_state64
  2651. F__fs t__darwin_x86_avx_state64
  2652. }
  2653. type t__darwin_mcontext_avx512_64 = struct {
  2654. F__es t__darwin_x86_exception_state64
  2655. F__ss t__darwin_x86_thread_state64
  2656. F__fs t__darwin_x86_avx512_state64
  2657. }
  2658. type t__darwin_mcontext_avx512_64_full = struct {
  2659. F__es t__darwin_x86_exception_state64
  2660. F__ss t__darwin_x86_thread_full_state64
  2661. F__fs t__darwin_x86_avx512_state64
  2662. }
  2663. type Tmcontext_t = uintptr
  2664. type Tpthread_attr_t = struct {
  2665. F__sig int64
  2666. F__opaque [56]int8
  2667. }
  2668. type t__darwin_sigaltstack = struct {
  2669. Fss_sp uintptr
  2670. Fss_size t__darwin_size_t
  2671. Fss_flags int32
  2672. }
  2673. type Tstack_t = struct {
  2674. Fss_sp uintptr
  2675. Fss_size t__darwin_size_t
  2676. Fss_flags int32
  2677. }
  2678. type t__darwin_ucontext = struct {
  2679. Fuc_onstack int32
  2680. Fuc_sigmask t__darwin_sigset_t
  2681. Fuc_stack t__darwin_sigaltstack
  2682. Fuc_link uintptr
  2683. Fuc_mcsize t__darwin_size_t
  2684. Fuc_mcontext uintptr
  2685. }
  2686. type Tucontext_t = struct {
  2687. Fuc_onstack int32
  2688. Fuc_sigmask t__darwin_sigset_t
  2689. Fuc_stack t__darwin_sigaltstack
  2690. Fuc_link uintptr
  2691. Fuc_mcsize t__darwin_size_t
  2692. Fuc_mcontext uintptr
  2693. }
  2694. type Tsigset_t = uint32
  2695. type Tuid_t = uint32
  2696. type Tsigval = struct {
  2697. Fsival_ptr [0]uintptr
  2698. Fsival_int int32
  2699. F__ccgo_pad2 [4]byte
  2700. }
  2701. type Tsigevent = struct {
  2702. Fsigev_notify int32
  2703. Fsigev_signo int32
  2704. Fsigev_value Tsigval
  2705. Fsigev_notify_function uintptr
  2706. Fsigev_notify_attributes uintptr
  2707. }
  2708. type Tsiginfo_t = struct {
  2709. Fsi_signo int32
  2710. Fsi_errno int32
  2711. Fsi_code int32
  2712. Fsi_pid Tpid_t
  2713. Fsi_uid Tuid_t
  2714. Fsi_status int32
  2715. Fsi_addr uintptr
  2716. Fsi_value Tsigval
  2717. Fsi_band int64
  2718. F__pad [7]uint64
  2719. }
  2720. type t__siginfo = Tsiginfo_t
  2721. type t__sigaction_u = struct {
  2722. F__sa_sigaction [0]uintptr
  2723. F__sa_handler uintptr
  2724. }
  2725. type t__sigaction = struct {
  2726. F__sigaction_u t__sigaction_u
  2727. Fsa_tramp uintptr
  2728. Fsa_mask Tsigset_t
  2729. Fsa_flags int32
  2730. }
  2731. type Tsigaction = struct {
  2732. F__sigaction_u t__sigaction_u
  2733. Fsa_mask Tsigset_t
  2734. Fsa_flags int32
  2735. }
  2736. type Tsig_t = uintptr
  2737. type Tsigvec = struct {
  2738. Fsv_handler uintptr
  2739. Fsv_mask int32
  2740. Fsv_flags int32
  2741. }
  2742. type Tsigstack = struct {
  2743. Fss_sp uintptr
  2744. Fss_onstack int32
  2745. }
  2746. type Tuint64_t = uint64
  2747. type Tint_least64_t = int64
  2748. type Tuint_least64_t = uint64
  2749. type Tint_fast64_t = int64
  2750. type Tuint_fast64_t = uint64
  2751. type Tuint32_t = uint32
  2752. type Tint_least32_t = int32
  2753. type Tuint_least32_t = uint32
  2754. type Tint_fast32_t = int32
  2755. type Tuint_fast32_t = uint32
  2756. type Tuint16_t = uint16
  2757. type Tint_least16_t = int16
  2758. type Tuint_least16_t = uint16
  2759. type Tint_fast16_t = int16
  2760. type Tuint_fast16_t = uint16
  2761. type Tuint8_t = uint8
  2762. type Tint_least8_t = int8
  2763. type Tuint_least8_t = uint8
  2764. type Tint_fast8_t = int8
  2765. type Tuint_fast8_t = uint8
  2766. type Tintmax_t = int64
  2767. type Tuintmax_t = uint64
  2768. type Ttimeval = struct {
  2769. Ftv_sec t__darwin_time_t
  2770. Ftv_usec t__darwin_suseconds_t
  2771. }
  2772. type Trlim_t = uint64
  2773. type Trusage = struct {
  2774. Fru_utime Ttimeval
  2775. Fru_stime Ttimeval
  2776. Fru_maxrss int64
  2777. Fru_ixrss int64
  2778. Fru_idrss int64
  2779. Fru_isrss int64
  2780. Fru_minflt int64
  2781. Fru_majflt int64
  2782. Fru_nswap int64
  2783. Fru_inblock int64
  2784. Fru_oublock int64
  2785. Fru_msgsnd int64
  2786. Fru_msgrcv int64
  2787. Fru_nsignals int64
  2788. Fru_nvcsw int64
  2789. Fru_nivcsw int64
  2790. }
  2791. type Trusage_info_t = uintptr
  2792. type Trusage_info_v0 = struct {
  2793. Fri_uuid [16]Tuint8_t
  2794. Fri_user_time Tuint64_t
  2795. Fri_system_time Tuint64_t
  2796. Fri_pkg_idle_wkups Tuint64_t
  2797. Fri_interrupt_wkups Tuint64_t
  2798. Fri_pageins Tuint64_t
  2799. Fri_wired_size Tuint64_t
  2800. Fri_resident_size Tuint64_t
  2801. Fri_phys_footprint Tuint64_t
  2802. Fri_proc_start_abstime Tuint64_t
  2803. Fri_proc_exit_abstime Tuint64_t
  2804. }
  2805. type Trusage_info_v1 = struct {
  2806. Fri_uuid [16]Tuint8_t
  2807. Fri_user_time Tuint64_t
  2808. Fri_system_time Tuint64_t
  2809. Fri_pkg_idle_wkups Tuint64_t
  2810. Fri_interrupt_wkups Tuint64_t
  2811. Fri_pageins Tuint64_t
  2812. Fri_wired_size Tuint64_t
  2813. Fri_resident_size Tuint64_t
  2814. Fri_phys_footprint Tuint64_t
  2815. Fri_proc_start_abstime Tuint64_t
  2816. Fri_proc_exit_abstime Tuint64_t
  2817. Fri_child_user_time Tuint64_t
  2818. Fri_child_system_time Tuint64_t
  2819. Fri_child_pkg_idle_wkups Tuint64_t
  2820. Fri_child_interrupt_wkups Tuint64_t
  2821. Fri_child_pageins Tuint64_t
  2822. Fri_child_elapsed_abstime Tuint64_t
  2823. }
  2824. type Trusage_info_v2 = struct {
  2825. Fri_uuid [16]Tuint8_t
  2826. Fri_user_time Tuint64_t
  2827. Fri_system_time Tuint64_t
  2828. Fri_pkg_idle_wkups Tuint64_t
  2829. Fri_interrupt_wkups Tuint64_t
  2830. Fri_pageins Tuint64_t
  2831. Fri_wired_size Tuint64_t
  2832. Fri_resident_size Tuint64_t
  2833. Fri_phys_footprint Tuint64_t
  2834. Fri_proc_start_abstime Tuint64_t
  2835. Fri_proc_exit_abstime Tuint64_t
  2836. Fri_child_user_time Tuint64_t
  2837. Fri_child_system_time Tuint64_t
  2838. Fri_child_pkg_idle_wkups Tuint64_t
  2839. Fri_child_interrupt_wkups Tuint64_t
  2840. Fri_child_pageins Tuint64_t
  2841. Fri_child_elapsed_abstime Tuint64_t
  2842. Fri_diskio_bytesread Tuint64_t
  2843. Fri_diskio_byteswritten Tuint64_t
  2844. }
  2845. type Trusage_info_v3 = struct {
  2846. Fri_uuid [16]Tuint8_t
  2847. Fri_user_time Tuint64_t
  2848. Fri_system_time Tuint64_t
  2849. Fri_pkg_idle_wkups Tuint64_t
  2850. Fri_interrupt_wkups Tuint64_t
  2851. Fri_pageins Tuint64_t
  2852. Fri_wired_size Tuint64_t
  2853. Fri_resident_size Tuint64_t
  2854. Fri_phys_footprint Tuint64_t
  2855. Fri_proc_start_abstime Tuint64_t
  2856. Fri_proc_exit_abstime Tuint64_t
  2857. Fri_child_user_time Tuint64_t
  2858. Fri_child_system_time Tuint64_t
  2859. Fri_child_pkg_idle_wkups Tuint64_t
  2860. Fri_child_interrupt_wkups Tuint64_t
  2861. Fri_child_pageins Tuint64_t
  2862. Fri_child_elapsed_abstime Tuint64_t
  2863. Fri_diskio_bytesread Tuint64_t
  2864. Fri_diskio_byteswritten Tuint64_t
  2865. Fri_cpu_time_qos_default Tuint64_t
  2866. Fri_cpu_time_qos_maintenance Tuint64_t
  2867. Fri_cpu_time_qos_background Tuint64_t
  2868. Fri_cpu_time_qos_utility Tuint64_t
  2869. Fri_cpu_time_qos_legacy Tuint64_t
  2870. Fri_cpu_time_qos_user_initiated Tuint64_t
  2871. Fri_cpu_time_qos_user_interactive Tuint64_t
  2872. Fri_billed_system_time Tuint64_t
  2873. Fri_serviced_system_time Tuint64_t
  2874. }
  2875. type Trusage_info_v4 = struct {
  2876. Fri_uuid [16]Tuint8_t
  2877. Fri_user_time Tuint64_t
  2878. Fri_system_time Tuint64_t
  2879. Fri_pkg_idle_wkups Tuint64_t
  2880. Fri_interrupt_wkups Tuint64_t
  2881. Fri_pageins Tuint64_t
  2882. Fri_wired_size Tuint64_t
  2883. Fri_resident_size Tuint64_t
  2884. Fri_phys_footprint Tuint64_t
  2885. Fri_proc_start_abstime Tuint64_t
  2886. Fri_proc_exit_abstime Tuint64_t
  2887. Fri_child_user_time Tuint64_t
  2888. Fri_child_system_time Tuint64_t
  2889. Fri_child_pkg_idle_wkups Tuint64_t
  2890. Fri_child_interrupt_wkups Tuint64_t
  2891. Fri_child_pageins Tuint64_t
  2892. Fri_child_elapsed_abstime Tuint64_t
  2893. Fri_diskio_bytesread Tuint64_t
  2894. Fri_diskio_byteswritten Tuint64_t
  2895. Fri_cpu_time_qos_default Tuint64_t
  2896. Fri_cpu_time_qos_maintenance Tuint64_t
  2897. Fri_cpu_time_qos_background Tuint64_t
  2898. Fri_cpu_time_qos_utility Tuint64_t
  2899. Fri_cpu_time_qos_legacy Tuint64_t
  2900. Fri_cpu_time_qos_user_initiated Tuint64_t
  2901. Fri_cpu_time_qos_user_interactive Tuint64_t
  2902. Fri_billed_system_time Tuint64_t
  2903. Fri_serviced_system_time Tuint64_t
  2904. Fri_logical_writes Tuint64_t
  2905. Fri_lifetime_max_phys_footprint Tuint64_t
  2906. Fri_instructions Tuint64_t
  2907. Fri_cycles Tuint64_t
  2908. Fri_billed_energy Tuint64_t
  2909. Fri_serviced_energy Tuint64_t
  2910. Fri_interval_max_phys_footprint Tuint64_t
  2911. Fri_runnable_time Tuint64_t
  2912. }
  2913. type Trusage_info_v5 = struct {
  2914. Fri_uuid [16]Tuint8_t
  2915. Fri_user_time Tuint64_t
  2916. Fri_system_time Tuint64_t
  2917. Fri_pkg_idle_wkups Tuint64_t
  2918. Fri_interrupt_wkups Tuint64_t
  2919. Fri_pageins Tuint64_t
  2920. Fri_wired_size Tuint64_t
  2921. Fri_resident_size Tuint64_t
  2922. Fri_phys_footprint Tuint64_t
  2923. Fri_proc_start_abstime Tuint64_t
  2924. Fri_proc_exit_abstime Tuint64_t
  2925. Fri_child_user_time Tuint64_t
  2926. Fri_child_system_time Tuint64_t
  2927. Fri_child_pkg_idle_wkups Tuint64_t
  2928. Fri_child_interrupt_wkups Tuint64_t
  2929. Fri_child_pageins Tuint64_t
  2930. Fri_child_elapsed_abstime Tuint64_t
  2931. Fri_diskio_bytesread Tuint64_t
  2932. Fri_diskio_byteswritten Tuint64_t
  2933. Fri_cpu_time_qos_default Tuint64_t
  2934. Fri_cpu_time_qos_maintenance Tuint64_t
  2935. Fri_cpu_time_qos_background Tuint64_t
  2936. Fri_cpu_time_qos_utility Tuint64_t
  2937. Fri_cpu_time_qos_legacy Tuint64_t
  2938. Fri_cpu_time_qos_user_initiated Tuint64_t
  2939. Fri_cpu_time_qos_user_interactive Tuint64_t
  2940. Fri_billed_system_time Tuint64_t
  2941. Fri_serviced_system_time Tuint64_t
  2942. Fri_logical_writes Tuint64_t
  2943. Fri_lifetime_max_phys_footprint Tuint64_t
  2944. Fri_instructions Tuint64_t
  2945. Fri_cycles Tuint64_t
  2946. Fri_billed_energy Tuint64_t
  2947. Fri_serviced_energy Tuint64_t
  2948. Fri_interval_max_phys_footprint Tuint64_t
  2949. Fri_runnable_time Tuint64_t
  2950. Fri_flags Tuint64_t
  2951. }
  2952. type Trusage_info_v6 = struct {
  2953. Fri_uuid [16]Tuint8_t
  2954. Fri_user_time Tuint64_t
  2955. Fri_system_time Tuint64_t
  2956. Fri_pkg_idle_wkups Tuint64_t
  2957. Fri_interrupt_wkups Tuint64_t
  2958. Fri_pageins Tuint64_t
  2959. Fri_wired_size Tuint64_t
  2960. Fri_resident_size Tuint64_t
  2961. Fri_phys_footprint Tuint64_t
  2962. Fri_proc_start_abstime Tuint64_t
  2963. Fri_proc_exit_abstime Tuint64_t
  2964. Fri_child_user_time Tuint64_t
  2965. Fri_child_system_time Tuint64_t
  2966. Fri_child_pkg_idle_wkups Tuint64_t
  2967. Fri_child_interrupt_wkups Tuint64_t
  2968. Fri_child_pageins Tuint64_t
  2969. Fri_child_elapsed_abstime Tuint64_t
  2970. Fri_diskio_bytesread Tuint64_t
  2971. Fri_diskio_byteswritten Tuint64_t
  2972. Fri_cpu_time_qos_default Tuint64_t
  2973. Fri_cpu_time_qos_maintenance Tuint64_t
  2974. Fri_cpu_time_qos_background Tuint64_t
  2975. Fri_cpu_time_qos_utility Tuint64_t
  2976. Fri_cpu_time_qos_legacy Tuint64_t
  2977. Fri_cpu_time_qos_user_initiated Tuint64_t
  2978. Fri_cpu_time_qos_user_interactive Tuint64_t
  2979. Fri_billed_system_time Tuint64_t
  2980. Fri_serviced_system_time Tuint64_t
  2981. Fri_logical_writes Tuint64_t
  2982. Fri_lifetime_max_phys_footprint Tuint64_t
  2983. Fri_instructions Tuint64_t
  2984. Fri_cycles Tuint64_t
  2985. Fri_billed_energy Tuint64_t
  2986. Fri_serviced_energy Tuint64_t
  2987. Fri_interval_max_phys_footprint Tuint64_t
  2988. Fri_runnable_time Tuint64_t
  2989. Fri_flags Tuint64_t
  2990. Fri_user_ptime Tuint64_t
  2991. Fri_system_ptime Tuint64_t
  2992. Fri_pinstructions Tuint64_t
  2993. Fri_pcycles Tuint64_t
  2994. Fri_energy_nj Tuint64_t
  2995. Fri_penergy_nj Tuint64_t
  2996. Fri_secure_time_in_system Tuint64_t
  2997. Fri_secure_ptime_in_system Tuint64_t
  2998. Fri_neural_footprint Tuint64_t
  2999. Fri_lifetime_max_neural_footprint Tuint64_t
  3000. Fri_interval_max_neural_footprint Tuint64_t
  3001. Fri_reserved [9]Tuint64_t
  3002. }
  3003. type Trusage_info_current = struct {
  3004. Fri_uuid [16]Tuint8_t
  3005. Fri_user_time Tuint64_t
  3006. Fri_system_time Tuint64_t
  3007. Fri_pkg_idle_wkups Tuint64_t
  3008. Fri_interrupt_wkups Tuint64_t
  3009. Fri_pageins Tuint64_t
  3010. Fri_wired_size Tuint64_t
  3011. Fri_resident_size Tuint64_t
  3012. Fri_phys_footprint Tuint64_t
  3013. Fri_proc_start_abstime Tuint64_t
  3014. Fri_proc_exit_abstime Tuint64_t
  3015. Fri_child_user_time Tuint64_t
  3016. Fri_child_system_time Tuint64_t
  3017. Fri_child_pkg_idle_wkups Tuint64_t
  3018. Fri_child_interrupt_wkups Tuint64_t
  3019. Fri_child_pageins Tuint64_t
  3020. Fri_child_elapsed_abstime Tuint64_t
  3021. Fri_diskio_bytesread Tuint64_t
  3022. Fri_diskio_byteswritten Tuint64_t
  3023. Fri_cpu_time_qos_default Tuint64_t
  3024. Fri_cpu_time_qos_maintenance Tuint64_t
  3025. Fri_cpu_time_qos_background Tuint64_t
  3026. Fri_cpu_time_qos_utility Tuint64_t
  3027. Fri_cpu_time_qos_legacy Tuint64_t
  3028. Fri_cpu_time_qos_user_initiated Tuint64_t
  3029. Fri_cpu_time_qos_user_interactive Tuint64_t
  3030. Fri_billed_system_time Tuint64_t
  3031. Fri_serviced_system_time Tuint64_t
  3032. Fri_logical_writes Tuint64_t
  3033. Fri_lifetime_max_phys_footprint Tuint64_t
  3034. Fri_instructions Tuint64_t
  3035. Fri_cycles Tuint64_t
  3036. Fri_billed_energy Tuint64_t
  3037. Fri_serviced_energy Tuint64_t
  3038. Fri_interval_max_phys_footprint Tuint64_t
  3039. Fri_runnable_time Tuint64_t
  3040. Fri_flags Tuint64_t
  3041. Fri_user_ptime Tuint64_t
  3042. Fri_system_ptime Tuint64_t
  3043. Fri_pinstructions Tuint64_t
  3044. Fri_pcycles Tuint64_t
  3045. Fri_energy_nj Tuint64_t
  3046. Fri_penergy_nj Tuint64_t
  3047. Fri_secure_time_in_system Tuint64_t
  3048. Fri_secure_ptime_in_system Tuint64_t
  3049. Fri_neural_footprint Tuint64_t
  3050. Fri_lifetime_max_neural_footprint Tuint64_t
  3051. Fri_interval_max_neural_footprint Tuint64_t
  3052. Fri_reserved [9]Tuint64_t
  3053. }
  3054. type Trlimit = struct {
  3055. Frlim_cur Trlim_t
  3056. Frlim_max Trlim_t
  3057. }
  3058. type Tproc_rlimit_control_wakeupmon = struct {
  3059. Fwm_flags Tuint32_t
  3060. Fwm_rate Tint32_t
  3061. }
  3062. type Twait = struct {
  3063. Fw_T [0]struct {
  3064. F__ccgo0 uint32
  3065. }
  3066. Fw_S [0]struct {
  3067. F__ccgo0 uint32
  3068. }
  3069. Fw_status int32
  3070. }
  3071. type Tct_rune_t = int32
  3072. type Trune_t = int32
  3073. type Tdiv_t = struct {
  3074. Fquot int32
  3075. Frem int32
  3076. }
  3077. type Tldiv_t = struct {
  3078. Fquot int64
  3079. Frem int64
  3080. }
  3081. type Tlldiv_t = struct {
  3082. Fquot int64
  3083. Frem int64
  3084. }
  3085. type Tmalloc_type_id_t = uint64
  3086. type Tdev_t = int32
  3087. type Tmode_t = uint16
  3088. type Tfloat_t = float32
  3089. type Tdouble_t = float64
  3090. type t__float2 = struct {
  3091. F__sinval float32
  3092. F__cosval float32
  3093. }
  3094. type t__double2 = struct {
  3095. F__sinval float64
  3096. F__cosval float64
  3097. }
  3098. type Texception = struct {
  3099. Ftype1 int32
  3100. Fname uintptr
  3101. Farg1 float64
  3102. Farg2 float64
  3103. Fretval float64
  3104. }
  3105. type Tfd_set = struct {
  3106. Ffds_bits [32]t__int32_t
  3107. }
  3108. type Ttimespec = struct {
  3109. Ftv_sec t__darwin_time_t
  3110. Ftv_nsec int64
  3111. }
  3112. type Ttimeval64 = struct {
  3113. Ftv_sec t__int64_t
  3114. Ftv_usec t__int64_t
  3115. }
  3116. type Ttime_t = int64
  3117. type Tsuseconds_t = int32
  3118. type Titimerval = struct {
  3119. Fit_interval Ttimeval
  3120. Fit_value Ttimeval
  3121. }
  3122. type Ttimezone = struct {
  3123. Ftz_minuteswest int32
  3124. Ftz_dsttime int32
  3125. }
  3126. type Tclockinfo = struct {
  3127. Fhz int32
  3128. Ftick int32
  3129. Ftickadj int32
  3130. Fstathz int32
  3131. Fprofhz int32
  3132. }
  3133. type Tclock_t = uint64
  3134. type Ttm = struct {
  3135. Ftm_sec int32
  3136. Ftm_min int32
  3137. Ftm_hour int32
  3138. Ftm_mday int32
  3139. Ftm_mon int32
  3140. Ftm_year int32
  3141. Ftm_wday int32
  3142. Ftm_yday int32
  3143. Ftm_isdst int32
  3144. Ftm_gmtoff int64
  3145. Ftm_zone uintptr
  3146. } //TODO "timezone" // _time.h:106:13:
  3147. type Tclockid_t = int32
  3148. const __CLOCK_REALTIME = 0
  3149. const __CLOCK_MONOTONIC = 6
  3150. const __CLOCK_MONOTONIC_RAW = 4
  3151. const __CLOCK_MONOTONIC_RAW_APPROX = 5
  3152. const __CLOCK_UPTIME_RAW = 8
  3153. const __CLOCK_UPTIME_RAW_APPROX = 9
  3154. const __CLOCK_PROCESS_CPUTIME_ID = 12
  3155. const __CLOCK_THREAD_CPUTIME_ID = 16
  3156. type Tu_char = uint8
  3157. type Tu_short = uint16
  3158. type Tu_int = uint32
  3159. type Tu_long = uint64
  3160. type Tushort = uint16
  3161. type Tuint = uint32
  3162. type Tu_quad_t = uint64
  3163. type Tquad_t = int64
  3164. type Tqaddr_t = uintptr
  3165. type Tcaddr_t = uintptr
  3166. type Tdaddr_t = int32
  3167. type Tfixpt_t = uint32
  3168. type Tblkcnt_t = int64
  3169. type Tblksize_t = int32
  3170. type Tgid_t = uint32
  3171. type Tin_addr_t = uint32
  3172. type Tin_port_t = uint16
  3173. type Tino_t = uint64
  3174. type Tino64_t = uint64
  3175. type Tkey_t = int32
  3176. type Tnlink_t = uint16
  3177. type Tsegsz_t = int32
  3178. type Tswblk_t = int32
  3179. type Tuseconds_t = uint32
  3180. type Tfd_mask = int32
  3181. type Tpthread_cond_t = struct {
  3182. F__sig int64
  3183. F__opaque [40]int8
  3184. }
  3185. type Tpthread_condattr_t = struct {
  3186. F__sig int64
  3187. F__opaque [8]int8
  3188. }
  3189. type Tpthread_mutex_t = struct {
  3190. F__sig int64
  3191. F__opaque [56]int8
  3192. }
  3193. type Tpthread_mutexattr_t = struct {
  3194. F__sig int64
  3195. F__opaque [8]int8
  3196. }
  3197. type Tpthread_once_t = struct {
  3198. F__sig int64
  3199. F__opaque [8]int8
  3200. }
  3201. type Tpthread_rwlock_t = struct {
  3202. F__sig int64
  3203. F__opaque [192]int8
  3204. }
  3205. type Tpthread_rwlockattr_t = struct {
  3206. F__sig int64
  3207. F__opaque [16]int8
  3208. }
  3209. type Tpthread_t = uintptr
  3210. type Tpthread_key_t = uint64
  3211. type Tfsblkcnt_t = uint32
  3212. type Tfsfilcnt_t = uint32
  3213. type Taccessx_descriptor = struct {
  3214. Fad_name_offset uint32
  3215. Fad_flags int32
  3216. Fad_pad [2]int32
  3217. }
  3218. type Tuuid_t = [16]uint8
  3219. type Tflock = struct {
  3220. Fl_start Toff_t
  3221. Fl_len Toff_t
  3222. Fl_pid Tpid_t
  3223. Fl_type int16
  3224. Fl_whence int16
  3225. }
  3226. type Tflocktimeout = struct {
  3227. Ffl Tflock
  3228. Ftimeout Ttimespec
  3229. }
  3230. type Tradvisory = struct {
  3231. Fra_offset Toff_t
  3232. Fra_count int32
  3233. }
  3234. type Tfsignatures_t = struct {
  3235. Ffs_file_start Toff_t
  3236. Ffs_blob_start uintptr
  3237. Ffs_blob_size Tsize_t
  3238. Ffs_fsignatures_size Tsize_t
  3239. Ffs_cdhash [20]int8
  3240. Ffs_hash_type int32
  3241. }
  3242. type Tfsignatures = Tfsignatures_t
  3243. type Tfsupplement_t = struct {
  3244. Ffs_file_start Toff_t
  3245. Ffs_blob_start Toff_t
  3246. Ffs_blob_size Tsize_t
  3247. Ffs_orig_fd int32
  3248. }
  3249. type Tfsupplement = Tfsupplement_t
  3250. type Tfchecklv_t = struct {
  3251. Flv_file_start Toff_t
  3252. Flv_error_message_size Tsize_t
  3253. Flv_error_message uintptr
  3254. }
  3255. type Tfchecklv = Tfchecklv_t
  3256. type Tfgetsigsinfo_t = struct {
  3257. Ffg_file_start Toff_t
  3258. Ffg_info_request int32
  3259. Ffg_sig_is_platform int32
  3260. }
  3261. type Tfgetsigsinfo = Tfgetsigsinfo_t
  3262. type Tfstore_t = struct {
  3263. Ffst_flags uint32
  3264. Ffst_posmode int32
  3265. Ffst_offset Toff_t
  3266. Ffst_length Toff_t
  3267. Ffst_bytesalloc Toff_t
  3268. }
  3269. type Tfstore = Tfstore_t
  3270. type Tfpunchhole_t = struct {
  3271. Ffp_flags uint32
  3272. Freserved uint32
  3273. Ffp_offset Toff_t
  3274. Ffp_length Toff_t
  3275. }
  3276. type Tfpunchhole = Tfpunchhole_t
  3277. type Tftrimactivefile_t = struct {
  3278. Ffta_offset Toff_t
  3279. Ffta_length Toff_t
  3280. }
  3281. type Tftrimactivefile = Tftrimactivefile_t
  3282. type Tfspecread_t = struct {
  3283. Ffsr_flags uint32
  3284. Freserved uint32
  3285. Ffsr_offset Toff_t
  3286. Ffsr_length Toff_t
  3287. }
  3288. type Tfspecread = Tfspecread_t
  3289. type Tfattributiontag_t = struct {
  3290. Fft_flags uint32
  3291. Fft_hash uint64
  3292. Fft_attribution_name [255]int8
  3293. }
  3294. type Tfattributiontag = Tfattributiontag_t
  3295. type Tlog2phys = struct {
  3296. Fl2p_flags uint32
  3297. Fl2p_contigbytes Toff_t
  3298. Fl2p_devoffset Toff_t
  3299. }
  3300. type Tfilesec_t = uintptr
  3301. type Tfilesec_property_t = int32
  3302. const _FILESEC_OWNER = 1
  3303. const _FILESEC_GROUP = 2
  3304. const _FILESEC_UUID = 3
  3305. const _FILESEC_MODE = 4
  3306. const _FILESEC_ACL = 5
  3307. const _FILESEC_GRPUUID = 6
  3308. const _FILESEC_ACL_RAW = 100
  3309. const _FILESEC_ACL_ALLOCSIZE = 101
  3310. type TXML_Char = int8
  3311. type TXML_LChar = int8
  3312. type TXML_Index = int64
  3313. type TXML_Size = uint64
  3314. type TXML_ParserStruct = struct {
  3315. Fm_userData uintptr
  3316. Fm_handlerArg uintptr
  3317. Fm_buffer uintptr
  3318. Fm_mem TXML_Memory_Handling_Suite
  3319. Fm_bufferPtr uintptr
  3320. Fm_bufferEnd uintptr
  3321. Fm_bufferLim uintptr
  3322. Fm_parseEndByteIndex TXML_Index
  3323. Fm_parseEndPtr uintptr
  3324. Fm_dataBuf uintptr
  3325. Fm_dataBufEnd uintptr
  3326. Fm_startElementHandler TXML_StartElementHandler
  3327. Fm_endElementHandler TXML_EndElementHandler
  3328. Fm_characterDataHandler TXML_CharacterDataHandler
  3329. Fm_processingInstructionHandler TXML_ProcessingInstructionHandler
  3330. Fm_commentHandler TXML_CommentHandler
  3331. Fm_startCdataSectionHandler TXML_StartCdataSectionHandler
  3332. Fm_endCdataSectionHandler TXML_EndCdataSectionHandler
  3333. Fm_defaultHandler TXML_DefaultHandler
  3334. Fm_startDoctypeDeclHandler TXML_StartDoctypeDeclHandler
  3335. Fm_endDoctypeDeclHandler TXML_EndDoctypeDeclHandler
  3336. Fm_unparsedEntityDeclHandler TXML_UnparsedEntityDeclHandler
  3337. Fm_notationDeclHandler TXML_NotationDeclHandler
  3338. Fm_startNamespaceDeclHandler TXML_StartNamespaceDeclHandler
  3339. Fm_endNamespaceDeclHandler TXML_EndNamespaceDeclHandler
  3340. Fm_notStandaloneHandler TXML_NotStandaloneHandler
  3341. Fm_externalEntityRefHandler TXML_ExternalEntityRefHandler
  3342. Fm_externalEntityRefHandlerArg TXML_Parser
  3343. Fm_skippedEntityHandler TXML_SkippedEntityHandler
  3344. Fm_unknownEncodingHandler TXML_UnknownEncodingHandler
  3345. Fm_elementDeclHandler TXML_ElementDeclHandler
  3346. Fm_attlistDeclHandler TXML_AttlistDeclHandler
  3347. Fm_entityDeclHandler TXML_EntityDeclHandler
  3348. Fm_xmlDeclHandler TXML_XmlDeclHandler
  3349. Fm_encoding uintptr
  3350. Fm_initEncoding TINIT_ENCODING
  3351. Fm_internalEncoding uintptr
  3352. Fm_protocolEncodingName uintptr
  3353. Fm_ns TXML_Bool
  3354. Fm_ns_triplets TXML_Bool
  3355. Fm_unknownEncodingMem uintptr
  3356. Fm_unknownEncodingData uintptr
  3357. Fm_unknownEncodingHandlerData uintptr
  3358. Fm_unknownEncodingRelease uintptr
  3359. Fm_prologState TPROLOG_STATE
  3360. Fm_processor uintptr
  3361. Fm_errorCode _XML_Error
  3362. Fm_eventPtr uintptr
  3363. Fm_eventEndPtr uintptr
  3364. Fm_positionPtr uintptr
  3365. Fm_openInternalEntities uintptr
  3366. Fm_freeInternalEntities uintptr
  3367. Fm_defaultExpandInternalEntities TXML_Bool
  3368. Fm_tagLevel int32
  3369. Fm_declEntity uintptr
  3370. Fm_doctypeName uintptr
  3371. Fm_doctypeSysid uintptr
  3372. Fm_doctypePubid uintptr
  3373. Fm_declAttributeType uintptr
  3374. Fm_declNotationName uintptr
  3375. Fm_declNotationPublicId uintptr
  3376. Fm_declElementType uintptr
  3377. Fm_declAttributeId uintptr
  3378. Fm_declAttributeIsCdata TXML_Bool
  3379. Fm_declAttributeIsId TXML_Bool
  3380. Fm_dtd uintptr
  3381. Fm_curBase uintptr
  3382. Fm_tagStack uintptr
  3383. Fm_freeTagList uintptr
  3384. Fm_inheritedBindings uintptr
  3385. Fm_freeBindingList uintptr
  3386. Fm_attsSize int32
  3387. Fm_nSpecifiedAtts int32
  3388. Fm_idAttIndex int32
  3389. Fm_atts uintptr
  3390. Fm_nsAtts uintptr
  3391. Fm_nsAttsVersion uint64
  3392. Fm_nsAttsPower uint8
  3393. Fm_position TPOSITION
  3394. Fm_tempPool TSTRING_POOL
  3395. Fm_temp2Pool TSTRING_POOL
  3396. Fm_groupConnector uintptr
  3397. Fm_groupSize uint32
  3398. Fm_namespaceSeparator TXML_Char
  3399. Fm_parentParser TXML_Parser
  3400. Fm_parsingStatus TXML_ParsingStatus
  3401. Fm_isParamEntity TXML_Bool
  3402. Fm_useForeignDTD TXML_Bool
  3403. Fm_paramEntityParsing _XML_ParamEntityParsing
  3404. Fm_hash_secret_salt uint64
  3405. Fm_accounting TACCOUNTING
  3406. Fm_entity_stats TENTITY_STATS
  3407. }
  3408. type _XML_Error = int32
  3409. const _XML_ERROR_NONE = 0
  3410. const _XML_ERROR_NO_MEMORY = 1
  3411. const _XML_ERROR_SYNTAX = 2
  3412. const _XML_ERROR_NO_ELEMENTS = 3
  3413. const _XML_ERROR_INVALID_TOKEN = 4
  3414. const _XML_ERROR_UNCLOSED_TOKEN = 5
  3415. const _XML_ERROR_PARTIAL_CHAR = 6
  3416. const _XML_ERROR_TAG_MISMATCH = 7
  3417. const _XML_ERROR_DUPLICATE_ATTRIBUTE = 8
  3418. const _XML_ERROR_JUNK_AFTER_DOC_ELEMENT = 9
  3419. const _XML_ERROR_PARAM_ENTITY_REF = 10
  3420. const _XML_ERROR_UNDEFINED_ENTITY = 11
  3421. const _XML_ERROR_RECURSIVE_ENTITY_REF = 12
  3422. const _XML_ERROR_ASYNC_ENTITY = 13
  3423. const _XML_ERROR_BAD_CHAR_REF = 14
  3424. const _XML_ERROR_BINARY_ENTITY_REF = 15
  3425. const _XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF = 16
  3426. const _XML_ERROR_MISPLACED_XML_PI = 17
  3427. const _XML_ERROR_UNKNOWN_ENCODING = 18
  3428. const _XML_ERROR_INCORRECT_ENCODING = 19
  3429. const _XML_ERROR_UNCLOSED_CDATA_SECTION = 20
  3430. const _XML_ERROR_EXTERNAL_ENTITY_HANDLING = 21
  3431. const _XML_ERROR_NOT_STANDALONE = 22
  3432. const _XML_ERROR_UNEXPECTED_STATE = 23
  3433. const _XML_ERROR_ENTITY_DECLARED_IN_PE = 24
  3434. const _XML_ERROR_FEATURE_REQUIRES_XML_DTD = 25
  3435. const _XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING = 26
  3436. const _XML_ERROR_UNBOUND_PREFIX = 27
  3437. const _XML_ERROR_UNDECLARING_PREFIX = 28
  3438. const _XML_ERROR_INCOMPLETE_PE = 29
  3439. const _XML_ERROR_XML_DECL = 30
  3440. const _XML_ERROR_TEXT_DECL = 31
  3441. const _XML_ERROR_PUBLICID = 32
  3442. const _XML_ERROR_SUSPENDED = 33
  3443. const _XML_ERROR_NOT_SUSPENDED = 34
  3444. const _XML_ERROR_ABORTED = 35
  3445. const _XML_ERROR_FINISHED = 36
  3446. const _XML_ERROR_SUSPEND_PE = 37
  3447. const _XML_ERROR_RESERVED_PREFIX_XML = 38
  3448. const _XML_ERROR_RESERVED_PREFIX_XMLNS = 39
  3449. const _XML_ERROR_RESERVED_NAMESPACE_URI = 40
  3450. const _XML_ERROR_INVALID_ARGUMENT = 41
  3451. const _XML_ERROR_NO_BUFFER = 42
  3452. const _XML_ERROR_AMPLIFICATION_LIMIT_BREACH = 43
  3453. type _XML_ParamEntityParsing = int32
  3454. const _XML_PARAM_ENTITY_PARSING_NEVER = 0
  3455. const _XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE = 1
  3456. const _XML_PARAM_ENTITY_PARSING_ALWAYS = 2
  3457. type TXML_Parser = uintptr
  3458. type TXML_Bool = uint8
  3459. type _XML_Status = int32
  3460. const _XML_STATUS_ERROR = 0
  3461. const _XML_STATUS_OK = 1
  3462. const _XML_STATUS_SUSPENDED = 2
  3463. type _XML_Content_Type = int32
  3464. const _XML_CTYPE_EMPTY = 1
  3465. const _XML_CTYPE_ANY = 2
  3466. const _XML_CTYPE_MIXED = 3
  3467. const _XML_CTYPE_NAME = 4
  3468. const _XML_CTYPE_CHOICE = 5
  3469. const _XML_CTYPE_SEQ = 6
  3470. type _XML_Content_Quant = int32
  3471. const _XML_CQUANT_NONE = 0
  3472. const _XML_CQUANT_OPT = 1
  3473. const _XML_CQUANT_REP = 2
  3474. const _XML_CQUANT_PLUS = 3
  3475. type TXML_Content = struct {
  3476. Ftype1 _XML_Content_Type
  3477. Fquant _XML_Content_Quant
  3478. Fname uintptr
  3479. Fnumchildren uint32
  3480. Fchildren uintptr
  3481. }
  3482. type TXML_cp = TXML_Content
  3483. type TXML_ElementDeclHandler = uintptr
  3484. type TXML_AttlistDeclHandler = uintptr
  3485. type TXML_XmlDeclHandler = uintptr
  3486. type TXML_Memory_Handling_Suite = struct {
  3487. Fmalloc_fcn uintptr
  3488. Frealloc_fcn uintptr
  3489. Ffree_fcn uintptr
  3490. }
  3491. type TXML_StartElementHandler = uintptr
  3492. type TXML_EndElementHandler = uintptr
  3493. type TXML_CharacterDataHandler = uintptr
  3494. type TXML_ProcessingInstructionHandler = uintptr
  3495. type TXML_CommentHandler = uintptr
  3496. type TXML_StartCdataSectionHandler = uintptr
  3497. type TXML_EndCdataSectionHandler = uintptr
  3498. type TXML_DefaultHandler = uintptr
  3499. type TXML_StartDoctypeDeclHandler = uintptr
  3500. type TXML_EndDoctypeDeclHandler = uintptr
  3501. type TXML_EntityDeclHandler = uintptr
  3502. type TXML_UnparsedEntityDeclHandler = uintptr
  3503. type TXML_NotationDeclHandler = uintptr
  3504. type TXML_StartNamespaceDeclHandler = uintptr
  3505. type TXML_EndNamespaceDeclHandler = uintptr
  3506. type TXML_NotStandaloneHandler = uintptr
  3507. type TXML_ExternalEntityRefHandler = uintptr
  3508. type TXML_SkippedEntityHandler = uintptr
  3509. type TXML_Encoding = struct {
  3510. Fmap1 [256]int32
  3511. Fdata uintptr
  3512. Fconvert uintptr
  3513. Frelease uintptr
  3514. }
  3515. type TXML_UnknownEncodingHandler = uintptr
  3516. type _XML_Parsing = int32
  3517. const _XML_INITIALIZED = 0
  3518. const _XML_PARSING = 1
  3519. const _XML_FINISHED = 2
  3520. const _XML_SUSPENDED = 3
  3521. type TXML_ParsingStatus = struct {
  3522. Fparsing _XML_Parsing
  3523. FfinalBuffer TXML_Bool
  3524. }
  3525. type TXML_Expat_Version = struct {
  3526. Fmajor int32
  3527. Fminor int32
  3528. Fmicro int32
  3529. }
  3530. type _XML_FeatureEnum = int32
  3531. const _XML_FEATURE_END = 0
  3532. const _XML_FEATURE_UNICODE = 1
  3533. const _XML_FEATURE_UNICODE_WCHAR_T = 2
  3534. const _XML_FEATURE_DTD = 3
  3535. const _XML_FEATURE_CONTEXT_BYTES = 4
  3536. const _XML_FEATURE_MIN_SIZE = 5
  3537. const _XML_FEATURE_SIZEOF_XML_CHAR = 6
  3538. const _XML_FEATURE_SIZEOF_XML_LCHAR = 7
  3539. const _XML_FEATURE_NS = 8
  3540. const _XML_FEATURE_LARGE_SIZE = 9
  3541. const _XML_FEATURE_ATTR_INFO = 10
  3542. const _XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT = 11
  3543. const _XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT = 12
  3544. type TXML_Feature = struct {
  3545. Ffeature _XML_FeatureEnum
  3546. Fname uintptr
  3547. Fvalue int64
  3548. }
  3549. type Tsiphash = struct {
  3550. Fv0 Tuint64_t
  3551. Fv1 Tuint64_t
  3552. Fv2 Tuint64_t
  3553. Fv3 Tuint64_t
  3554. Fbuf [8]uint8
  3555. Fp uintptr
  3556. Fc Tuint64_t
  3557. }
  3558. type Tsipkey = struct {
  3559. Fk [2]Tuint64_t
  3560. }
  3561. func _sip_tokey(tls *libc.TLS, key uintptr, src uintptr) (r uintptr) {
  3562. *(*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)
  3563. *(*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)
  3564. return key
  3565. }
  3566. func _sip_round(tls *libc.TLS, H uintptr, rounds int32) {
  3567. var i int32
  3568. _ = i
  3569. i = 0
  3570. for {
  3571. if !(i < rounds) {
  3572. break
  3573. }
  3574. *(*Tuint64_t)(unsafe.Pointer(H)) += (*Tsiphash)(unsafe.Pointer(H)).Fv1
  3575. (*Tsiphash)(unsafe.Pointer(H)).Fv1 = (*Tsiphash)(unsafe.Pointer(H)).Fv1<<libc.Int32FromInt32(13) | (*Tsiphash)(unsafe.Pointer(H)).Fv1>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(13))
  3576. *(*Tuint64_t)(unsafe.Pointer(H + 8)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv0
  3577. (*Tsiphash)(unsafe.Pointer(H)).Fv0 = (*Tsiphash)(unsafe.Pointer(H)).Fv0<<libc.Int32FromInt32(32) | (*Tsiphash)(unsafe.Pointer(H)).Fv0>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(32))
  3578. *(*Tuint64_t)(unsafe.Pointer(H + 16)) += (*Tsiphash)(unsafe.Pointer(H)).Fv3
  3579. (*Tsiphash)(unsafe.Pointer(H)).Fv3 = (*Tsiphash)(unsafe.Pointer(H)).Fv3<<libc.Int32FromInt32(16) | (*Tsiphash)(unsafe.Pointer(H)).Fv3>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(16))
  3580. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv2
  3581. *(*Tuint64_t)(unsafe.Pointer(H)) += (*Tsiphash)(unsafe.Pointer(H)).Fv3
  3582. (*Tsiphash)(unsafe.Pointer(H)).Fv3 = (*Tsiphash)(unsafe.Pointer(H)).Fv3<<libc.Int32FromInt32(21) | (*Tsiphash)(unsafe.Pointer(H)).Fv3>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(21))
  3583. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv0
  3584. *(*Tuint64_t)(unsafe.Pointer(H + 16)) += (*Tsiphash)(unsafe.Pointer(H)).Fv1
  3585. (*Tsiphash)(unsafe.Pointer(H)).Fv1 = (*Tsiphash)(unsafe.Pointer(H)).Fv1<<libc.Int32FromInt32(17) | (*Tsiphash)(unsafe.Pointer(H)).Fv1>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(17))
  3586. *(*Tuint64_t)(unsafe.Pointer(H + 8)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv2
  3587. (*Tsiphash)(unsafe.Pointer(H)).Fv2 = (*Tsiphash)(unsafe.Pointer(H)).Fv2<<libc.Int32FromInt32(32) | (*Tsiphash)(unsafe.Pointer(H)).Fv2>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(32))
  3588. goto _1
  3589. _1:
  3590. ;
  3591. i++
  3592. }
  3593. }
  3594. func _sip24_init(tls *libc.TLS, H uintptr, key uintptr) (r uintptr) {
  3595. (*Tsiphash)(unsafe.Pointer(H)).Fv0 = libc.Uint64FromUint32(0x736f6d65)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x70736575)) ^ *(*Tuint64_t)(unsafe.Pointer(key))
  3596. (*Tsiphash)(unsafe.Pointer(H)).Fv1 = libc.Uint64FromUint32(0x646f7261)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x6e646f6d)) ^ *(*Tuint64_t)(unsafe.Pointer(key + 1*8))
  3597. (*Tsiphash)(unsafe.Pointer(H)).Fv2 = libc.Uint64FromUint32(0x6c796765)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x6e657261)) ^ *(*Tuint64_t)(unsafe.Pointer(key))
  3598. (*Tsiphash)(unsafe.Pointer(H)).Fv3 = libc.Uint64FromUint32(0x74656462)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x79746573)) ^ *(*Tuint64_t)(unsafe.Pointer(key + 1*8))
  3599. (*Tsiphash)(unsafe.Pointer(H)).Fp = H + 32
  3600. (*Tsiphash)(unsafe.Pointer(H)).Fc = uint64(0)
  3601. return H
  3602. }
  3603. func _sip24_update(tls *libc.TLS, H uintptr, src uintptr, len1 Tsize_t) (r uintptr) {
  3604. var m Tuint64_t
  3605. var p, pe, v1, v2, v3 uintptr
  3606. _, _, _, _, _, _ = m, p, pe, v1, v2, v3
  3607. p = src
  3608. pe = p + uintptr(len1)
  3609. for cond := true; cond; cond = p < pe {
  3610. for p < pe && (*Tsiphash)(unsafe.Pointer(H)).Fp < H+32+uintptr(libc.Uint64FromInt64(8)/libc.Uint64FromInt64(1)) {
  3611. v2 = H + 40
  3612. v1 = *(*uintptr)(unsafe.Pointer(v2))
  3613. *(*uintptr)(unsafe.Pointer(v2))++
  3614. v3 = p
  3615. p++
  3616. *(*uint8)(unsafe.Pointer(v1)) = *(*uint8)(unsafe.Pointer(v3))
  3617. }
  3618. if (*Tsiphash)(unsafe.Pointer(H)).Fp < H+32+uintptr(libc.Uint64FromInt64(8)/libc.Uint64FromInt64(1)) {
  3619. break
  3620. }
  3621. 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)
  3622. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= m
  3623. _sip_round(tls, H, int32(2))
  3624. *(*Tuint64_t)(unsafe.Pointer(H)) ^= m
  3625. (*Tsiphash)(unsafe.Pointer(H)).Fp = H + 32
  3626. *(*Tuint64_t)(unsafe.Pointer(H + 48)) += uint64(8)
  3627. }
  3628. return H
  3629. }
  3630. func _sip24_final(tls *libc.TLS, H uintptr) (r Tuint64_t) {
  3631. var b Tuint64_t
  3632. var left int8
  3633. _, _ = b, left
  3634. left = int8(int64((*Tsiphash)(unsafe.Pointer(H)).Fp) - t__predefined_ptrdiff_t(H+32))
  3635. b = ((*Tsiphash)(unsafe.Pointer(H)).Fc + libc.Uint64FromInt8(left)) << int32(56)
  3636. switch int32(left) {
  3637. case int32(7):
  3638. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 6))) << int32(48)
  3639. fallthrough
  3640. case int32(6):
  3641. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 5))) << int32(40)
  3642. fallthrough
  3643. case int32(5):
  3644. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 4))) << int32(32)
  3645. fallthrough
  3646. case int32(4):
  3647. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 3))) << int32(24)
  3648. fallthrough
  3649. case int32(3):
  3650. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 2))) << int32(16)
  3651. fallthrough
  3652. case int32(2):
  3653. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 1))) << int32(8)
  3654. fallthrough
  3655. case int32(1):
  3656. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32))) << 0
  3657. fallthrough
  3658. case 0:
  3659. break
  3660. }
  3661. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= b
  3662. _sip_round(tls, H, int32(2))
  3663. *(*Tuint64_t)(unsafe.Pointer(H)) ^= b
  3664. *(*Tuint64_t)(unsafe.Pointer(H + 16)) ^= uint64(0xff)
  3665. _sip_round(tls, H, int32(4))
  3666. return (*Tsiphash)(unsafe.Pointer(H)).Fv0 ^ (*Tsiphash)(unsafe.Pointer(H)).Fv1 ^ (*Tsiphash)(unsafe.Pointer(H)).Fv2 ^ (*Tsiphash)(unsafe.Pointer(H)).Fv3
  3667. }
  3668. func _siphash24(tls *libc.TLS, src uintptr, len1 Tsize_t, key uintptr) (r Tuint64_t) {
  3669. bp := tls.Alloc(64)
  3670. defer tls.Free(64)
  3671. var _ /* state at bp+0 */ Tsiphash
  3672. *(*Tsiphash)(unsafe.Pointer(bp)) = Tsiphash{}
  3673. return _sip24_final(tls, _sip24_update(tls, _sip24_init(tls, bp, key), src, len1))
  3674. }
  3675. func _sip24_valid(tls *libc.TLS) (r int32) {
  3676. bp := tls.Alloc(80)
  3677. defer tls.Free(80)
  3678. var i Tsize_t
  3679. var _ /* in at bp+0 */ [64]uint8
  3680. var _ /* k at bp+64 */ Tsipkey
  3681. _ = i
  3682. _sip_tokey(tls, bp+64, __ccgo_ts)
  3683. i = uint64(0)
  3684. for {
  3685. if !(i < uint64(64)) {
  3686. break
  3687. }
  3688. (*(*[64]uint8)(unsafe.Pointer(bp)))[i] = uint8(i)
  3689. 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) {
  3690. return 0
  3691. }
  3692. goto _1
  3693. _1:
  3694. ;
  3695. i++
  3696. }
  3697. return int32(1)
  3698. }
  3699. var _vectors = [64][8]uint8{
  3700. 0: {
  3701. 0: uint8(0x31),
  3702. 1: uint8(0x0e),
  3703. 2: uint8(0x0e),
  3704. 3: uint8(0xdd),
  3705. 4: uint8(0x47),
  3706. 5: uint8(0xdb),
  3707. 6: uint8(0x6f),
  3708. 7: uint8(0x72),
  3709. },
  3710. 1: {
  3711. 0: uint8(0xfd),
  3712. 1: uint8(0x67),
  3713. 2: uint8(0xdc),
  3714. 3: uint8(0x93),
  3715. 4: uint8(0xc5),
  3716. 5: uint8(0x39),
  3717. 6: uint8(0xf8),
  3718. 7: uint8(0x74),
  3719. },
  3720. 2: {
  3721. 0: uint8(0x5a),
  3722. 1: uint8(0x4f),
  3723. 2: uint8(0xa9),
  3724. 3: uint8(0xd9),
  3725. 4: uint8(0x09),
  3726. 5: uint8(0x80),
  3727. 6: uint8(0x6c),
  3728. 7: uint8(0x0d),
  3729. },
  3730. 3: {
  3731. 0: uint8(0x2d),
  3732. 1: uint8(0x7e),
  3733. 2: uint8(0xfb),
  3734. 3: uint8(0xd7),
  3735. 4: uint8(0x96),
  3736. 5: uint8(0x66),
  3737. 6: uint8(0x67),
  3738. 7: uint8(0x85),
  3739. },
  3740. 4: {
  3741. 0: uint8(0xb7),
  3742. 1: uint8(0x87),
  3743. 2: uint8(0x71),
  3744. 3: uint8(0x27),
  3745. 4: uint8(0xe0),
  3746. 5: uint8(0x94),
  3747. 6: uint8(0x27),
  3748. 7: uint8(0xcf),
  3749. },
  3750. 5: {
  3751. 0: uint8(0x8d),
  3752. 1: uint8(0xa6),
  3753. 2: uint8(0x99),
  3754. 3: uint8(0xcd),
  3755. 4: uint8(0x64),
  3756. 5: uint8(0x55),
  3757. 6: uint8(0x76),
  3758. 7: uint8(0x18),
  3759. },
  3760. 6: {
  3761. 0: uint8(0xce),
  3762. 1: uint8(0xe3),
  3763. 2: uint8(0xfe),
  3764. 3: uint8(0x58),
  3765. 4: uint8(0x6e),
  3766. 5: uint8(0x46),
  3767. 6: uint8(0xc9),
  3768. 7: uint8(0xcb),
  3769. },
  3770. 7: {
  3771. 0: uint8(0x37),
  3772. 1: uint8(0xd1),
  3773. 2: uint8(0x01),
  3774. 3: uint8(0x8b),
  3775. 4: uint8(0xf5),
  3776. 6: uint8(0x02),
  3777. 7: uint8(0xab),
  3778. },
  3779. 8: {
  3780. 0: uint8(0x62),
  3781. 1: uint8(0x24),
  3782. 2: uint8(0x93),
  3783. 3: uint8(0x9a),
  3784. 4: uint8(0x79),
  3785. 5: uint8(0xf5),
  3786. 6: uint8(0xf5),
  3787. 7: uint8(0x93),
  3788. },
  3789. 9: {
  3790. 0: uint8(0xb0),
  3791. 1: uint8(0xe4),
  3792. 2: uint8(0xa9),
  3793. 3: uint8(0x0b),
  3794. 4: uint8(0xdf),
  3795. 5: uint8(0x82),
  3796. 7: uint8(0x9e),
  3797. },
  3798. 10: {
  3799. 0: uint8(0xf3),
  3800. 1: uint8(0xb9),
  3801. 2: uint8(0xdd),
  3802. 3: uint8(0x94),
  3803. 4: uint8(0xc5),
  3804. 5: uint8(0xbb),
  3805. 6: uint8(0x5d),
  3806. 7: uint8(0x7a),
  3807. },
  3808. 11: {
  3809. 0: uint8(0xa7),
  3810. 1: uint8(0xad),
  3811. 2: uint8(0x6b),
  3812. 3: uint8(0x22),
  3813. 4: uint8(0x46),
  3814. 5: uint8(0x2f),
  3815. 6: uint8(0xb3),
  3816. 7: uint8(0xf4),
  3817. },
  3818. 12: {
  3819. 0: uint8(0xfb),
  3820. 1: uint8(0xe5),
  3821. 2: uint8(0x0e),
  3822. 3: uint8(0x86),
  3823. 4: uint8(0xbc),
  3824. 5: uint8(0x8f),
  3825. 6: uint8(0x1e),
  3826. 7: uint8(0x75),
  3827. },
  3828. 13: {
  3829. 0: uint8(0x90),
  3830. 1: uint8(0x3d),
  3831. 2: uint8(0x84),
  3832. 3: uint8(0xc0),
  3833. 4: uint8(0x27),
  3834. 5: uint8(0x56),
  3835. 6: uint8(0xea),
  3836. 7: uint8(0x14),
  3837. },
  3838. 14: {
  3839. 0: uint8(0xee),
  3840. 1: uint8(0xf2),
  3841. 2: uint8(0x7a),
  3842. 3: uint8(0x8e),
  3843. 4: uint8(0x90),
  3844. 5: uint8(0xca),
  3845. 6: uint8(0x23),
  3846. 7: uint8(0xf7),
  3847. },
  3848. 15: {
  3849. 0: uint8(0xe5),
  3850. 1: uint8(0x45),
  3851. 2: uint8(0xbe),
  3852. 3: uint8(0x49),
  3853. 4: uint8(0x61),
  3854. 5: uint8(0xca),
  3855. 6: uint8(0x29),
  3856. 7: uint8(0xa1),
  3857. },
  3858. 16: {
  3859. 0: uint8(0xdb),
  3860. 1: uint8(0x9b),
  3861. 2: uint8(0xc2),
  3862. 3: uint8(0x57),
  3863. 4: uint8(0x7f),
  3864. 5: uint8(0xcc),
  3865. 6: uint8(0x2a),
  3866. 7: uint8(0x3f),
  3867. },
  3868. 17: {
  3869. 0: uint8(0x94),
  3870. 1: uint8(0x47),
  3871. 2: uint8(0xbe),
  3872. 3: uint8(0x2c),
  3873. 4: uint8(0xf5),
  3874. 5: uint8(0xe9),
  3875. 6: uint8(0x9a),
  3876. 7: uint8(0x69),
  3877. },
  3878. 18: {
  3879. 0: uint8(0x9c),
  3880. 1: uint8(0xd3),
  3881. 2: uint8(0x8d),
  3882. 3: uint8(0x96),
  3883. 4: uint8(0xf0),
  3884. 5: uint8(0xb3),
  3885. 6: uint8(0xc1),
  3886. 7: uint8(0x4b),
  3887. },
  3888. 19: {
  3889. 0: uint8(0xbd),
  3890. 1: uint8(0x61),
  3891. 2: uint8(0x79),
  3892. 3: uint8(0xa7),
  3893. 4: uint8(0x1d),
  3894. 5: uint8(0xc9),
  3895. 6: uint8(0x6d),
  3896. 7: uint8(0xbb),
  3897. },
  3898. 20: {
  3899. 0: uint8(0x98),
  3900. 1: uint8(0xee),
  3901. 2: uint8(0xa2),
  3902. 3: uint8(0x1a),
  3903. 4: uint8(0xf2),
  3904. 5: uint8(0x5c),
  3905. 6: uint8(0xd6),
  3906. 7: uint8(0xbe),
  3907. },
  3908. 21: {
  3909. 0: uint8(0xc7),
  3910. 1: uint8(0x67),
  3911. 2: uint8(0x3b),
  3912. 3: uint8(0x2e),
  3913. 4: uint8(0xb0),
  3914. 5: uint8(0xcb),
  3915. 6: uint8(0xf2),
  3916. 7: uint8(0xd0),
  3917. },
  3918. 22: {
  3919. 0: uint8(0x88),
  3920. 1: uint8(0x3e),
  3921. 2: uint8(0xa3),
  3922. 3: uint8(0xe3),
  3923. 4: uint8(0x95),
  3924. 5: uint8(0x67),
  3925. 6: uint8(0x53),
  3926. 7: uint8(0x93),
  3927. },
  3928. 23: {
  3929. 0: uint8(0xc8),
  3930. 1: uint8(0xce),
  3931. 2: uint8(0x5c),
  3932. 3: uint8(0xcd),
  3933. 4: uint8(0x8c),
  3934. 5: uint8(0x03),
  3935. 6: uint8(0x0c),
  3936. 7: uint8(0xa8),
  3937. },
  3938. 24: {
  3939. 0: uint8(0x94),
  3940. 1: uint8(0xaf),
  3941. 2: uint8(0x49),
  3942. 3: uint8(0xf6),
  3943. 4: uint8(0xc6),
  3944. 5: uint8(0x50),
  3945. 6: uint8(0xad),
  3946. 7: uint8(0xb8),
  3947. },
  3948. 25: {
  3949. 0: uint8(0xea),
  3950. 1: uint8(0xb8),
  3951. 2: uint8(0x85),
  3952. 3: uint8(0x8a),
  3953. 4: uint8(0xde),
  3954. 5: uint8(0x92),
  3955. 6: uint8(0xe1),
  3956. 7: uint8(0xbc),
  3957. },
  3958. 26: {
  3959. 0: uint8(0xf3),
  3960. 1: uint8(0x15),
  3961. 2: uint8(0xbb),
  3962. 3: uint8(0x5b),
  3963. 4: uint8(0xb8),
  3964. 5: uint8(0x35),
  3965. 6: uint8(0xd8),
  3966. 7: uint8(0x17),
  3967. },
  3968. 27: {
  3969. 0: uint8(0xad),
  3970. 1: uint8(0xcf),
  3971. 2: uint8(0x6b),
  3972. 3: uint8(0x07),
  3973. 4: uint8(0x63),
  3974. 5: uint8(0x61),
  3975. 6: uint8(0x2e),
  3976. 7: uint8(0x2f),
  3977. },
  3978. 28: {
  3979. 0: uint8(0xa5),
  3980. 1: uint8(0xc9),
  3981. 2: uint8(0x1d),
  3982. 3: uint8(0xa7),
  3983. 4: uint8(0xac),
  3984. 5: uint8(0xaa),
  3985. 6: uint8(0x4d),
  3986. 7: uint8(0xde),
  3987. },
  3988. 29: {
  3989. 0: uint8(0x71),
  3990. 1: uint8(0x65),
  3991. 2: uint8(0x95),
  3992. 3: uint8(0x87),
  3993. 4: uint8(0x66),
  3994. 5: uint8(0x50),
  3995. 6: uint8(0xa2),
  3996. 7: uint8(0xa6),
  3997. },
  3998. 30: {
  3999. 0: uint8(0x28),
  4000. 1: uint8(0xef),
  4001. 2: uint8(0x49),
  4002. 3: uint8(0x5c),
  4003. 4: uint8(0x53),
  4004. 5: uint8(0xa3),
  4005. 6: uint8(0x87),
  4006. 7: uint8(0xad),
  4007. },
  4008. 31: {
  4009. 0: uint8(0x42),
  4010. 1: uint8(0xc3),
  4011. 2: uint8(0x41),
  4012. 3: uint8(0xd8),
  4013. 4: uint8(0xfa),
  4014. 5: uint8(0x92),
  4015. 6: uint8(0xd8),
  4016. 7: uint8(0x32),
  4017. },
  4018. 32: {
  4019. 0: uint8(0xce),
  4020. 1: uint8(0x7c),
  4021. 2: uint8(0xf2),
  4022. 3: uint8(0x72),
  4023. 4: uint8(0x2f),
  4024. 5: uint8(0x51),
  4025. 6: uint8(0x27),
  4026. 7: uint8(0x71),
  4027. },
  4028. 33: {
  4029. 0: uint8(0xe3),
  4030. 1: uint8(0x78),
  4031. 2: uint8(0x59),
  4032. 3: uint8(0xf9),
  4033. 4: uint8(0x46),
  4034. 5: uint8(0x23),
  4035. 6: uint8(0xf3),
  4036. 7: uint8(0xa7),
  4037. },
  4038. 34: {
  4039. 0: uint8(0x38),
  4040. 1: uint8(0x12),
  4041. 2: uint8(0x05),
  4042. 3: uint8(0xbb),
  4043. 4: uint8(0x1a),
  4044. 5: uint8(0xb0),
  4045. 6: uint8(0xe0),
  4046. 7: uint8(0x12),
  4047. },
  4048. 35: {
  4049. 0: uint8(0xae),
  4050. 1: uint8(0x97),
  4051. 2: uint8(0xa1),
  4052. 3: uint8(0x0f),
  4053. 4: uint8(0xd4),
  4054. 5: uint8(0x34),
  4055. 6: uint8(0xe0),
  4056. 7: uint8(0x15),
  4057. },
  4058. 36: {
  4059. 0: uint8(0xb4),
  4060. 1: uint8(0xa3),
  4061. 2: uint8(0x15),
  4062. 3: uint8(0x08),
  4063. 4: uint8(0xbe),
  4064. 5: uint8(0xff),
  4065. 6: uint8(0x4d),
  4066. 7: uint8(0x31),
  4067. },
  4068. 37: {
  4069. 0: uint8(0x81),
  4070. 1: uint8(0x39),
  4071. 2: uint8(0x62),
  4072. 3: uint8(0x29),
  4073. 4: uint8(0xf0),
  4074. 5: uint8(0x90),
  4075. 6: uint8(0x79),
  4076. 7: uint8(0x02),
  4077. },
  4078. 38: {
  4079. 0: uint8(0x4d),
  4080. 1: uint8(0x0c),
  4081. 2: uint8(0xf4),
  4082. 3: uint8(0x9e),
  4083. 4: uint8(0xe5),
  4084. 5: uint8(0xd4),
  4085. 6: uint8(0xdc),
  4086. 7: uint8(0xca),
  4087. },
  4088. 39: {
  4089. 0: uint8(0x5c),
  4090. 1: uint8(0x73),
  4091. 2: uint8(0x33),
  4092. 3: uint8(0x6a),
  4093. 4: uint8(0x76),
  4094. 5: uint8(0xd8),
  4095. 6: uint8(0xbf),
  4096. 7: uint8(0x9a),
  4097. },
  4098. 40: {
  4099. 0: uint8(0xd0),
  4100. 1: uint8(0xa7),
  4101. 2: uint8(0x04),
  4102. 3: uint8(0x53),
  4103. 4: uint8(0x6b),
  4104. 5: uint8(0xa9),
  4105. 6: uint8(0x3e),
  4106. 7: uint8(0x0e),
  4107. },
  4108. 41: {
  4109. 0: uint8(0x92),
  4110. 1: uint8(0x59),
  4111. 2: uint8(0x58),
  4112. 3: uint8(0xfc),
  4113. 4: uint8(0xd6),
  4114. 5: uint8(0x42),
  4115. 6: uint8(0x0c),
  4116. 7: uint8(0xad),
  4117. },
  4118. 42: {
  4119. 0: uint8(0xa9),
  4120. 1: uint8(0x15),
  4121. 2: uint8(0xc2),
  4122. 3: uint8(0x9b),
  4123. 4: uint8(0xc8),
  4124. 5: uint8(0x06),
  4125. 6: uint8(0x73),
  4126. 7: uint8(0x18),
  4127. },
  4128. 43: {
  4129. 0: uint8(0x95),
  4130. 1: uint8(0x2b),
  4131. 2: uint8(0x79),
  4132. 3: uint8(0xf3),
  4133. 4: uint8(0xbc),
  4134. 5: uint8(0x0a),
  4135. 6: uint8(0xa6),
  4136. 7: uint8(0xd4),
  4137. },
  4138. 44: {
  4139. 0: uint8(0xf2),
  4140. 1: uint8(0x1d),
  4141. 2: uint8(0xf2),
  4142. 3: uint8(0xe4),
  4143. 4: uint8(0x1d),
  4144. 5: uint8(0x45),
  4145. 6: uint8(0x35),
  4146. 7: uint8(0xf9),
  4147. },
  4148. 45: {
  4149. 0: uint8(0x87),
  4150. 1: uint8(0x57),
  4151. 2: uint8(0x75),
  4152. 3: uint8(0x19),
  4153. 4: uint8(0x04),
  4154. 5: uint8(0x8f),
  4155. 6: uint8(0x53),
  4156. 7: uint8(0xa9),
  4157. },
  4158. 46: {
  4159. 0: uint8(0x10),
  4160. 1: uint8(0xa5),
  4161. 2: uint8(0x6c),
  4162. 3: uint8(0xf5),
  4163. 4: uint8(0xdf),
  4164. 5: uint8(0xcd),
  4165. 6: uint8(0x9a),
  4166. 7: uint8(0xdb),
  4167. },
  4168. 47: {
  4169. 0: uint8(0xeb),
  4170. 1: uint8(0x75),
  4171. 2: uint8(0x09),
  4172. 3: uint8(0x5c),
  4173. 4: uint8(0xcd),
  4174. 5: uint8(0x98),
  4175. 6: uint8(0x6c),
  4176. 7: uint8(0xd0),
  4177. },
  4178. 48: {
  4179. 0: uint8(0x51),
  4180. 1: uint8(0xa9),
  4181. 2: uint8(0xcb),
  4182. 3: uint8(0x9e),
  4183. 4: uint8(0xcb),
  4184. 5: uint8(0xa3),
  4185. 6: uint8(0x12),
  4186. 7: uint8(0xe6),
  4187. },
  4188. 49: {
  4189. 0: uint8(0x96),
  4190. 1: uint8(0xaf),
  4191. 2: uint8(0xad),
  4192. 3: uint8(0xfc),
  4193. 4: uint8(0x2c),
  4194. 5: uint8(0xe6),
  4195. 6: uint8(0x66),
  4196. 7: uint8(0xc7),
  4197. },
  4198. 50: {
  4199. 0: uint8(0x72),
  4200. 1: uint8(0xfe),
  4201. 2: uint8(0x52),
  4202. 3: uint8(0x97),
  4203. 4: uint8(0x5a),
  4204. 5: uint8(0x43),
  4205. 6: uint8(0x64),
  4206. 7: uint8(0xee),
  4207. },
  4208. 51: {
  4209. 0: uint8(0x5a),
  4210. 1: uint8(0x16),
  4211. 2: uint8(0x45),
  4212. 3: uint8(0xb2),
  4213. 4: uint8(0x76),
  4214. 5: uint8(0xd5),
  4215. 6: uint8(0x92),
  4216. 7: uint8(0xa1),
  4217. },
  4218. 52: {
  4219. 0: uint8(0xb2),
  4220. 1: uint8(0x74),
  4221. 2: uint8(0xcb),
  4222. 3: uint8(0x8e),
  4223. 4: uint8(0xbf),
  4224. 5: uint8(0x87),
  4225. 6: uint8(0x87),
  4226. 7: uint8(0x0a),
  4227. },
  4228. 53: {
  4229. 0: uint8(0x6f),
  4230. 1: uint8(0x9b),
  4231. 2: uint8(0xb4),
  4232. 3: uint8(0x20),
  4233. 4: uint8(0x3d),
  4234. 5: uint8(0xe7),
  4235. 6: uint8(0xb3),
  4236. 7: uint8(0x81),
  4237. },
  4238. 54: {
  4239. 0: uint8(0xea),
  4240. 1: uint8(0xec),
  4241. 2: uint8(0xb2),
  4242. 3: uint8(0xa3),
  4243. 4: uint8(0x0b),
  4244. 5: uint8(0x22),
  4245. 6: uint8(0xa8),
  4246. 7: uint8(0x7f),
  4247. },
  4248. 55: {
  4249. 0: uint8(0x99),
  4250. 1: uint8(0x24),
  4251. 2: uint8(0xa4),
  4252. 3: uint8(0x3c),
  4253. 4: uint8(0xc1),
  4254. 5: uint8(0x31),
  4255. 6: uint8(0x57),
  4256. 7: uint8(0x24),
  4257. },
  4258. 56: {
  4259. 0: uint8(0xbd),
  4260. 1: uint8(0x83),
  4261. 2: uint8(0x8d),
  4262. 3: uint8(0x3a),
  4263. 4: uint8(0xaf),
  4264. 5: uint8(0xbf),
  4265. 6: uint8(0x8d),
  4266. 7: uint8(0xb7),
  4267. },
  4268. 57: {
  4269. 0: uint8(0x0b),
  4270. 1: uint8(0x1a),
  4271. 2: uint8(0x2a),
  4272. 3: uint8(0x32),
  4273. 4: uint8(0x65),
  4274. 5: uint8(0xd5),
  4275. 6: uint8(0x1a),
  4276. 7: uint8(0xea),
  4277. },
  4278. 58: {
  4279. 0: uint8(0x13),
  4280. 1: uint8(0x50),
  4281. 2: uint8(0x79),
  4282. 3: uint8(0xa3),
  4283. 4: uint8(0x23),
  4284. 5: uint8(0x1c),
  4285. 6: uint8(0xe6),
  4286. 7: uint8(0x60),
  4287. },
  4288. 59: {
  4289. 0: uint8(0x93),
  4290. 1: uint8(0x2b),
  4291. 2: uint8(0x28),
  4292. 3: uint8(0x46),
  4293. 4: uint8(0xe4),
  4294. 5: uint8(0xd7),
  4295. 6: uint8(0x06),
  4296. 7: uint8(0x66),
  4297. },
  4298. 60: {
  4299. 0: uint8(0xe1),
  4300. 1: uint8(0x91),
  4301. 2: uint8(0x5f),
  4302. 3: uint8(0x5c),
  4303. 4: uint8(0xb1),
  4304. 5: uint8(0xec),
  4305. 6: uint8(0xa4),
  4306. 7: uint8(0x6c),
  4307. },
  4308. 61: {
  4309. 0: uint8(0xf3),
  4310. 1: uint8(0x25),
  4311. 2: uint8(0x96),
  4312. 3: uint8(0x5c),
  4313. 4: uint8(0xa1),
  4314. 5: uint8(0x6d),
  4315. 6: uint8(0x62),
  4316. 7: uint8(0x9f),
  4317. },
  4318. 62: {
  4319. 0: uint8(0x57),
  4320. 1: uint8(0x5f),
  4321. 2: uint8(0xf2),
  4322. 3: uint8(0x8e),
  4323. 4: uint8(0x60),
  4324. 5: uint8(0x38),
  4325. 6: uint8(0x1b),
  4326. 7: uint8(0xe5),
  4327. },
  4328. 63: {
  4329. 0: uint8(0x72),
  4330. 1: uint8(0x45),
  4331. 2: uint8(0x06),
  4332. 3: uint8(0xeb),
  4333. 4: uint8(0x4c),
  4334. 5: uint8(0x32),
  4335. 6: uint8(0x8a),
  4336. 7: uint8(0x95),
  4337. },
  4338. }
  4339. /* sip24_valid() */
  4340. type TICHAR = int8
  4341. type TPOSITION = struct {
  4342. FlineNumber TXML_Size
  4343. FcolumnNumber TXML_Size
  4344. }
  4345. type Tposition = TPOSITION
  4346. type TATTRIBUTE = struct {
  4347. Fname uintptr
  4348. FvaluePtr uintptr
  4349. FvalueEnd uintptr
  4350. Fnormalized int8
  4351. }
  4352. type Tencoding = struct {
  4353. Fscanners [4]TSCANNER
  4354. FliteralScanners [2]TSCANNER
  4355. FnameMatchesAscii uintptr
  4356. FnameLength uintptr
  4357. FskipS uintptr
  4358. FgetAtts uintptr
  4359. FcharRefNumber uintptr
  4360. FpredefinedEntityName uintptr
  4361. FupdatePosition uintptr
  4362. FisPublicId uintptr
  4363. Futf8Convert uintptr
  4364. Futf16Convert uintptr
  4365. FminBytesPerChar int32
  4366. FisUtf8 int8
  4367. FisUtf16 int8
  4368. }
  4369. type TENCODING = struct {
  4370. Fscanners [4]TSCANNER
  4371. FliteralScanners [2]TSCANNER
  4372. FnameMatchesAscii uintptr
  4373. FnameLength uintptr
  4374. FskipS uintptr
  4375. FgetAtts uintptr
  4376. FcharRefNumber uintptr
  4377. FpredefinedEntityName uintptr
  4378. FupdatePosition uintptr
  4379. FisPublicId uintptr
  4380. Futf8Convert uintptr
  4381. Futf16Convert uintptr
  4382. FminBytesPerChar int32
  4383. FisUtf8 int8
  4384. FisUtf16 int8
  4385. }
  4386. type TSCANNER = uintptr
  4387. type _XML_Convert_Result = int32
  4388. const _XML_CONVERT_COMPLETED = 0
  4389. const _XML_CONVERT_INPUT_INCOMPLETE = 1
  4390. const _XML_CONVERT_OUTPUT_EXHAUSTED = 2
  4391. type TINIT_ENCODING = struct {
  4392. FinitEnc TENCODING
  4393. FencPtr uintptr
  4394. }
  4395. type TCONVERTER = uintptr
  4396. const _XML_ROLE_ERROR = -1
  4397. const _XML_ROLE_NONE = 0
  4398. const _XML_ROLE_XML_DECL = 1
  4399. const _XML_ROLE_INSTANCE_START = 2
  4400. const _XML_ROLE_DOCTYPE_NONE = 3
  4401. const _XML_ROLE_DOCTYPE_NAME = 4
  4402. const _XML_ROLE_DOCTYPE_SYSTEM_ID = 5
  4403. const _XML_ROLE_DOCTYPE_PUBLIC_ID = 6
  4404. const _XML_ROLE_DOCTYPE_INTERNAL_SUBSET = 7
  4405. const _XML_ROLE_DOCTYPE_CLOSE = 8
  4406. const _XML_ROLE_GENERAL_ENTITY_NAME = 9
  4407. const _XML_ROLE_PARAM_ENTITY_NAME = 10
  4408. const _XML_ROLE_ENTITY_NONE = 11
  4409. const _XML_ROLE_ENTITY_VALUE = 12
  4410. const _XML_ROLE_ENTITY_SYSTEM_ID = 13
  4411. const _XML_ROLE_ENTITY_PUBLIC_ID = 14
  4412. const _XML_ROLE_ENTITY_COMPLETE = 15
  4413. const _XML_ROLE_ENTITY_NOTATION_NAME = 16
  4414. const _XML_ROLE_NOTATION_NONE = 17
  4415. const _XML_ROLE_NOTATION_NAME = 18
  4416. const _XML_ROLE_NOTATION_SYSTEM_ID = 19
  4417. const _XML_ROLE_NOTATION_NO_SYSTEM_ID = 20
  4418. const _XML_ROLE_NOTATION_PUBLIC_ID = 21
  4419. const _XML_ROLE_ATTRIBUTE_NAME = 22
  4420. const _XML_ROLE_ATTRIBUTE_TYPE_CDATA = 23
  4421. const _XML_ROLE_ATTRIBUTE_TYPE_ID = 24
  4422. const _XML_ROLE_ATTRIBUTE_TYPE_IDREF = 25
  4423. const _XML_ROLE_ATTRIBUTE_TYPE_IDREFS = 26
  4424. const _XML_ROLE_ATTRIBUTE_TYPE_ENTITY = 27
  4425. const _XML_ROLE_ATTRIBUTE_TYPE_ENTITIES = 28
  4426. const _XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN = 29
  4427. const _XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS = 30
  4428. const _XML_ROLE_ATTRIBUTE_ENUM_VALUE = 31
  4429. const _XML_ROLE_ATTRIBUTE_NOTATION_VALUE = 32
  4430. const _XML_ROLE_ATTLIST_NONE = 33
  4431. const _XML_ROLE_ATTLIST_ELEMENT_NAME = 34
  4432. const _XML_ROLE_IMPLIED_ATTRIBUTE_VALUE = 35
  4433. const _XML_ROLE_REQUIRED_ATTRIBUTE_VALUE = 36
  4434. const _XML_ROLE_DEFAULT_ATTRIBUTE_VALUE = 37
  4435. const _XML_ROLE_FIXED_ATTRIBUTE_VALUE = 38
  4436. const _XML_ROLE_ELEMENT_NONE = 39
  4437. const _XML_ROLE_ELEMENT_NAME = 40
  4438. const _XML_ROLE_CONTENT_ANY = 41
  4439. const _XML_ROLE_CONTENT_EMPTY = 42
  4440. const _XML_ROLE_CONTENT_PCDATA = 43
  4441. const _XML_ROLE_GROUP_OPEN = 44
  4442. const _XML_ROLE_GROUP_CLOSE = 45
  4443. const _XML_ROLE_GROUP_CLOSE_REP = 46
  4444. const _XML_ROLE_GROUP_CLOSE_OPT = 47
  4445. const _XML_ROLE_GROUP_CLOSE_PLUS = 48
  4446. const _XML_ROLE_GROUP_CHOICE = 49
  4447. const _XML_ROLE_GROUP_SEQUENCE = 50
  4448. const _XML_ROLE_CONTENT_ELEMENT = 51
  4449. const _XML_ROLE_CONTENT_ELEMENT_REP = 52
  4450. const _XML_ROLE_CONTENT_ELEMENT_OPT = 53
  4451. const _XML_ROLE_CONTENT_ELEMENT_PLUS = 54
  4452. const _XML_ROLE_PI = 55
  4453. const _XML_ROLE_COMMENT = 56
  4454. const _XML_ROLE_TEXT_DECL = 57
  4455. const _XML_ROLE_IGNORE_SECT = 58
  4456. const _XML_ROLE_INNER_PARAM_ENTITY_REF = 59
  4457. const _XML_ROLE_PARAM_ENTITY_REF = 60
  4458. type TPROLOG_STATE = struct {
  4459. Fhandler uintptr
  4460. Flevel uint32
  4461. Frole_none int32
  4462. FincludeLevel uint32
  4463. FdocumentEntity int32
  4464. FinEntityValue int32
  4465. }
  4466. type Tprolog_state = TPROLOG_STATE
  4467. type TKEY = uintptr
  4468. type TNAMED = struct {
  4469. Fname TKEY
  4470. }
  4471. type THASH_TABLE = struct {
  4472. Fv uintptr
  4473. Fpower uint8
  4474. Fsize Tsize_t
  4475. Fused Tsize_t
  4476. Fmem uintptr
  4477. }
  4478. /* For probing (after a collision) we need a step size relative prime
  4479. to the hash table size, which is a power of 2. We use double-hashing,
  4480. since we can calculate a second hash value cheaply by taking those bits
  4481. of the first hash value that were discarded (masked out) when the table
  4482. index was calculated: index = hash & mask, where mask = table->size - 1.
  4483. We limit the maximum step size to table->size / 4 (mask >> 2) and make
  4484. it odd, since odd numbers are always relative prime to a power of 2.
  4485. */
  4486. type THASH_TABLE_ITER = struct {
  4487. Fp uintptr
  4488. Fend uintptr
  4489. }
  4490. type TBINDING = struct {
  4491. Fprefix uintptr
  4492. FnextTagBinding uintptr
  4493. FprevPrefixBinding uintptr
  4494. FattId uintptr
  4495. Furi uintptr
  4496. FuriLen int32
  4497. FuriAlloc int32
  4498. }
  4499. type Tbinding = TBINDING
  4500. type TPREFIX = struct {
  4501. Fname uintptr
  4502. Fbinding uintptr
  4503. }
  4504. type Tprefix = TPREFIX
  4505. type TTAG_NAME = struct {
  4506. Fstr uintptr
  4507. FlocalPart uintptr
  4508. Fprefix uintptr
  4509. FstrLen int32
  4510. FuriLen int32
  4511. FprefixLen int32
  4512. }
  4513. // C documentation
  4514. //
  4515. // /* TAG represents an open element.
  4516. // The name of the element is stored in both the document and API
  4517. // encodings. The memory buffer 'buf' is a separately-allocated
  4518. // memory area which stores the name. During the XML_Parse()/
  4519. // XMLParseBuffer() when the element is open, the memory for the 'raw'
  4520. // version of the name (in the document encoding) is shared with the
  4521. // document buffer. If the element is open across calls to
  4522. // XML_Parse()/XML_ParseBuffer(), the buffer is re-allocated to
  4523. // contain the 'raw' name as well.
  4524. //
  4525. // A parser re-uses these structures, maintaining a list of allocated
  4526. // TAG objects in a free list.
  4527. // */
  4528. type TTAG = struct {
  4529. Fparent uintptr
  4530. FrawName uintptr
  4531. FrawNameLength int32
  4532. Fname TTAG_NAME
  4533. Fbuf uintptr
  4534. FbufEnd uintptr
  4535. Fbindings uintptr
  4536. }
  4537. // C documentation
  4538. //
  4539. // /* TAG represents an open element.
  4540. // The name of the element is stored in both the document and API
  4541. // encodings. The memory buffer 'buf' is a separately-allocated
  4542. // memory area which stores the name. During the XML_Parse()/
  4543. // XMLParseBuffer() when the element is open, the memory for the 'raw'
  4544. // version of the name (in the document encoding) is shared with the
  4545. // document buffer. If the element is open across calls to
  4546. // XML_Parse()/XML_ParseBuffer(), the buffer is re-allocated to
  4547. // contain the 'raw' name as well.
  4548. //
  4549. // A parser re-uses these structures, maintaining a list of allocated
  4550. // TAG objects in a free list.
  4551. // */
  4552. type Ttag = TTAG
  4553. type TENTITY = struct {
  4554. Fname uintptr
  4555. FtextPtr uintptr
  4556. FtextLen int32
  4557. Fprocessed int32
  4558. FsystemId uintptr
  4559. Fbase uintptr
  4560. FpublicId uintptr
  4561. Fnotation uintptr
  4562. Fopen TXML_Bool
  4563. Fis_param TXML_Bool
  4564. Fis_internal TXML_Bool
  4565. }
  4566. type TCONTENT_SCAFFOLD = struct {
  4567. Ftype1 _XML_Content_Type
  4568. Fquant _XML_Content_Quant
  4569. Fname uintptr
  4570. Ffirstchild int32
  4571. Flastchild int32
  4572. Fchildcnt int32
  4573. Fnextsib int32
  4574. }
  4575. type TBLOCK = struct {
  4576. Fnext uintptr
  4577. Fsize int32
  4578. Fs [1]TXML_Char
  4579. }
  4580. type Tblock = TBLOCK
  4581. type TSTRING_POOL = struct {
  4582. Fblocks uintptr
  4583. FfreeBlocks uintptr
  4584. Fend uintptr
  4585. Fptr uintptr
  4586. Fstart uintptr
  4587. Fmem uintptr
  4588. }
  4589. // C documentation
  4590. //
  4591. // /* The XML_Char before the name is used to determine whether
  4592. // an attribute has been specified. */
  4593. type TATTRIBUTE_ID = struct {
  4594. Fname uintptr
  4595. Fprefix uintptr
  4596. FmaybeTokenized TXML_Bool
  4597. Fxmlns TXML_Bool
  4598. }
  4599. // C documentation
  4600. //
  4601. // /* The XML_Char before the name is used to determine whether
  4602. // an attribute has been specified. */
  4603. type Tattribute_id = TATTRIBUTE_ID
  4604. type TDEFAULT_ATTRIBUTE = struct {
  4605. Fid uintptr
  4606. FisCdata TXML_Bool
  4607. Fvalue uintptr
  4608. }
  4609. type TNS_ATT = struct {
  4610. Fversion uint64
  4611. Fhash uint64
  4612. FuriName uintptr
  4613. }
  4614. type TELEMENT_TYPE = struct {
  4615. Fname uintptr
  4616. Fprefix uintptr
  4617. FidAtt uintptr
  4618. FnDefaultAtts int32
  4619. FallocDefaultAtts int32
  4620. FdefaultAtts uintptr
  4621. }
  4622. type TDTD = struct {
  4623. FgeneralEntities THASH_TABLE
  4624. FelementTypes THASH_TABLE
  4625. FattributeIds THASH_TABLE
  4626. Fprefixes THASH_TABLE
  4627. Fpool TSTRING_POOL
  4628. FentityValuePool TSTRING_POOL
  4629. FkeepProcessing TXML_Bool
  4630. FhasParamEntityRefs TXML_Bool
  4631. Fstandalone TXML_Bool
  4632. FparamEntityRead TXML_Bool
  4633. FparamEntities THASH_TABLE
  4634. FdefaultPrefix TPREFIX
  4635. Fin_eldecl TXML_Bool
  4636. Fscaffold uintptr
  4637. FcontentStringLen uint32
  4638. FscaffSize uint32
  4639. FscaffCount uint32
  4640. FscaffLevel int32
  4641. FscaffIndex uintptr
  4642. }
  4643. type TOPEN_INTERNAL_ENTITY = struct {
  4644. FinternalEventPtr uintptr
  4645. FinternalEventEndPtr uintptr
  4646. Fnext uintptr
  4647. Fentity uintptr
  4648. FstartTagLevel int32
  4649. FbetweenDecl TXML_Bool
  4650. }
  4651. type Topen_internal_entity = TOPEN_INTERNAL_ENTITY
  4652. type _XML_Account = int32
  4653. const _XML_ACCOUNT_DIRECT = 0
  4654. const /* bytes directly passed to the Expat parser */
  4655. _XML_ACCOUNT_ENTITY_EXPANSION = 1
  4656. const /* intermediate bytes produced during entity
  4657. expansion */
  4658. _XML_ACCOUNT_NONE = 2
  4659. type TXmlBigCount = uint64
  4660. type TACCOUNTING = struct {
  4661. FcountBytesDirect TXmlBigCount
  4662. FcountBytesIndirect TXmlBigCount
  4663. FdebugLevel int32
  4664. FmaximumAmplificationFactor float32
  4665. FactivationThresholdBytes uint64
  4666. }
  4667. type Taccounting = TACCOUNTING
  4668. type TENTITY_STATS = struct {
  4669. FcountEverOpened uint32
  4670. FcurrentDepth uint32
  4671. FmaximumDepthSeen uint32
  4672. FdebugLevel int32
  4673. }
  4674. type Tentity_stats = TENTITY_STATS
  4675. func XXML_ParserCreate(tls *libc.TLS, encodingName uintptr) (r TXML_Parser) {
  4676. return XXML_ParserCreate_MM(tls, encodingName, libc.UintptrFromInt32(0), libc.UintptrFromInt32(0))
  4677. }
  4678. func XXML_ParserCreateNS(tls *libc.TLS, encodingName uintptr, nsSep TXML_Char) (r TXML_Parser) {
  4679. bp := tls.Alloc(16)
  4680. defer tls.Free(16)
  4681. var _ /* tmp at bp+0 */ [2]TXML_Char
  4682. *(*[2]TXML_Char)(unsafe.Pointer(bp)) = [2]TXML_Char{
  4683. 0: nsSep,
  4684. }
  4685. return XXML_ParserCreate_MM(tls, encodingName, libc.UintptrFromInt32(0), bp)
  4686. }
  4687. // C documentation
  4688. //
  4689. // // "xml=http://www.w3.org/XML/1998/namespace"
  4690. var _implicitContext = [41]TXML_Char{
  4691. 0: int8(m_ASCII_x),
  4692. 1: int8(m_ASCII_m),
  4693. 2: int8(m_ASCII_l),
  4694. 3: int8(m_ASCII_EQUALS),
  4695. 4: int8(m_ASCII_h),
  4696. 5: int8(m_ASCII_t),
  4697. 6: int8(m_ASCII_t),
  4698. 7: int8(m_ASCII_p),
  4699. 8: int8(m_ASCII_COLON),
  4700. 9: int8(m_ASCII_SLASH),
  4701. 10: int8(m_ASCII_SLASH),
  4702. 11: int8(m_ASCII_w),
  4703. 12: int8(m_ASCII_w),
  4704. 13: int8(m_ASCII_w),
  4705. 14: int8(m_ASCII_PERIOD),
  4706. 15: int8(m_ASCII_w),
  4707. 16: int8(m_ASCII_3),
  4708. 17: int8(m_ASCII_PERIOD),
  4709. 18: int8(m_ASCII_o),
  4710. 19: int8(m_ASCII_r),
  4711. 20: int8(m_ASCII_g),
  4712. 21: int8(m_ASCII_SLASH),
  4713. 22: int8(m_ASCII_X),
  4714. 23: int8(m_ASCII_M),
  4715. 24: int8(m_ASCII_L),
  4716. 25: int8(m_ASCII_SLASH),
  4717. 26: int8(m_ASCII_1),
  4718. 27: int8(m_ASCII_9),
  4719. 28: int8(m_ASCII_9),
  4720. 29: int8(m_ASCII_8),
  4721. 30: int8(m_ASCII_SLASH),
  4722. 31: int8(m_ASCII_n),
  4723. 32: int8(m_ASCII_a),
  4724. 33: int8(m_ASCII_m),
  4725. 34: int8(m_ASCII_e),
  4726. 35: int8(m_ASCII_s),
  4727. 36: int8(m_ASCII_p),
  4728. 37: int8(m_ASCII_a),
  4729. 38: int8(m_ASCII_c),
  4730. 39: int8(m_ASCII_e),
  4731. }
  4732. /* To avoid warnings about unused functions: */
  4733. func _ENTROPY_DEBUG(tls *libc.TLS, label uintptr, entropy uint64) (r uint64) {
  4734. bp := tls.Alloc(48)
  4735. defer tls.Free(48)
  4736. if _getDebugLevel(tls, __ccgo_ts+17, uint64(0)) >= uint64(1) {
  4737. libc.Xfprintf(tls, libc.X__stderrp, __ccgo_ts+37, libc.VaList(bp+8, label, libc.Int32FromInt64(8)*libc.Int32FromInt32(2), entropy, libc.Uint64FromInt64(8)))
  4738. }
  4739. return entropy
  4740. }
  4741. func _generate_hash_secret_salt(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  4742. bp := tls.Alloc(16)
  4743. defer tls.Free(16)
  4744. var _ /* entropy at bp+0 */ uint64
  4745. _ = parser
  4746. /* "Failproof" high quality providers: */
  4747. libc.Xarc4random_buf(tls, bp, uint64(8))
  4748. return _ENTROPY_DEBUG(tls, __ccgo_ts+81, *(*uint64)(unsafe.Pointer(bp)))
  4749. }
  4750. func _get_hash_secret_salt(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  4751. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != libc.UintptrFromInt32(0) {
  4752. return _get_hash_secret_salt(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser)
  4753. }
  4754. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt
  4755. }
  4756. func _startParsing(tls *libc.TLS, parser TXML_Parser) (r TXML_Bool) {
  4757. /* hash functions must be initialized before setContext() is called */
  4758. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt == uint64(0) {
  4759. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = _generate_hash_secret_salt(tls, parser)
  4760. }
  4761. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  4762. /* implicit context only set for root parser, since child
  4763. parsers (i.e. external entity parsers) will inherit it
  4764. */
  4765. return _setContext(tls, parser, uintptr(unsafe.Pointer(&_implicitContext)))
  4766. }
  4767. return libc.Uint8FromInt32(1)
  4768. }
  4769. func XXML_ParserCreate_MM(tls *libc.TLS, encodingName uintptr, memsuite uintptr, nameSep uintptr) (r TXML_Parser) {
  4770. return _parserCreate(tls, encodingName, memsuite, nameSep, libc.UintptrFromInt32(0))
  4771. }
  4772. func _parserCreate(tls *libc.TLS, encodingName uintptr, memsuite uintptr, nameSep uintptr, dtd uintptr) (r TXML_Parser) {
  4773. var mtemp, mtemp1 uintptr
  4774. var parser TXML_Parser
  4775. _, _, _ = mtemp, mtemp1, parser
  4776. if memsuite != 0 {
  4777. parser = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Fmalloc_fcn})))(tls, uint64(976))
  4778. if parser != libc.UintptrFromInt32(0) {
  4779. mtemp = parser + 24
  4780. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp)).Fmalloc_fcn = (*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Fmalloc_fcn
  4781. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp)).Frealloc_fcn = (*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Frealloc_fcn
  4782. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp)).Ffree_fcn = (*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Ffree_fcn
  4783. }
  4784. } else {
  4785. parser = libc.Xmalloc(tls, uint64(976))
  4786. if parser != libc.UintptrFromInt32(0) {
  4787. mtemp1 = parser + 24
  4788. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp1)).Fmalloc_fcn = __ccgo_fp(libc.Xmalloc)
  4789. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp1)).Frealloc_fcn = __ccgo_fp(libc.Xrealloc)
  4790. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp1)).Ffree_fcn = __ccgo_fp(libc.Xfree)
  4791. }
  4792. }
  4793. if !(parser != 0) {
  4794. return parser
  4795. }
  4796. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer = libc.UintptrFromInt32(0)
  4797. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim = libc.UintptrFromInt32(0)
  4798. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = int32(m_INIT_ATTS_SIZE)
  4799. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize)*libc.Uint64FromInt64(32))
  4800. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts == libc.UintptrFromInt32(0) {
  4801. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  4802. return libc.UintptrFromInt32(0)
  4803. }
  4804. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32(m_INIT_DATA_BUF_SIZE)*libc.Uint64FromInt64(1))
  4805. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf == libc.UintptrFromInt32(0) {
  4806. (*(*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)
  4807. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  4808. return libc.UintptrFromInt32(0)
  4809. }
  4810. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf + uintptr(m_INIT_DATA_BUF_SIZE)
  4811. if dtd != 0 {
  4812. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd = dtd
  4813. } else {
  4814. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd = _dtdCreate(tls, parser+24)
  4815. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd == libc.UintptrFromInt32(0) {
  4816. (*(*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)
  4817. (*(*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)
  4818. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  4819. return libc.UintptrFromInt32(0)
  4820. }
  4821. }
  4822. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = libc.UintptrFromInt32(0)
  4823. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = libc.UintptrFromInt32(0)
  4824. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = libc.UintptrFromInt32(0)
  4825. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize = uint32(0)
  4826. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector = libc.UintptrFromInt32(0)
  4827. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler = libc.UintptrFromInt32(0)
  4828. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandlerData = libc.UintptrFromInt32(0)
  4829. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator = int8(m_ASCII_EXCL)
  4830. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns = libc.Uint8FromInt32(0)
  4831. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets = libc.Uint8FromInt32(0)
  4832. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts = libc.UintptrFromInt32(0)
  4833. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsVersion = uint64(0)
  4834. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = uint8(0)
  4835. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = libc.UintptrFromInt32(0)
  4836. _poolInit(tls, parser+784, parser+24)
  4837. _poolInit(tls, parser+832, parser+24)
  4838. _parserInit(tls, parser, encodingName)
  4839. if encodingName != 0 && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName != 0) {
  4840. if dtd != 0 {
  4841. // We need to stop the upcoming call to XML_ParserFree from happily
  4842. // destroying parser->m_dtd because the DTD is shared with the parent
  4843. // parser and the only guard that keeps XML_ParserFree from destroying
  4844. // parser->m_dtd is parser->m_isParamEntity but it will be set to
  4845. // XML_TRUE only later in XML_ExternalEntityParserCreate (or not at all).
  4846. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd = libc.UintptrFromInt32(0)
  4847. }
  4848. XXML_ParserFree(tls, parser)
  4849. return libc.UintptrFromInt32(0)
  4850. }
  4851. if nameSep != 0 {
  4852. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns = libc.Uint8FromInt32(1)
  4853. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding = XXmlGetUtf8InternalEncodingNS(tls)
  4854. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator = *(*TXML_Char)(unsafe.Pointer(nameSep))
  4855. } else {
  4856. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding = XXmlGetUtf8InternalEncoding(tls)
  4857. }
  4858. return parser
  4859. }
  4860. func _parserInit(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) {
  4861. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologInitProcessor)
  4862. XXmlPrologStateInit(tls, parser+496)
  4863. if encodingName != libc.UintptrFromInt32(0) {
  4864. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = _copyString(tls, encodingName, parser+24)
  4865. }
  4866. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase = libc.UintptrFromInt32(0)
  4867. XXmlInitEncoding(tls, parser+296, parser+288, uintptr(0))
  4868. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = libc.UintptrFromInt32(0)
  4869. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = libc.UintptrFromInt32(0)
  4870. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = libc.UintptrFromInt32(0)
  4871. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = libc.UintptrFromInt32(0)
  4872. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler = libc.UintptrFromInt32(0)
  4873. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler = libc.UintptrFromInt32(0)
  4874. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler = libc.UintptrFromInt32(0)
  4875. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = libc.UintptrFromInt32(0)
  4876. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = libc.UintptrFromInt32(0)
  4877. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = libc.UintptrFromInt32(0)
  4878. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler = libc.UintptrFromInt32(0)
  4879. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler = libc.UintptrFromInt32(0)
  4880. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler = libc.UintptrFromInt32(0)
  4881. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler = libc.UintptrFromInt32(0)
  4882. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = libc.UintptrFromInt32(0)
  4883. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = libc.UintptrFromInt32(0)
  4884. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler = libc.UintptrFromInt32(0)
  4885. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler = libc.UintptrFromInt32(0)
  4886. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = parser
  4887. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler = libc.UintptrFromInt32(0)
  4888. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler = libc.UintptrFromInt32(0)
  4889. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler = libc.UintptrFromInt32(0)
  4890. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler = libc.UintptrFromInt32(0)
  4891. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler = libc.UintptrFromInt32(0)
  4892. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer
  4893. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer
  4894. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndByteIndex = 0
  4895. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr = libc.UintptrFromInt32(0)
  4896. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = libc.UintptrFromInt32(0)
  4897. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId = libc.UintptrFromInt32(0)
  4898. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  4899. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName = libc.UintptrFromInt32(0)
  4900. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = libc.UintptrFromInt32(0)
  4901. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid = libc.UintptrFromInt32(0)
  4902. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = libc.UintptrFromInt32(0)
  4903. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName = libc.UintptrFromInt32(0)
  4904. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId = libc.UintptrFromInt32(0)
  4905. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata = libc.Uint8FromInt32(0)
  4906. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId = libc.Uint8FromInt32(0)
  4907. libc.X__builtin___memset_chk(tls, parser+768, 0, uint64(16), ^t__predefined_size_t(0))
  4908. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NONE)
  4909. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = libc.UintptrFromInt32(0)
  4910. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = libc.UintptrFromInt32(0)
  4911. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = libc.UintptrFromInt32(0)
  4912. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = libc.UintptrFromInt32(0)
  4913. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = libc.Uint8FromInt32(1)
  4914. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel = 0
  4915. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack = libc.UintptrFromInt32(0)
  4916. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_inheritedBindings = libc.UintptrFromInt32(0)
  4917. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nSpecifiedAtts = 0
  4918. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem = libc.UintptrFromInt32(0)
  4919. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease = libc.UintptrFromInt32(0)
  4920. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData = libc.UintptrFromInt32(0)
  4921. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser = libc.UintptrFromInt32(0)
  4922. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_INITIALIZED)
  4923. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity = libc.Uint8FromInt32(0)
  4924. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  4925. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = int32(_XML_PARAM_ENTITY_PARSING_NEVER)
  4926. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = uint64(0)
  4927. libc.X__builtin___memset_chk(tls, parser+928, 0, uint64(32), ^t__predefined_size_t(0))
  4928. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FdebugLevel = libc.Int32FromUint64(_getDebugLevel(tls, __ccgo_ts+96, 0))
  4929. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FmaximumAmplificationFactor = libc.Float32FromFloat32(100)
  4930. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FactivationThresholdBytes = uint64(m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT)
  4931. libc.X__builtin___memset_chk(tls, parser+960, 0, uint64(16), ^t__predefined_size_t(0))
  4932. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entity_stats.FdebugLevel = libc.Int32FromUint64(_getDebugLevel(tls, __ccgo_ts+119, 0))
  4933. }
  4934. // C documentation
  4935. //
  4936. // /* moves list of bindings to m_freeBindingList */
  4937. func _moveToFreeBindingList(tls *libc.TLS, parser TXML_Parser, bindings uintptr) {
  4938. var b uintptr
  4939. _ = b
  4940. for bindings != 0 {
  4941. b = bindings
  4942. bindings = (*TBINDING)(unsafe.Pointer(bindings)).FnextTagBinding
  4943. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  4944. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = b
  4945. }
  4946. }
  4947. func XXML_ParserReset(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) (r TXML_Bool) {
  4948. var openEntity, openEntityList, tStk, tag uintptr
  4949. _, _, _, _ = openEntity, openEntityList, tStk, tag
  4950. if parser == libc.UintptrFromInt32(0) {
  4951. return libc.Uint8FromInt32(0)
  4952. }
  4953. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 {
  4954. return libc.Uint8FromInt32(0)
  4955. }
  4956. /* move m_tagStack to m_freeTagList */
  4957. tStk = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  4958. for tStk != 0 {
  4959. tag = tStk
  4960. tStk = (*TTAG)(unsafe.Pointer(tStk)).Fparent
  4961. (*TTAG)(unsafe.Pointer(tag)).Fparent = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  4962. _moveToFreeBindingList(tls, parser, (*TTAG)(unsafe.Pointer(tag)).Fbindings)
  4963. (*TTAG)(unsafe.Pointer(tag)).Fbindings = libc.UintptrFromInt32(0)
  4964. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = tag
  4965. }
  4966. /* move m_openInternalEntities to m_freeInternalEntities */
  4967. openEntityList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  4968. for openEntityList != 0 {
  4969. openEntity = openEntityList
  4970. openEntityList = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  4971. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  4972. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = openEntity
  4973. }
  4974. _moveToFreeBindingList(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_inheritedBindings)
  4975. (*(*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)
  4976. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease != 0 {
  4977. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData)
  4978. }
  4979. _poolClear(tls, parser+784)
  4980. _poolClear(tls, parser+832)
  4981. (*(*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)
  4982. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = libc.UintptrFromInt32(0)
  4983. _parserInit(tls, parser, encodingName)
  4984. _dtdReset(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd, parser+24)
  4985. return libc.Uint8FromInt32(1)
  4986. }
  4987. func XXML_SetEncoding(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) (r _XML_Status) {
  4988. if parser == libc.UintptrFromInt32(0) {
  4989. return int32(_XML_STATUS_ERROR)
  4990. }
  4991. /* Block after XML_Parse()/XML_ParseBuffer() has been called.
  4992. XXX There's no way for the caller to determine which of the
  4993. XXX possible error cases caused the XML_STATUS_ERROR return.
  4994. */
  4995. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  4996. return int32(_XML_STATUS_ERROR)
  4997. }
  4998. /* Get rid of any previous encoding name */
  4999. (*(*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)
  5000. if encodingName == libc.UintptrFromInt32(0) {
  5001. /* No new encoding name */
  5002. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = libc.UintptrFromInt32(0)
  5003. } else {
  5004. /* Copy the new encoding name into allocated memory */
  5005. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = _copyString(tls, encodingName, parser+24)
  5006. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName != 0) {
  5007. return int32(_XML_STATUS_ERROR)
  5008. }
  5009. }
  5010. return int32(_XML_STATUS_OK)
  5011. }
  5012. func XXML_ExternalEntityParserCreate(tls *libc.TLS, oldParser TXML_Parser, context uintptr, encodingName uintptr) (r TXML_Parser) {
  5013. bp := tls.Alloc(16)
  5014. defer tls.Free(16)
  5015. var newDtd, oldDeclElementType, oldDtd, oldHandlerArg, oldUserData uintptr
  5016. var oldAttlistDeclHandler TXML_AttlistDeclHandler
  5017. var oldCharacterDataHandler TXML_CharacterDataHandler
  5018. var oldCommentHandler TXML_CommentHandler
  5019. var oldDefaultExpandInternalEntities, oldns_triplets TXML_Bool
  5020. var oldDefaultHandler TXML_DefaultHandler
  5021. var oldElementDeclHandler TXML_ElementDeclHandler
  5022. var oldEndCdataSectionHandler TXML_EndCdataSectionHandler
  5023. var oldEndElementHandler TXML_EndElementHandler
  5024. var oldEndNamespaceDeclHandler TXML_EndNamespaceDeclHandler
  5025. var oldEntityDeclHandler TXML_EntityDeclHandler
  5026. var oldExternalEntityRefHandler TXML_ExternalEntityRefHandler
  5027. var oldExternalEntityRefHandlerArg, parser TXML_Parser
  5028. var oldInEntityValue int32
  5029. var oldNotStandaloneHandler TXML_NotStandaloneHandler
  5030. var oldNotationDeclHandler TXML_NotationDeclHandler
  5031. var oldParamEntityParsing _XML_ParamEntityParsing
  5032. var oldProcessingInstructionHandler TXML_ProcessingInstructionHandler
  5033. var oldSkippedEntityHandler TXML_SkippedEntityHandler
  5034. var oldStartCdataSectionHandler TXML_StartCdataSectionHandler
  5035. var oldStartElementHandler TXML_StartElementHandler
  5036. var oldStartNamespaceDeclHandler TXML_StartNamespaceDeclHandler
  5037. var oldUnknownEncodingHandler TXML_UnknownEncodingHandler
  5038. var oldUnparsedEntityDeclHandler TXML_UnparsedEntityDeclHandler
  5039. var oldXmlDeclHandler TXML_XmlDeclHandler
  5040. var oldhash_secret_salt uint64
  5041. var _ /* tmp at bp+0 */ [2]TXML_Char
  5042. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  5043. parser = oldParser
  5044. newDtd = libc.UintptrFromInt32(0)
  5045. /* Validate the oldParser parameter before we pull everything out of it */
  5046. if oldParser == libc.UintptrFromInt32(0) {
  5047. return libc.UintptrFromInt32(0)
  5048. }
  5049. /* Stash the original parser contents on the stack */
  5050. oldDtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  5051. oldStartElementHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler
  5052. oldEndElementHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler
  5053. oldCharacterDataHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler
  5054. oldProcessingInstructionHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler
  5055. oldCommentHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler
  5056. oldStartCdataSectionHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler
  5057. oldEndCdataSectionHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler
  5058. oldDefaultHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler
  5059. oldUnparsedEntityDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler
  5060. oldNotationDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler
  5061. oldStartNamespaceDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler
  5062. oldEndNamespaceDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler
  5063. oldNotStandaloneHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler
  5064. oldExternalEntityRefHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler
  5065. oldSkippedEntityHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler
  5066. oldUnknownEncodingHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler
  5067. oldElementDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler
  5068. oldAttlistDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler
  5069. oldEntityDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler
  5070. oldXmlDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler
  5071. oldDeclElementType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType
  5072. oldUserData = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData
  5073. oldHandlerArg = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg
  5074. oldDefaultExpandInternalEntities = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities
  5075. oldExternalEntityRefHandlerArg = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg
  5076. oldParamEntityParsing = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing
  5077. oldInEntityValue = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue
  5078. oldns_triplets = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets
  5079. /* Note that the new parser shares the same hash secret as the old
  5080. parser, so that dtdCopy and copyEntityTable can lookup values
  5081. from hash tables associated with either parser without us having
  5082. to worry which hash secrets each table has.
  5083. */
  5084. oldhash_secret_salt = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt
  5085. if !(context != 0) {
  5086. newDtd = oldDtd
  5087. }
  5088. /* Note that the magical uses of the pre-processor to make field
  5089. access look more like C++ require that `parser' be overwritten
  5090. here. This makes this function more painful to follow than it
  5091. would be otherwise.
  5092. */
  5093. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  5094. *(*[2]TXML_Char)(unsafe.Pointer(bp)) = [2]TXML_Char{
  5095. 0: (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator,
  5096. }
  5097. parser = _parserCreate(tls, encodingName, parser+24, bp, newDtd)
  5098. } else {
  5099. parser = _parserCreate(tls, encodingName, parser+24, libc.UintptrFromInt32(0), newDtd)
  5100. }
  5101. if !(parser != 0) {
  5102. return libc.UintptrFromInt32(0)
  5103. }
  5104. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = oldStartElementHandler
  5105. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = oldEndElementHandler
  5106. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler = oldCharacterDataHandler
  5107. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler = oldProcessingInstructionHandler
  5108. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler = oldCommentHandler
  5109. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = oldStartCdataSectionHandler
  5110. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = oldEndCdataSectionHandler
  5111. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = oldDefaultHandler
  5112. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler = oldUnparsedEntityDeclHandler
  5113. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler = oldNotationDeclHandler
  5114. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = oldStartNamespaceDeclHandler
  5115. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = oldEndNamespaceDeclHandler
  5116. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler = oldNotStandaloneHandler
  5117. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler = oldExternalEntityRefHandler
  5118. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler = oldSkippedEntityHandler
  5119. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler = oldUnknownEncodingHandler
  5120. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler = oldElementDeclHandler
  5121. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler = oldAttlistDeclHandler
  5122. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler = oldEntityDeclHandler
  5123. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler = oldXmlDeclHandler
  5124. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = oldDeclElementType
  5125. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = oldUserData
  5126. if oldUserData == oldHandlerArg {
  5127. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData
  5128. } else {
  5129. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = parser
  5130. }
  5131. if oldExternalEntityRefHandlerArg != oldParser {
  5132. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg
  5133. }
  5134. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = oldDefaultExpandInternalEntities
  5135. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets = oldns_triplets
  5136. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = oldhash_secret_salt
  5137. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser = oldParser
  5138. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = oldParamEntityParsing
  5139. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue = oldInEntityValue
  5140. if context != 0 {
  5141. if !(_dtdCopy(tls, oldParser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd, oldDtd, parser+24) != 0) || !(_setContext(tls, parser, context) != 0) {
  5142. XXML_ParserFree(tls, parser)
  5143. return libc.UintptrFromInt32(0)
  5144. }
  5145. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityInitProcessor)
  5146. } else {
  5147. /* The DTD instance referenced by parser->m_dtd is shared between the
  5148. document's root parser and external PE parsers, therefore one does not
  5149. need to call setContext. In addition, one also *must* not call
  5150. setContext, because this would overwrite existing prefix->binding
  5151. pointers in parser->m_dtd with ones that get destroyed with the external
  5152. PE parser. This would leave those prefixes with dangling pointers.
  5153. */
  5154. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity = libc.Uint8FromInt32(1)
  5155. XXmlPrologStateInitExternalEntity(tls, parser+496)
  5156. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalParEntInitProcessor)
  5157. }
  5158. return parser
  5159. }
  5160. func _destroyBindings(tls *libc.TLS, bindings uintptr, parser TXML_Parser) {
  5161. var b uintptr
  5162. _ = b
  5163. for {
  5164. b = bindings
  5165. if !(b != 0) {
  5166. break
  5167. }
  5168. bindings = (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding
  5169. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TBINDING)(unsafe.Pointer(b)).Furi)
  5170. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, b)
  5171. goto _1
  5172. _1:
  5173. }
  5174. }
  5175. func XXML_ParserFree(tls *libc.TLS, parser TXML_Parser) {
  5176. var entityList, openEntity, p, tagList uintptr
  5177. _, _, _, _ = entityList, openEntity, p, tagList
  5178. if parser == libc.UintptrFromInt32(0) {
  5179. return
  5180. }
  5181. /* free m_tagStack and m_freeTagList */
  5182. tagList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  5183. for {
  5184. if tagList == libc.UintptrFromInt32(0) {
  5185. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList == libc.UintptrFromInt32(0) {
  5186. break
  5187. }
  5188. tagList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  5189. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = libc.UintptrFromInt32(0)
  5190. }
  5191. p = tagList
  5192. tagList = (*TTAG)(unsafe.Pointer(tagList)).Fparent
  5193. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TTAG)(unsafe.Pointer(p)).Fbuf)
  5194. _destroyBindings(tls, (*TTAG)(unsafe.Pointer(p)).Fbindings, parser)
  5195. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, p)
  5196. goto _1
  5197. _1:
  5198. }
  5199. /* free m_openInternalEntities and m_freeInternalEntities */
  5200. entityList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  5201. for {
  5202. if entityList == libc.UintptrFromInt32(0) {
  5203. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities == libc.UintptrFromInt32(0) {
  5204. break
  5205. }
  5206. entityList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  5207. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = libc.UintptrFromInt32(0)
  5208. }
  5209. openEntity = entityList
  5210. entityList = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(entityList)).Fnext
  5211. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, openEntity)
  5212. goto _2
  5213. _2:
  5214. }
  5215. _destroyBindings(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList, parser)
  5216. _destroyBindings(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_inheritedBindings, parser)
  5217. _poolDestroy(tls, parser+784)
  5218. _poolDestroy(tls, parser+832)
  5219. (*(*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)
  5220. /* external parameter entity parsers share the DTD structure
  5221. parser->m_dtd with the root parser, so we must not destroy it
  5222. */
  5223. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd != 0 {
  5224. _dtdDestroy(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd, libc.BoolUint8(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0)), parser+24)
  5225. }
  5226. (*(*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)
  5227. (*(*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)
  5228. (*(*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)
  5229. (*(*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)
  5230. (*(*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)
  5231. (*(*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)
  5232. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease != 0 {
  5233. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData)
  5234. }
  5235. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  5236. }
  5237. func XXML_UseParserAsHandlerArg(tls *libc.TLS, parser TXML_Parser) {
  5238. if parser != libc.UintptrFromInt32(0) {
  5239. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = parser
  5240. }
  5241. }
  5242. func XXML_UseForeignDTD(tls *libc.TLS, parser TXML_Parser, useDTD TXML_Bool) (r _XML_Error) {
  5243. if parser == libc.UintptrFromInt32(0) {
  5244. return int32(_XML_ERROR_INVALID_ARGUMENT)
  5245. }
  5246. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  5247. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  5248. return int32(_XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING)
  5249. }
  5250. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = useDTD
  5251. return int32(_XML_ERROR_NONE)
  5252. }
  5253. func XXML_SetReturnNSTriplet(tls *libc.TLS, parser TXML_Parser, do_nst int32) {
  5254. var v1 int32
  5255. _ = v1
  5256. if parser == libc.UintptrFromInt32(0) {
  5257. return
  5258. }
  5259. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  5260. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  5261. return
  5262. }
  5263. if do_nst != 0 {
  5264. v1 = libc.Int32FromUint8(libc.Uint8FromInt32(1))
  5265. } else {
  5266. v1 = libc.Int32FromUint8(libc.Uint8FromInt32(0))
  5267. }
  5268. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets = libc.Uint8FromInt32(v1)
  5269. }
  5270. func XXML_SetUserData(tls *libc.TLS, parser TXML_Parser, p uintptr) {
  5271. var v1 uintptr
  5272. _ = v1
  5273. if parser == libc.UintptrFromInt32(0) {
  5274. return
  5275. }
  5276. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData {
  5277. v1 = p
  5278. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = v1
  5279. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = v1
  5280. } else {
  5281. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = p
  5282. }
  5283. }
  5284. func XXML_SetBase(tls *libc.TLS, parser TXML_Parser, p uintptr) (r _XML_Status) {
  5285. if parser == libc.UintptrFromInt32(0) {
  5286. return int32(_XML_STATUS_ERROR)
  5287. }
  5288. if p != 0 {
  5289. p = _poolCopyString(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd+160, p)
  5290. if !(p != 0) {
  5291. return int32(_XML_STATUS_ERROR)
  5292. }
  5293. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase = p
  5294. } else {
  5295. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase = libc.UintptrFromInt32(0)
  5296. }
  5297. return int32(_XML_STATUS_OK)
  5298. }
  5299. func XXML_GetBase(tls *libc.TLS, parser TXML_Parser) (r uintptr) {
  5300. if parser == libc.UintptrFromInt32(0) {
  5301. return libc.UintptrFromInt32(0)
  5302. }
  5303. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  5304. }
  5305. func XXML_GetSpecifiedAttributeCount(tls *libc.TLS, parser TXML_Parser) (r int32) {
  5306. if parser == libc.UintptrFromInt32(0) {
  5307. return -int32(1)
  5308. }
  5309. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nSpecifiedAtts
  5310. }
  5311. func XXML_GetIdAttributeIndex(tls *libc.TLS, parser TXML_Parser) (r int32) {
  5312. if parser == libc.UintptrFromInt32(0) {
  5313. return -int32(1)
  5314. }
  5315. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_idAttIndex
  5316. }
  5317. func XXML_SetElementHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartElementHandler, end TXML_EndElementHandler) {
  5318. if parser == libc.UintptrFromInt32(0) {
  5319. return
  5320. }
  5321. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = start
  5322. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = end
  5323. }
  5324. func XXML_SetStartElementHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartElementHandler) {
  5325. if parser != libc.UintptrFromInt32(0) {
  5326. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = start
  5327. }
  5328. }
  5329. func XXML_SetEndElementHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndElementHandler) {
  5330. if parser != libc.UintptrFromInt32(0) {
  5331. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = end
  5332. }
  5333. }
  5334. func XXML_SetCharacterDataHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_CharacterDataHandler) {
  5335. if parser != libc.UintptrFromInt32(0) {
  5336. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler = handler
  5337. }
  5338. }
  5339. func XXML_SetProcessingInstructionHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_ProcessingInstructionHandler) {
  5340. if parser != libc.UintptrFromInt32(0) {
  5341. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler = handler
  5342. }
  5343. }
  5344. func XXML_SetCommentHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_CommentHandler) {
  5345. if parser != libc.UintptrFromInt32(0) {
  5346. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler = handler
  5347. }
  5348. }
  5349. func XXML_SetCdataSectionHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartCdataSectionHandler, end TXML_EndCdataSectionHandler) {
  5350. if parser == libc.UintptrFromInt32(0) {
  5351. return
  5352. }
  5353. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = start
  5354. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = end
  5355. }
  5356. func XXML_SetStartCdataSectionHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartCdataSectionHandler) {
  5357. if parser != libc.UintptrFromInt32(0) {
  5358. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = start
  5359. }
  5360. }
  5361. func XXML_SetEndCdataSectionHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndCdataSectionHandler) {
  5362. if parser != libc.UintptrFromInt32(0) {
  5363. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = end
  5364. }
  5365. }
  5366. func XXML_SetDefaultHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_DefaultHandler) {
  5367. if parser == libc.UintptrFromInt32(0) {
  5368. return
  5369. }
  5370. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = handler
  5371. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = libc.Uint8FromInt32(0)
  5372. }
  5373. func XXML_SetDefaultHandlerExpand(tls *libc.TLS, parser TXML_Parser, handler TXML_DefaultHandler) {
  5374. if parser == libc.UintptrFromInt32(0) {
  5375. return
  5376. }
  5377. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = handler
  5378. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = libc.Uint8FromInt32(1)
  5379. }
  5380. func XXML_SetDoctypeDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartDoctypeDeclHandler, end TXML_EndDoctypeDeclHandler) {
  5381. if parser == libc.UintptrFromInt32(0) {
  5382. return
  5383. }
  5384. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler = start
  5385. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler = end
  5386. }
  5387. func XXML_SetStartDoctypeDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartDoctypeDeclHandler) {
  5388. if parser != libc.UintptrFromInt32(0) {
  5389. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler = start
  5390. }
  5391. }
  5392. func XXML_SetEndDoctypeDeclHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndDoctypeDeclHandler) {
  5393. if parser != libc.UintptrFromInt32(0) {
  5394. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler = end
  5395. }
  5396. }
  5397. func XXML_SetUnparsedEntityDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_UnparsedEntityDeclHandler) {
  5398. if parser != libc.UintptrFromInt32(0) {
  5399. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler = handler
  5400. }
  5401. }
  5402. func XXML_SetNotationDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_NotationDeclHandler) {
  5403. if parser != libc.UintptrFromInt32(0) {
  5404. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler = handler
  5405. }
  5406. }
  5407. func XXML_SetNamespaceDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartNamespaceDeclHandler, end TXML_EndNamespaceDeclHandler) {
  5408. if parser == libc.UintptrFromInt32(0) {
  5409. return
  5410. }
  5411. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = start
  5412. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = end
  5413. }
  5414. func XXML_SetStartNamespaceDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartNamespaceDeclHandler) {
  5415. if parser != libc.UintptrFromInt32(0) {
  5416. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = start
  5417. }
  5418. }
  5419. func XXML_SetEndNamespaceDeclHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndNamespaceDeclHandler) {
  5420. if parser != libc.UintptrFromInt32(0) {
  5421. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = end
  5422. }
  5423. }
  5424. func XXML_SetNotStandaloneHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_NotStandaloneHandler) {
  5425. if parser != libc.UintptrFromInt32(0) {
  5426. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler = handler
  5427. }
  5428. }
  5429. func XXML_SetExternalEntityRefHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_ExternalEntityRefHandler) {
  5430. if parser != libc.UintptrFromInt32(0) {
  5431. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler = handler
  5432. }
  5433. }
  5434. func XXML_SetExternalEntityRefHandlerArg(tls *libc.TLS, parser TXML_Parser, arg uintptr) {
  5435. if parser == libc.UintptrFromInt32(0) {
  5436. return
  5437. }
  5438. if arg != 0 {
  5439. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = arg
  5440. } else {
  5441. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = parser
  5442. }
  5443. }
  5444. func XXML_SetSkippedEntityHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_SkippedEntityHandler) {
  5445. if parser != libc.UintptrFromInt32(0) {
  5446. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler = handler
  5447. }
  5448. }
  5449. func XXML_SetUnknownEncodingHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_UnknownEncodingHandler, data uintptr) {
  5450. if parser == libc.UintptrFromInt32(0) {
  5451. return
  5452. }
  5453. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler = handler
  5454. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandlerData = data
  5455. }
  5456. func XXML_SetElementDeclHandler(tls *libc.TLS, parser TXML_Parser, eldecl TXML_ElementDeclHandler) {
  5457. if parser != libc.UintptrFromInt32(0) {
  5458. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler = eldecl
  5459. }
  5460. }
  5461. func XXML_SetAttlistDeclHandler(tls *libc.TLS, parser TXML_Parser, attdecl TXML_AttlistDeclHandler) {
  5462. if parser != libc.UintptrFromInt32(0) {
  5463. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler = attdecl
  5464. }
  5465. }
  5466. func XXML_SetEntityDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_EntityDeclHandler) {
  5467. if parser != libc.UintptrFromInt32(0) {
  5468. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler = handler
  5469. }
  5470. }
  5471. func XXML_SetXmlDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_XmlDeclHandler) {
  5472. if parser != libc.UintptrFromInt32(0) {
  5473. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler = handler
  5474. }
  5475. }
  5476. func XXML_SetParamEntityParsing(tls *libc.TLS, parser TXML_Parser, peParsing _XML_ParamEntityParsing) (r int32) {
  5477. if parser == libc.UintptrFromInt32(0) {
  5478. return 0
  5479. }
  5480. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  5481. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  5482. return 0
  5483. }
  5484. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = peParsing
  5485. return int32(1)
  5486. }
  5487. func XXML_SetHashSalt(tls *libc.TLS, parser TXML_Parser, hash_salt uint64) (r int32) {
  5488. if parser == libc.UintptrFromInt32(0) {
  5489. return 0
  5490. }
  5491. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 {
  5492. return XXML_SetHashSalt(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser, hash_salt)
  5493. }
  5494. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  5495. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  5496. return 0
  5497. }
  5498. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = hash_salt
  5499. return int32(1)
  5500. }
  5501. func XXML_Parse(tls *libc.TLS, parser TXML_Parser, s uintptr, len1 int32, isFinal int32) (r _XML_Status) {
  5502. var buff uintptr
  5503. _ = buff
  5504. if parser == libc.UintptrFromInt32(0) || len1 < 0 || s == libc.UintptrFromInt32(0) && len1 != 0 {
  5505. if parser != libc.UintptrFromInt32(0) {
  5506. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_INVALID_ARGUMENT)
  5507. }
  5508. return int32(_XML_STATUS_ERROR)
  5509. }
  5510. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  5511. case int32(_XML_SUSPENDED):
  5512. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  5513. return int32(_XML_STATUS_ERROR)
  5514. case int32(_XML_FINISHED):
  5515. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  5516. return int32(_XML_STATUS_ERROR)
  5517. case int32(_XML_INITIALIZED):
  5518. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser == libc.UintptrFromInt32(0) && !(_startParsing(tls, parser) != 0) {
  5519. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  5520. return int32(_XML_STATUS_ERROR)
  5521. }
  5522. /* fall through */
  5523. fallthrough
  5524. default:
  5525. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_PARSING)
  5526. }
  5527. if len1 == 0 {
  5528. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer = libc.Uint8FromInt32(isFinal)
  5529. if !(isFinal != 0) {
  5530. return int32(_XML_STATUS_OK)
  5531. }
  5532. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  5533. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd
  5534. /* If data are left over from last buffer, and we now know that these
  5535. data are the final chunk of input, then we have to check them again
  5536. to detect errors based on that fact.
  5537. */
  5538. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = (*(*func(*libc.TLS, TXML_Parser, uintptr, uintptr, uintptr) _XML_Error)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor})))(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr, parser+48)
  5539. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode == int32(_XML_ERROR_NONE) {
  5540. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  5541. case int32(_XML_SUSPENDED):
  5542. /* It is hard to be certain, but it seems that this case
  5543. * cannot occur. This code is cleaning up a previous parse
  5544. * with no new data (since len == 0). Changing the parsing
  5545. * state requires getting to execute a handler function, and
  5546. * there doesn't seem to be an opportunity for that while in
  5547. * this circumstance.
  5548. *
  5549. * Given the uncertainty, we retain the code but exclude it
  5550. * from coverage tests.
  5551. *
  5552. * LCOV_EXCL_START
  5553. */
  5554. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FupdatePosition})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr, parser+768)
  5555. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  5556. return int32(_XML_STATUS_SUSPENDED)
  5557. /* LCOV_EXCL_STOP */
  5558. fallthrough
  5559. case int32(_XML_INITIALIZED):
  5560. fallthrough
  5561. case int32(_XML_PARSING):
  5562. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  5563. /* fall through */
  5564. fallthrough
  5565. default:
  5566. return int32(_XML_STATUS_OK)
  5567. }
  5568. }
  5569. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  5570. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_errorProcessor)
  5571. return int32(_XML_STATUS_ERROR)
  5572. } else {
  5573. buff = XXML_GetBuffer(tls, parser, len1)
  5574. if buff == libc.UintptrFromInt32(0) {
  5575. return int32(_XML_STATUS_ERROR)
  5576. } else {
  5577. libc.X__builtin___memcpy_chk(tls, buff, s, libc.Uint64FromInt32(len1), ^t__predefined_size_t(0))
  5578. return XXML_ParseBuffer(tls, parser, len1, isFinal)
  5579. }
  5580. }
  5581. return r
  5582. }
  5583. func XXML_ParseBuffer(tls *libc.TLS, parser TXML_Parser, len1 int32, isFinal int32) (r _XML_Status) {
  5584. var result _XML_Status
  5585. var start uintptr
  5586. _, _ = result, start
  5587. result = int32(_XML_STATUS_OK)
  5588. if parser == libc.UintptrFromInt32(0) {
  5589. return int32(_XML_STATUS_ERROR)
  5590. }
  5591. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  5592. case int32(_XML_SUSPENDED):
  5593. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  5594. return int32(_XML_STATUS_ERROR)
  5595. case int32(_XML_FINISHED):
  5596. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  5597. return int32(_XML_STATUS_ERROR)
  5598. case int32(_XML_INITIALIZED):
  5599. /* Has someone called XML_GetBuffer successfully before? */
  5600. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0) {
  5601. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_BUFFER)
  5602. return int32(_XML_STATUS_ERROR)
  5603. }
  5604. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser == libc.UintptrFromInt32(0) && !(_startParsing(tls, parser) != 0) {
  5605. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  5606. return int32(_XML_STATUS_ERROR)
  5607. }
  5608. /* fall through */
  5609. fallthrough
  5610. default:
  5611. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_PARSING)
  5612. }
  5613. start = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  5614. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = start
  5615. *(*uintptr)(unsafe.Pointer(parser + 56)) += uintptr(len1)
  5616. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd
  5617. *(*TXML_Index)(unsafe.Pointer(parser + 72)) += int64(len1)
  5618. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer = libc.Uint8FromInt32(isFinal)
  5619. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = (*(*func(*libc.TLS, TXML_Parser, uintptr, uintptr, uintptr) _XML_Error)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor})))(tls, parser, start, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr, parser+48)
  5620. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode != int32(_XML_ERROR_NONE) {
  5621. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  5622. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_errorProcessor)
  5623. return int32(_XML_STATUS_ERROR)
  5624. } else {
  5625. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  5626. case int32(_XML_SUSPENDED):
  5627. result = int32(_XML_STATUS_SUSPENDED)
  5628. case int32(_XML_INITIALIZED):
  5629. fallthrough
  5630. case int32(_XML_PARSING):
  5631. if isFinal != 0 {
  5632. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  5633. return result
  5634. }
  5635. fallthrough
  5636. default: /* should not happen */
  5637. }
  5638. }
  5639. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FupdatePosition})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr, parser+768)
  5640. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  5641. return result
  5642. }
  5643. func XXML_GetBuffer(tls *libc.TLS, parser TXML_Parser, len1 int32) (r uintptr) {
  5644. var bufferSize, keep, neededSize, offset int32
  5645. var newBuf, v10, v11 uintptr
  5646. var v1, v2, v3, v4, v5, v6, v7, v8, v9 int64
  5647. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bufferSize, keep, neededSize, newBuf, offset, v1, v10, v11, v2, v3, v4, v5, v6, v7, v8, v9
  5648. if parser == libc.UintptrFromInt32(0) {
  5649. return libc.UintptrFromInt32(0)
  5650. }
  5651. if len1 < 0 {
  5652. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  5653. return libc.UintptrFromInt32(0)
  5654. }
  5655. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  5656. case int32(_XML_SUSPENDED):
  5657. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  5658. return libc.UintptrFromInt32(0)
  5659. case int32(_XML_FINISHED):
  5660. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  5661. return libc.UintptrFromInt32(0)
  5662. default:
  5663. }
  5664. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 {
  5665. v1 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd)
  5666. } else {
  5667. v1 = 0
  5668. }
  5669. if int64(len1) > v1 {
  5670. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  5671. v2 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  5672. } else {
  5673. v2 = 0
  5674. }
  5675. /* Do not invoke signed arithmetic overflow: */
  5676. neededSize = libc.Int32FromUint32(libc.Uint32FromInt32(len1) + libc.Uint32FromInt64(v2))
  5677. if neededSize < 0 {
  5678. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  5679. return libc.UintptrFromInt32(0)
  5680. }
  5681. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  5682. v3 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  5683. } else {
  5684. v3 = 0
  5685. }
  5686. keep = int32(v3)
  5687. if keep > int32(m_XML_CONTEXT_BYTES) {
  5688. keep = int32(m_XML_CONTEXT_BYTES)
  5689. }
  5690. /* Detect and prevent integer overflow */
  5691. if keep > int32(m___INT_MAX__)-neededSize {
  5692. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  5693. return libc.UintptrFromInt32(0)
  5694. }
  5695. neededSize += keep
  5696. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  5697. v4 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  5698. } else {
  5699. v4 = 0
  5700. }
  5701. if int64(neededSize) <= v4 {
  5702. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  5703. v5 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  5704. } else {
  5705. v5 = 0
  5706. }
  5707. if int64(keep) < v5 {
  5708. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  5709. v6 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  5710. } else {
  5711. v6 = 0
  5712. }
  5713. offset = int32(v6) - keep
  5714. /* The buffer pointers cannot be NULL here; we have at least some bytes
  5715. * in the buffer */
  5716. libc.X__builtin___memmove_chk(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer+uintptr(offset), libc.Uint64FromInt64(int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd)-int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)+int64(keep)), ^t__predefined_size_t(0))
  5717. *(*uintptr)(unsafe.Pointer(parser + 56)) -= uintptr(offset)
  5718. *(*uintptr)(unsafe.Pointer(parser + 48)) -= uintptr(offset)
  5719. }
  5720. } else {
  5721. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  5722. v7 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  5723. } else {
  5724. v7 = 0
  5725. }
  5726. bufferSize = int32(v7)
  5727. if bufferSize == 0 {
  5728. bufferSize = int32(m_INIT_BUFFER_SIZE)
  5729. }
  5730. for cond := true; cond; cond = bufferSize < neededSize && bufferSize > 0 {
  5731. /* Do not invoke signed arithmetic overflow: */
  5732. bufferSize = libc.Int32FromUint32(libc.Uint32FromUint32(2) * libc.Uint32FromInt32(bufferSize))
  5733. }
  5734. if bufferSize <= 0 {
  5735. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  5736. return libc.UintptrFromInt32(0)
  5737. }
  5738. newBuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32(bufferSize))
  5739. if newBuf == uintptr(0) {
  5740. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  5741. return libc.UintptrFromInt32(0)
  5742. }
  5743. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim = newBuf + uintptr(bufferSize)
  5744. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  5745. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  5746. v8 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  5747. } else {
  5748. v8 = 0
  5749. }
  5750. libc.X__builtin___memcpy_chk(tls, newBuf, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr+uintptr(-keep), libc.Uint64FromInt64(v8+int64(keep)), ^t__predefined_size_t(0))
  5751. (*(*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)
  5752. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer = newBuf
  5753. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  5754. v9 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  5755. } else {
  5756. v9 = 0
  5757. }
  5758. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer + uintptr(v9) + uintptr(keep)
  5759. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer + uintptr(keep)
  5760. } else {
  5761. /* This must be a brand new buffer with no data in it yet */
  5762. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd = newBuf
  5763. v10 = newBuf
  5764. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer = v10
  5765. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr = v10
  5766. }
  5767. }
  5768. v11 = libc.UintptrFromInt32(0)
  5769. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = v11
  5770. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = v11
  5771. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = libc.UintptrFromInt32(0)
  5772. }
  5773. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd
  5774. }
  5775. func XXML_StopParser(tls *libc.TLS, parser TXML_Parser, resumable TXML_Bool) (r _XML_Status) {
  5776. if parser == libc.UintptrFromInt32(0) {
  5777. return int32(_XML_STATUS_ERROR)
  5778. }
  5779. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  5780. case int32(_XML_SUSPENDED):
  5781. if resumable != 0 {
  5782. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  5783. return int32(_XML_STATUS_ERROR)
  5784. }
  5785. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  5786. case int32(_XML_FINISHED):
  5787. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  5788. return int32(_XML_STATUS_ERROR)
  5789. default:
  5790. if resumable != 0 {
  5791. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0 {
  5792. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPEND_PE)
  5793. return int32(_XML_STATUS_ERROR)
  5794. }
  5795. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_SUSPENDED)
  5796. } else {
  5797. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  5798. }
  5799. }
  5800. return int32(_XML_STATUS_OK)
  5801. }
  5802. func XXML_ResumeParser(tls *libc.TLS, parser TXML_Parser) (r _XML_Status) {
  5803. var result _XML_Status
  5804. _ = result
  5805. result = int32(_XML_STATUS_OK)
  5806. if parser == libc.UintptrFromInt32(0) {
  5807. return int32(_XML_STATUS_ERROR)
  5808. }
  5809. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing != int32(_XML_SUSPENDED) {
  5810. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NOT_SUSPENDED)
  5811. return int32(_XML_STATUS_ERROR)
  5812. }
  5813. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_PARSING)
  5814. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = (*(*func(*libc.TLS, TXML_Parser, uintptr, uintptr, uintptr) _XML_Error)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor})))(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr, parser+48)
  5815. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode != int32(_XML_ERROR_NONE) {
  5816. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  5817. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_errorProcessor)
  5818. return int32(_XML_STATUS_ERROR)
  5819. } else {
  5820. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  5821. case int32(_XML_SUSPENDED):
  5822. result = int32(_XML_STATUS_SUSPENDED)
  5823. case int32(_XML_INITIALIZED):
  5824. fallthrough
  5825. case int32(_XML_PARSING):
  5826. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0 {
  5827. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  5828. return result
  5829. }
  5830. fallthrough
  5831. default:
  5832. }
  5833. }
  5834. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FupdatePosition})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr, parser+768)
  5835. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  5836. return result
  5837. }
  5838. func XXML_GetParsingStatus(tls *libc.TLS, parser TXML_Parser, status uintptr) {
  5839. if parser == libc.UintptrFromInt32(0) {
  5840. return
  5841. }
  5842. *(*TXML_ParsingStatus)(unsafe.Pointer(status)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus
  5843. }
  5844. func XXML_GetErrorCode(tls *libc.TLS, parser TXML_Parser) (r _XML_Error) {
  5845. if parser == libc.UintptrFromInt32(0) {
  5846. return int32(_XML_ERROR_INVALID_ARGUMENT)
  5847. }
  5848. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode
  5849. }
  5850. func XXML_GetCurrentByteIndex(tls *libc.TLS, parser TXML_Parser) (r TXML_Index) {
  5851. if parser == libc.UintptrFromInt32(0) {
  5852. return int64(-int32(1))
  5853. }
  5854. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 {
  5855. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndByteIndex - (int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr))
  5856. }
  5857. return int64(-int32(1))
  5858. }
  5859. func XXML_GetCurrentByteCount(tls *libc.TLS, parser TXML_Parser) (r int32) {
  5860. if parser == libc.UintptrFromInt32(0) {
  5861. return 0
  5862. }
  5863. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 {
  5864. return int32(int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr))
  5865. }
  5866. return 0
  5867. }
  5868. func XXML_GetInputContext(tls *libc.TLS, parser TXML_Parser, offset uintptr, size uintptr) (r uintptr) {
  5869. if parser == libc.UintptrFromInt32(0) {
  5870. return libc.UintptrFromInt32(0)
  5871. }
  5872. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  5873. if offset != libc.UintptrFromInt32(0) {
  5874. *(*int32)(unsafe.Pointer(offset)) = int32(int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer))
  5875. }
  5876. if size != libc.UintptrFromInt32(0) {
  5877. *(*int32)(unsafe.Pointer(size)) = int32(int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer))
  5878. }
  5879. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer
  5880. }
  5881. return libc.UintptrFromInt32(0)
  5882. }
  5883. func XXML_GetCurrentLineNumber(tls *libc.TLS, parser TXML_Parser) (r TXML_Size) {
  5884. if parser == libc.UintptrFromInt32(0) {
  5885. return uint64(0)
  5886. }
  5887. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr >= (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr {
  5888. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FupdatePosition})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr, parser+768)
  5889. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  5890. }
  5891. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_position.FlineNumber + uint64(1)
  5892. }
  5893. func XXML_GetCurrentColumnNumber(tls *libc.TLS, parser TXML_Parser) (r TXML_Size) {
  5894. if parser == libc.UintptrFromInt32(0) {
  5895. return uint64(0)
  5896. }
  5897. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr >= (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr {
  5898. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FupdatePosition})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr, parser+768)
  5899. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  5900. }
  5901. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_position.FcolumnNumber
  5902. }
  5903. func XXML_FreeContentModel(tls *libc.TLS, parser TXML_Parser, model uintptr) {
  5904. if parser != libc.UintptrFromInt32(0) {
  5905. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, model)
  5906. }
  5907. }
  5908. func XXML_MemMalloc(tls *libc.TLS, parser TXML_Parser, size Tsize_t) (r uintptr) {
  5909. if parser == libc.UintptrFromInt32(0) {
  5910. return libc.UintptrFromInt32(0)
  5911. }
  5912. return (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, size)
  5913. }
  5914. func XXML_MemRealloc(tls *libc.TLS, parser TXML_Parser, ptr uintptr, size Tsize_t) (r uintptr) {
  5915. if parser == libc.UintptrFromInt32(0) {
  5916. return libc.UintptrFromInt32(0)
  5917. }
  5918. return (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, ptr, size)
  5919. }
  5920. func XXML_MemFree(tls *libc.TLS, parser TXML_Parser, ptr uintptr) {
  5921. if parser != libc.UintptrFromInt32(0) {
  5922. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, ptr)
  5923. }
  5924. }
  5925. func XXML_DefaultCurrent(tls *libc.TLS, parser TXML_Parser) {
  5926. if parser == libc.UintptrFromInt32(0) {
  5927. return
  5928. }
  5929. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  5930. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0 {
  5931. _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)
  5932. } else {
  5933. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr)
  5934. }
  5935. }
  5936. }
  5937. func XXML_ErrorString(tls *libc.TLS, code _XML_Error) (r uintptr) {
  5938. switch code {
  5939. case int32(_XML_ERROR_NONE):
  5940. return libc.UintptrFromInt32(0)
  5941. case int32(_XML_ERROR_NO_MEMORY):
  5942. return __ccgo_ts + 138
  5943. case int32(_XML_ERROR_SYNTAX):
  5944. return __ccgo_ts + 152
  5945. case int32(_XML_ERROR_NO_ELEMENTS):
  5946. return __ccgo_ts + 165
  5947. case int32(_XML_ERROR_INVALID_TOKEN):
  5948. return __ccgo_ts + 182
  5949. case int32(_XML_ERROR_UNCLOSED_TOKEN):
  5950. return __ccgo_ts + 214
  5951. case int32(_XML_ERROR_PARTIAL_CHAR):
  5952. return __ccgo_ts + 229
  5953. case int32(_XML_ERROR_TAG_MISMATCH):
  5954. return __ccgo_ts + 247
  5955. case int32(_XML_ERROR_DUPLICATE_ATTRIBUTE):
  5956. return __ccgo_ts + 262
  5957. case int32(_XML_ERROR_JUNK_AFTER_DOC_ELEMENT):
  5958. return __ccgo_ts + 282
  5959. case int32(_XML_ERROR_PARAM_ENTITY_REF):
  5960. return __ccgo_ts + 310
  5961. case int32(_XML_ERROR_UNDEFINED_ENTITY):
  5962. return __ccgo_ts + 345
  5963. case int32(_XML_ERROR_RECURSIVE_ENTITY_REF):
  5964. return __ccgo_ts + 362
  5965. case int32(_XML_ERROR_ASYNC_ENTITY):
  5966. return __ccgo_ts + 389
  5967. case int32(_XML_ERROR_BAD_CHAR_REF):
  5968. return __ccgo_ts + 409
  5969. case int32(_XML_ERROR_BINARY_ENTITY_REF):
  5970. return __ccgo_ts + 447
  5971. case int32(_XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF):
  5972. return __ccgo_ts + 474
  5973. case int32(_XML_ERROR_MISPLACED_XML_PI):
  5974. return __ccgo_ts + 516
  5975. case int32(_XML_ERROR_UNKNOWN_ENCODING):
  5976. return __ccgo_ts + 563
  5977. case int32(_XML_ERROR_INCORRECT_ENCODING):
  5978. return __ccgo_ts + 580
  5979. case int32(_XML_ERROR_UNCLOSED_CDATA_SECTION):
  5980. return __ccgo_ts + 631
  5981. case int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING):
  5982. return __ccgo_ts + 654
  5983. case int32(_XML_ERROR_NOT_STANDALONE):
  5984. return __ccgo_ts + 700
  5985. case int32(_XML_ERROR_UNEXPECTED_STATE):
  5986. return __ccgo_ts + 727
  5987. case int32(_XML_ERROR_ENTITY_DECLARED_IN_PE):
  5988. return __ccgo_ts + 778
  5989. case int32(_XML_ERROR_FEATURE_REQUIRES_XML_DTD):
  5990. return __ccgo_ts + 814
  5991. case int32(_XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING):
  5992. return __ccgo_ts + 866
  5993. /* Added in 1.95.7. */
  5994. fallthrough
  5995. case int32(_XML_ERROR_UNBOUND_PREFIX):
  5996. return __ccgo_ts + 911
  5997. /* Added in 1.95.8. */
  5998. fallthrough
  5999. case int32(_XML_ERROR_UNDECLARING_PREFIX):
  6000. return __ccgo_ts + 926
  6001. case int32(_XML_ERROR_INCOMPLETE_PE):
  6002. return __ccgo_ts + 952
  6003. case int32(_XML_ERROR_XML_DECL):
  6004. return __ccgo_ts + 990
  6005. case int32(_XML_ERROR_TEXT_DECL):
  6006. return __ccgo_ts + 1022
  6007. case int32(_XML_ERROR_PUBLICID):
  6008. return __ccgo_ts + 1055
  6009. case int32(_XML_ERROR_SUSPENDED):
  6010. return __ccgo_ts + 1089
  6011. case int32(_XML_ERROR_NOT_SUSPENDED):
  6012. return __ccgo_ts + 1106
  6013. case int32(_XML_ERROR_ABORTED):
  6014. return __ccgo_ts + 1127
  6015. case int32(_XML_ERROR_FINISHED):
  6016. return __ccgo_ts + 1143
  6017. case int32(_XML_ERROR_SUSPEND_PE):
  6018. return __ccgo_ts + 1160
  6019. /* Added in 2.0.0. */
  6020. fallthrough
  6021. case int32(_XML_ERROR_RESERVED_PREFIX_XML):
  6022. return __ccgo_ts + 1204
  6023. case int32(_XML_ERROR_RESERVED_PREFIX_XMLNS):
  6024. return __ccgo_ts + 1284
  6025. case int32(_XML_ERROR_RESERVED_NAMESPACE_URI):
  6026. return __ccgo_ts + 1343
  6027. /* Added in 2.2.5. */
  6028. fallthrough
  6029. case int32(_XML_ERROR_INVALID_ARGUMENT): /* Constant added in 2.2.1, already */
  6030. return __ccgo_ts + 1407
  6031. /* Added in 2.3.0. */
  6032. fallthrough
  6033. case int32(_XML_ERROR_NO_BUFFER):
  6034. return __ccgo_ts + 1424
  6035. /* Added in 2.4.0. */
  6036. fallthrough
  6037. case int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH):
  6038. return __ccgo_ts + 1486
  6039. }
  6040. return libc.UintptrFromInt32(0)
  6041. }
  6042. func XXML_ExpatVersion(tls *libc.TLS) (r uintptr) {
  6043. /* V1 is used to string-ize the version number. However, it would
  6044. string-ize the actual version macro *names* unless we get them
  6045. substituted before being passed to V1. CPP is defined to expand
  6046. a macro, then rescan for more expansions. Thus, we use V2 to expand
  6047. the version macros, then CPP will expand the resulting V1() macro
  6048. with the correct numerals. */
  6049. /* ### I'm assuming cpp is portable in this respect... */
  6050. return __ccgo_ts + 1555
  6051. }
  6052. func XXML_ExpatVersionInfo(tls *libc.TLS) (r TXML_Expat_Version) {
  6053. var version TXML_Expat_Version
  6054. _ = version
  6055. version.Fmajor = int32(m_XML_MAJOR_VERSION)
  6056. version.Fminor = int32(m_XML_MINOR_VERSION)
  6057. version.Fmicro = m_XML_MICRO_VERSION
  6058. return version
  6059. }
  6060. func XXML_GetFeatureList(tls *libc.TLS) (r uintptr) {
  6061. return uintptr(unsafe.Pointer(&_features))
  6062. }
  6063. var _features = [8]TXML_Feature{
  6064. 0: {
  6065. Ffeature: int32(_XML_FEATURE_SIZEOF_XML_CHAR),
  6066. Fname: __ccgo_ts + 1567,
  6067. Fvalue: int64(1),
  6068. },
  6069. 1: {
  6070. Ffeature: int32(_XML_FEATURE_SIZEOF_XML_LCHAR),
  6071. Fname: __ccgo_ts + 1584,
  6072. Fvalue: int64(1),
  6073. },
  6074. 2: {
  6075. Ffeature: int32(_XML_FEATURE_DTD),
  6076. Fname: __ccgo_ts + 1602,
  6077. },
  6078. 3: {
  6079. Ffeature: int32(_XML_FEATURE_CONTEXT_BYTES),
  6080. Fname: __ccgo_ts + 1610,
  6081. Fvalue: int64(m_XML_CONTEXT_BYTES),
  6082. },
  6083. 4: {
  6084. Ffeature: int32(_XML_FEATURE_NS),
  6085. Fname: __ccgo_ts + 1628,
  6086. },
  6087. 5: {
  6088. Ffeature: int32(_XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT),
  6089. Fname: __ccgo_ts + 1635,
  6090. Fvalue: libc.Int64FromFloat32(100),
  6091. },
  6092. 6: {
  6093. Ffeature: int32(_XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT),
  6094. Fname: __ccgo_ts + 1652,
  6095. Fvalue: int64(m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT),
  6096. },
  6097. 7: {},
  6098. }
  6099. func XXML_SetBillionLaughsAttackProtectionMaximumAmplification(tls *libc.TLS, parser TXML_Parser, maximumAmplificationFactor float32) (r TXML_Bool) {
  6100. var v1 float32
  6101. var v2 int32
  6102. var v4 bool
  6103. _, _, _ = v1, v2, v4
  6104. if v4 = parser == libc.UintptrFromInt32(0) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != libc.UintptrFromInt32(0); !v4 {
  6105. v1 = maximumAmplificationFactor
  6106. v2 = libc.BoolInt32(v1 != v1)
  6107. goto _3
  6108. _3:
  6109. }
  6110. if v4 || v2 != 0 || maximumAmplificationFactor < libc.Float32FromFloat32(1) {
  6111. return libc.Uint8FromInt32(0)
  6112. }
  6113. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FmaximumAmplificationFactor = maximumAmplificationFactor
  6114. return libc.Uint8FromInt32(1)
  6115. }
  6116. func XXML_SetBillionLaughsAttackProtectionActivationThreshold(tls *libc.TLS, parser TXML_Parser, activationThresholdBytes uint64) (r TXML_Bool) {
  6117. if parser == libc.UintptrFromInt32(0) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != libc.UintptrFromInt32(0) {
  6118. return libc.Uint8FromInt32(0)
  6119. }
  6120. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FactivationThresholdBytes = activationThresholdBytes
  6121. return libc.Uint8FromInt32(1)
  6122. }
  6123. // C documentation
  6124. //
  6125. // /* Initially tag->rawName always points into the parse buffer;
  6126. // for those TAG instances opened while the current parse buffer was
  6127. // processed, and not yet closed, we need to store tag->rawName in a more
  6128. // permanent location, since the parse buffer is about to be discarded.
  6129. // */
  6130. func _storeRawNames(tls *libc.TLS, parser TXML_Parser) (r TXML_Bool) {
  6131. var bufSize, nameLen int32
  6132. var rawNameBuf, tag, temp uintptr
  6133. var rawNameLen Tsize_t
  6134. _, _, _, _, _, _ = bufSize, nameLen, rawNameBuf, rawNameLen, tag, temp
  6135. tag = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  6136. for tag != 0 {
  6137. nameLen = libc.Int32FromUint64(uint64(1) * libc.Uint64FromInt32((*TTAG)(unsafe.Pointer(tag)).Fname.FstrLen+libc.Int32FromInt32(1)))
  6138. rawNameBuf = (*TTAG)(unsafe.Pointer(tag)).Fbuf + uintptr(nameLen)
  6139. /* Stop if already stored. Since m_tagStack is a stack, we can stop
  6140. at the first entry that has already been copied; everything
  6141. below it in the stack is already been accounted for in a
  6142. previous call to this function.
  6143. */
  6144. if (*TTAG)(unsafe.Pointer(tag)).FrawName == rawNameBuf {
  6145. break
  6146. }
  6147. /* For re-use purposes we need to ensure that the
  6148. size of tag->buf is a multiple of sizeof(XML_Char).
  6149. */
  6150. rawNameLen = (libc.Uint64FromInt32((*TTAG)(unsafe.Pointer(tag)).FrawNameLength) + (libc.Uint64FromInt64(1) - libc.Uint64FromInt32(1))) & ^(libc.Uint64FromInt64(1) - libc.Uint64FromInt32(1))
  6151. /* Detect and prevent integer overflow. */
  6152. if rawNameLen > libc.Uint64FromInt32(m___INT_MAX__)-libc.Uint64FromInt32(nameLen) {
  6153. return libc.Uint8FromInt32(0)
  6154. }
  6155. bufSize = nameLen + libc.Int32FromUint64(rawNameLen)
  6156. if int64(bufSize) > int64((*TTAG)(unsafe.Pointer(tag)).FbufEnd)-int64((*TTAG)(unsafe.Pointer(tag)).Fbuf) {
  6157. temp = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TTAG)(unsafe.Pointer(tag)).Fbuf, libc.Uint64FromInt32(bufSize))
  6158. if temp == libc.UintptrFromInt32(0) {
  6159. return libc.Uint8FromInt32(0)
  6160. }
  6161. /* if tag->name.str points to tag->buf (only when namespace
  6162. processing is off) then we have to update it
  6163. */
  6164. if (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr == (*TTAG)(unsafe.Pointer(tag)).Fbuf {
  6165. (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr = temp
  6166. }
  6167. /* if tag->name.localPart is set (when namespace processing is on)
  6168. then update it as well, since it will always point into tag->buf
  6169. */
  6170. if (*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart != 0 {
  6171. (*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart = temp + uintptr(int64((*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart)-int64((*TTAG)(unsafe.Pointer(tag)).Fbuf))
  6172. }
  6173. (*TTAG)(unsafe.Pointer(tag)).Fbuf = temp
  6174. (*TTAG)(unsafe.Pointer(tag)).FbufEnd = temp + uintptr(bufSize)
  6175. rawNameBuf = temp + uintptr(nameLen)
  6176. }
  6177. libc.X__builtin___memcpy_chk(tls, rawNameBuf, (*TTAG)(unsafe.Pointer(tag)).FrawName, libc.Uint64FromInt32((*TTAG)(unsafe.Pointer(tag)).FrawNameLength), ^t__predefined_size_t(0))
  6178. (*TTAG)(unsafe.Pointer(tag)).FrawName = rawNameBuf
  6179. tag = (*TTAG)(unsafe.Pointer(tag)).Fparent
  6180. }
  6181. return libc.Uint8FromInt32(1)
  6182. }
  6183. func _contentProcessor(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  6184. var result _XML_Error
  6185. _ = result
  6186. 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))
  6187. if result == int32(_XML_ERROR_NONE) {
  6188. if !(_storeRawNames(tls, parser) != 0) {
  6189. return int32(_XML_ERROR_NO_MEMORY)
  6190. }
  6191. }
  6192. return result
  6193. }
  6194. func _externalEntityInitProcessor(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  6195. var result _XML_Error
  6196. _ = result
  6197. result = _initializeEncoding(tls, parser)
  6198. if result != int32(_XML_ERROR_NONE) {
  6199. return result
  6200. }
  6201. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityInitProcessor2)
  6202. return _externalEntityInitProcessor2(tls, parser, start, end, endPtr)
  6203. }
  6204. func _externalEntityInitProcessor2(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  6205. bp := tls.Alloc(16)
  6206. defer tls.Free(16)
  6207. var tok int32
  6208. var _ /* next at bp+0 */ uintptr
  6209. _ = tok
  6210. *(*uintptr)(unsafe.Pointer(bp)) = start /* XmlContentTok doesn't always set the last arg */
  6211. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding + 1*8))})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, start, end, bp)
  6212. switch tok {
  6213. case int32(m_XML_TOK_BOM):
  6214. if !(_accountingDiffTolerated(tls, parser, tok, start, *(*uintptr)(unsafe.Pointer(bp)), int32(2649), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  6215. _accountingOnAbort(tls, parser)
  6216. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6217. }
  6218. /* If we are at the end of the buffer, this would cause the next stage,
  6219. i.e. externalEntityInitProcessor3, to pass control directly to
  6220. doContent (by detecting XML_TOK_NONE) without processing any xml text
  6221. declaration - causing the error XML_ERROR_MISPLACED_XML_PI in doContent.
  6222. */
  6223. if *(*uintptr)(unsafe.Pointer(bp)) == end && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  6224. *(*uintptr)(unsafe.Pointer(endPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6225. return int32(_XML_ERROR_NONE)
  6226. }
  6227. start = *(*uintptr)(unsafe.Pointer(bp))
  6228. case -int32(1):
  6229. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  6230. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  6231. return int32(_XML_ERROR_NONE)
  6232. }
  6233. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  6234. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6235. case -int32(2):
  6236. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  6237. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  6238. return int32(_XML_ERROR_NONE)
  6239. }
  6240. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  6241. return int32(_XML_ERROR_PARTIAL_CHAR)
  6242. }
  6243. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityInitProcessor3)
  6244. return _externalEntityInitProcessor3(tls, parser, start, end, endPtr)
  6245. }
  6246. func _externalEntityInitProcessor3(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  6247. bp := tls.Alloc(16)
  6248. defer tls.Free(16)
  6249. var result _XML_Error
  6250. var tok int32
  6251. var _ /* next at bp+0 */ uintptr
  6252. _, _ = result, tok
  6253. *(*uintptr)(unsafe.Pointer(bp)) = start /* XmlContentTok doesn't always set the last arg */
  6254. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  6255. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding + 1*8))})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, start, end, bp)
  6256. /* Note: These bytes are accounted later in:
  6257. - processXmlDecl
  6258. - externalEntityContentProcessor
  6259. */
  6260. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = *(*uintptr)(unsafe.Pointer(bp))
  6261. switch tok {
  6262. case int32(m_XML_TOK_XML_DECL):
  6263. result = _processXmlDecl(tls, parser, int32(1), start, *(*uintptr)(unsafe.Pointer(bp)))
  6264. if result != int32(_XML_ERROR_NONE) {
  6265. return result
  6266. }
  6267. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  6268. case int32(_XML_SUSPENDED):
  6269. *(*uintptr)(unsafe.Pointer(endPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6270. return int32(_XML_ERROR_NONE)
  6271. case int32(_XML_FINISHED):
  6272. return int32(_XML_ERROR_ABORTED)
  6273. default:
  6274. start = *(*uintptr)(unsafe.Pointer(bp))
  6275. }
  6276. case -int32(1):
  6277. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  6278. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  6279. return int32(_XML_ERROR_NONE)
  6280. }
  6281. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6282. case -int32(2):
  6283. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  6284. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  6285. return int32(_XML_ERROR_NONE)
  6286. }
  6287. return int32(_XML_ERROR_PARTIAL_CHAR)
  6288. }
  6289. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityContentProcessor)
  6290. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel = int32(1)
  6291. return _externalEntityContentProcessor(tls, parser, start, end, endPtr)
  6292. }
  6293. func _externalEntityContentProcessor(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  6294. var result _XML_Error
  6295. _ = result
  6296. 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))
  6297. if result == int32(_XML_ERROR_NONE) {
  6298. if !(_storeRawNames(tls, parser) != 0) {
  6299. return int32(_XML_ERROR_NO_MEMORY)
  6300. }
  6301. }
  6302. return result
  6303. }
  6304. 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) {
  6305. bp := tls.Alloc(112)
  6306. defer tls.Free(112)
  6307. *(*uintptr)(unsafe.Pointer(bp)) = _s
  6308. 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
  6309. var bufSize, convLen, len1, n, tok int32
  6310. var charDataHandler TXML_CharacterDataHandler
  6311. var convert_res, convert_res1 _XML_Convert_Result
  6312. var noElmHandlers TXML_Bool
  6313. var result, result1, result2, result3 _XML_Error
  6314. var _ /* bindings at bp+40 */ uintptr
  6315. var _ /* buf at bp+88 */ [4]TXML_Char
  6316. var _ /* c at bp+16 */ TXML_Char
  6317. var _ /* c at bp+92 */ TXML_Char
  6318. var _ /* ch at bp+17 */ TXML_Char
  6319. var _ /* dataPtr at bp+104 */ uintptr
  6320. var _ /* dataPtr at bp+96 */ uintptr
  6321. var _ /* fromPtr at bp+32 */ uintptr
  6322. var _ /* name at bp+48 */ TTAG_NAME
  6323. var _ /* next at bp+8 */ uintptr
  6324. var _ /* toPtr at bp+24 */ uintptr
  6325. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  6326. /* save one level of indirection */
  6327. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  6328. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6329. eventPP = parser + 544
  6330. eventEndPP = parser + 552
  6331. } else {
  6332. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  6333. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  6334. }
  6335. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6336. for {
  6337. *(*uintptr)(unsafe.Pointer(bp + 8)) = *(*uintptr)(unsafe.Pointer(bp)) /* XmlContentTok doesn't always set the last arg */
  6338. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 1*8))})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+8)
  6339. if tok == -int32(5) || tok == -int32(3) {
  6340. if haveMore != 0 {
  6341. v3 = *(*uintptr)(unsafe.Pointer(bp))
  6342. } else {
  6343. v3 = end
  6344. }
  6345. v2 = v3
  6346. } else {
  6347. v2 = *(*uintptr)(unsafe.Pointer(bp + 8))
  6348. }
  6349. accountAfter = v2
  6350. if !(_accountingDiffTolerated(tls, parser, tok, *(*uintptr)(unsafe.Pointer(bp)), accountAfter, int32(2773), account) != 0) {
  6351. _accountingOnAbort(tls, parser)
  6352. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6353. }
  6354. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6355. switch tok {
  6356. case -int32(3):
  6357. if haveMore != 0 {
  6358. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6359. return int32(_XML_ERROR_NONE)
  6360. }
  6361. *(*uintptr)(unsafe.Pointer(eventEndPP)) = end
  6362. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  6363. *(*TXML_Char)(unsafe.Pointer(bp + 16)) = int8(0xA)
  6364. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, bp+16, int32(1))
  6365. } else {
  6366. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6367. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), end)
  6368. }
  6369. }
  6370. /* We are at the end of the final buffer, should we check for
  6371. XML_SUSPENDED, XML_FINISHED?
  6372. */
  6373. if startTagLevel == 0 {
  6374. return int32(_XML_ERROR_NO_ELEMENTS)
  6375. }
  6376. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel != startTagLevel {
  6377. return int32(_XML_ERROR_ASYNC_ENTITY)
  6378. }
  6379. *(*uintptr)(unsafe.Pointer(nextPtr)) = end
  6380. return int32(_XML_ERROR_NONE)
  6381. case -int32(4):
  6382. if haveMore != 0 {
  6383. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6384. return int32(_XML_ERROR_NONE)
  6385. }
  6386. if startTagLevel > 0 {
  6387. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel != startTagLevel {
  6388. return int32(_XML_ERROR_ASYNC_ENTITY)
  6389. }
  6390. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6391. return int32(_XML_ERROR_NONE)
  6392. }
  6393. return int32(_XML_ERROR_NO_ELEMENTS)
  6394. case m_XML_TOK_INVALID:
  6395. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6396. return int32(_XML_ERROR_INVALID_TOKEN)
  6397. case -int32(1):
  6398. if haveMore != 0 {
  6399. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6400. return int32(_XML_ERROR_NONE)
  6401. }
  6402. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6403. case -int32(2):
  6404. if haveMore != 0 {
  6405. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6406. return int32(_XML_ERROR_NONE)
  6407. }
  6408. return int32(_XML_ERROR_PARTIAL_CHAR)
  6409. case int32(m_XML_TOK_ENTITY_REF):
  6410. *(*TXML_Char)(unsafe.Pointer(bp + 17)) = int8((*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FpredefinedEntityName})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp + 8))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)))
  6411. if *(*TXML_Char)(unsafe.Pointer(bp + 17)) != 0 {
  6412. /* NOTE: We are replacing 4-6 characters original input for 1 character
  6413. * so there is no amplification and hence recording without
  6414. * protection. */
  6415. _accountingDiffTolerated(tls, parser, tok, bp+17, bp+17+uintptr(1), int32(2839), int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  6416. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  6417. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, bp+17, int32(1))
  6418. } else {
  6419. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6420. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  6421. }
  6422. }
  6423. break
  6424. }
  6425. name = _poolStoreString(tls, dtd+160, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp + 8))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  6426. if !(name != 0) {
  6427. return int32(_XML_ERROR_NO_MEMORY)
  6428. }
  6429. entity = _lookup(tls, parser, dtd, name, uint64(0))
  6430. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  6431. /* First, determine if a check for an existing declaration is needed;
  6432. if yes, check that the entity exists, and that it is internal,
  6433. otherwise call the skipped entity or default handler.
  6434. */
  6435. if !((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0) || (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0 {
  6436. if !(entity != 0) {
  6437. return int32(_XML_ERROR_UNDEFINED_ENTITY)
  6438. } else {
  6439. if !((*TENTITY)(unsafe.Pointer(entity)).Fis_internal != 0) {
  6440. return int32(_XML_ERROR_ENTITY_DECLARED_IN_PE)
  6441. }
  6442. }
  6443. } else {
  6444. if !(entity != 0) {
  6445. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler != 0 {
  6446. (*(*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)
  6447. } else {
  6448. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6449. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  6450. }
  6451. }
  6452. break
  6453. }
  6454. }
  6455. if (*TENTITY)(unsafe.Pointer(entity)).Fopen != 0 {
  6456. return int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  6457. }
  6458. if (*TENTITY)(unsafe.Pointer(entity)).Fnotation != 0 {
  6459. return int32(_XML_ERROR_BINARY_ENTITY_REF)
  6460. }
  6461. if (*TENTITY)(unsafe.Pointer(entity)).FtextPtr != 0 {
  6462. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities != 0) {
  6463. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler != 0 {
  6464. (*(*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)
  6465. } else {
  6466. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6467. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  6468. }
  6469. }
  6470. break
  6471. }
  6472. result = _processInternalEntity(tls, parser, entity, libc.Uint8FromInt32(0))
  6473. if result != int32(_XML_ERROR_NONE) {
  6474. return result
  6475. }
  6476. } else {
  6477. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  6478. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  6479. context = _getContext(tls, parser)
  6480. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  6481. if !(context != 0) {
  6482. return int32(_XML_ERROR_NO_MEMORY)
  6483. }
  6484. 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) {
  6485. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  6486. }
  6487. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  6488. } else {
  6489. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6490. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  6491. }
  6492. }
  6493. }
  6494. case int32(m_XML_TOK_START_TAG_NO_ATTS):
  6495. /* fall through */
  6496. fallthrough
  6497. case int32(m_XML_TOK_START_TAG_WITH_ATTS):
  6498. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList != 0 {
  6499. tag = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  6500. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = (*TTAG)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList)).Fparent
  6501. } else {
  6502. tag = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(88))
  6503. if !(tag != 0) {
  6504. return int32(_XML_ERROR_NO_MEMORY)
  6505. }
  6506. (*TTAG)(unsafe.Pointer(tag)).Fbuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32(libc.Int32FromInt32(m_INIT_TAG_BUF_SIZE)))
  6507. if !((*TTAG)(unsafe.Pointer(tag)).Fbuf != 0) {
  6508. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, tag)
  6509. return int32(_XML_ERROR_NO_MEMORY)
  6510. }
  6511. (*TTAG)(unsafe.Pointer(tag)).FbufEnd = (*TTAG)(unsafe.Pointer(tag)).Fbuf + uintptr(m_INIT_TAG_BUF_SIZE)
  6512. }
  6513. (*TTAG)(unsafe.Pointer(tag)).Fbindings = libc.UintptrFromInt32(0)
  6514. (*TTAG)(unsafe.Pointer(tag)).Fparent = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  6515. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack = tag
  6516. (*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart = libc.UintptrFromInt32(0)
  6517. (*TTAG)(unsafe.Pointer(tag)).Fname.Fprefix = libc.UintptrFromInt32(0)
  6518. (*TTAG)(unsafe.Pointer(tag)).FrawName = *(*uintptr)(unsafe.Pointer(bp)) + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  6519. (*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)
  6520. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel++
  6521. rawNameEnd = (*TTAG)(unsafe.Pointer(tag)).FrawName + uintptr((*TTAG)(unsafe.Pointer(tag)).FrawNameLength)
  6522. *(*uintptr)(unsafe.Pointer(bp + 32)) = (*TTAG)(unsafe.Pointer(tag)).FrawName
  6523. *(*uintptr)(unsafe.Pointer(bp + 24)) = (*TTAG)(unsafe.Pointer(tag)).Fbuf
  6524. for {
  6525. convert_res = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp+32, rawNameEnd, bp+24, (*TTAG)(unsafe.Pointer(tag)).FbufEnd-uintptr(1))
  6526. convLen = int32(int64(*(*uintptr)(unsafe.Pointer(bp + 24))) - int64((*TTAG)(unsafe.Pointer(tag)).Fbuf))
  6527. if *(*uintptr)(unsafe.Pointer(bp + 32)) >= rawNameEnd || convert_res == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  6528. (*TTAG)(unsafe.Pointer(tag)).Fname.FstrLen = convLen
  6529. break
  6530. }
  6531. bufSize = int32(int64((*TTAG)(unsafe.Pointer(tag)).FbufEnd)-int64((*TTAG)(unsafe.Pointer(tag)).Fbuf)) << int32(1)
  6532. temp = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TTAG)(unsafe.Pointer(tag)).Fbuf, libc.Uint64FromInt32(bufSize))
  6533. if temp == libc.UintptrFromInt32(0) {
  6534. return int32(_XML_ERROR_NO_MEMORY)
  6535. }
  6536. (*TTAG)(unsafe.Pointer(tag)).Fbuf = temp
  6537. (*TTAG)(unsafe.Pointer(tag)).FbufEnd = temp + uintptr(bufSize)
  6538. *(*uintptr)(unsafe.Pointer(bp + 24)) = temp + uintptr(convLen)
  6539. goto _4
  6540. _4:
  6541. }
  6542. (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr = (*TTAG)(unsafe.Pointer(tag)).Fbuf
  6543. *(*TXML_Char)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24)))) = int8('\000')
  6544. result1 = _storeAtts(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), tag+24, tag+80, account)
  6545. if result1 != 0 {
  6546. return result1
  6547. }
  6548. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler != 0 {
  6549. (*(*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)
  6550. } else {
  6551. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6552. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  6553. }
  6554. }
  6555. _poolClear(tls, parser+784)
  6556. case int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS):
  6557. /* fall through */
  6558. fallthrough
  6559. case int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS):
  6560. rawName = *(*uintptr)(unsafe.Pointer(bp)) + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  6561. *(*uintptr)(unsafe.Pointer(bp + 40)) = libc.UintptrFromInt32(0)
  6562. noElmHandlers = libc.Uint8FromInt32(1)
  6563. (*(*TTAG_NAME)(unsafe.Pointer(bp + 48))).Fstr = _poolStoreString(tls, parser+784, enc, rawName, rawName+uintptr((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameLength})))(tls, enc, rawName)))
  6564. if !((*(*TTAG_NAME)(unsafe.Pointer(bp + 48))).Fstr != 0) {
  6565. return int32(_XML_ERROR_NO_MEMORY)
  6566. }
  6567. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  6568. result2 = _storeAtts(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), bp+48, bp+40, int32(_XML_ACCOUNT_NONE))
  6569. if result2 != int32(_XML_ERROR_NONE) {
  6570. _freeBindings(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 40)))
  6571. return result2
  6572. }
  6573. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  6574. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler != 0 {
  6575. (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*(*TTAG_NAME)(unsafe.Pointer(bp + 48))).Fstr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts)
  6576. noElmHandlers = libc.Uint8FromInt32(0)
  6577. }
  6578. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler != 0 {
  6579. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler != 0 {
  6580. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(eventEndPP))
  6581. }
  6582. (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*(*TTAG_NAME)(unsafe.Pointer(bp + 48))).Fstr)
  6583. noElmHandlers = libc.Uint8FromInt32(0)
  6584. }
  6585. if noElmHandlers != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6586. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  6587. }
  6588. _poolClear(tls, parser+784)
  6589. _freeBindings(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 40)))
  6590. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel == 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing != int32(_XML_FINISHED) {
  6591. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  6592. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_epilogProcessor)
  6593. } else {
  6594. return _epilogProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 8)), end, nextPtr)
  6595. }
  6596. }
  6597. case int32(m_XML_TOK_END_TAG):
  6598. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel == startTagLevel {
  6599. return int32(_XML_ERROR_ASYNC_ENTITY)
  6600. } else {
  6601. tag1 = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  6602. rawName1 = *(*uintptr)(unsafe.Pointer(bp)) + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(2))
  6603. len1 = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameLength})))(tls, enc, rawName1)
  6604. if len1 != (*TTAG)(unsafe.Pointer(tag1)).FrawNameLength || libc.Xmemcmp(tls, (*TTAG)(unsafe.Pointer(tag1)).FrawName, rawName1, libc.Uint64FromInt32(len1)) != 0 {
  6605. *(*uintptr)(unsafe.Pointer(eventPP)) = rawName1
  6606. return int32(_XML_ERROR_TAG_MISMATCH)
  6607. }
  6608. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack = (*TTAG)(unsafe.Pointer(tag1)).Fparent
  6609. (*TTAG)(unsafe.Pointer(tag1)).Fparent = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  6610. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = tag1
  6611. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel--
  6612. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler != 0 {
  6613. localPart = (*TTAG)(unsafe.Pointer(tag1)).Fname.FlocalPart
  6614. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 && localPart != 0 {
  6615. /* localPart and prefix may have been overwritten in
  6616. tag->name.str, since this points to the binding->uri
  6617. buffer which gets re-used; so we have to add them again
  6618. */
  6619. uri = (*TTAG)(unsafe.Pointer(tag1)).Fname.Fstr + uintptr((*TTAG)(unsafe.Pointer(tag1)).Fname.FuriLen)
  6620. /* don't need to check for space - already done in storeAtts() */
  6621. for *(*TXML_Char)(unsafe.Pointer(localPart)) != 0 {
  6622. v5 = uri
  6623. uri++
  6624. v6 = localPart
  6625. localPart++
  6626. *(*TXML_Char)(unsafe.Pointer(v5)) = *(*TXML_Char)(unsafe.Pointer(v6))
  6627. }
  6628. prefix = (*TTAG)(unsafe.Pointer(tag1)).Fname.Fprefix
  6629. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets != 0 && prefix != 0 {
  6630. v7 = uri
  6631. uri++
  6632. *(*TXML_Char)(unsafe.Pointer(v7)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  6633. for *(*TXML_Char)(unsafe.Pointer(prefix)) != 0 {
  6634. v8 = uri
  6635. uri++
  6636. v9 = prefix
  6637. prefix++
  6638. *(*TXML_Char)(unsafe.Pointer(v8)) = *(*TXML_Char)(unsafe.Pointer(v9))
  6639. }
  6640. }
  6641. *(*TXML_Char)(unsafe.Pointer(uri)) = int8('\000')
  6642. }
  6643. (*(*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)
  6644. } else {
  6645. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6646. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  6647. }
  6648. }
  6649. for (*TTAG)(unsafe.Pointer(tag1)).Fbindings != 0 {
  6650. b = (*TTAG)(unsafe.Pointer(tag1)).Fbindings
  6651. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler != 0 {
  6652. (*(*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)
  6653. }
  6654. (*TTAG)(unsafe.Pointer(tag1)).Fbindings = (*TBINDING)(unsafe.Pointer((*TTAG)(unsafe.Pointer(tag1)).Fbindings)).FnextTagBinding
  6655. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  6656. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = b
  6657. (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fbinding = (*TBINDING)(unsafe.Pointer(b)).FprevPrefixBinding
  6658. }
  6659. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel == 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing != int32(_XML_FINISHED) {
  6660. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  6661. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_epilogProcessor)
  6662. } else {
  6663. return _epilogProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 8)), end, nextPtr)
  6664. }
  6665. }
  6666. }
  6667. case int32(m_XML_TOK_CHAR_REF):
  6668. n = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FcharRefNumber})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp)))
  6669. if n < 0 {
  6670. return int32(_XML_ERROR_BAD_CHAR_REF)
  6671. }
  6672. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  6673. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, bp+88, XXmlUtf8Encode(tls, n, bp+88))
  6674. } else {
  6675. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6676. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  6677. }
  6678. }
  6679. case int32(m_XML_TOK_XML_DECL):
  6680. return int32(_XML_ERROR_MISPLACED_XML_PI)
  6681. case int32(m_XML_TOK_DATA_NEWLINE):
  6682. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  6683. *(*TXML_Char)(unsafe.Pointer(bp + 92)) = int8(0xA)
  6684. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, bp+92, int32(1))
  6685. } else {
  6686. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6687. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  6688. }
  6689. }
  6690. case int32(m_XML_TOK_CDATA_SECT_OPEN):
  6691. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler != 0 {
  6692. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg)
  6693. } else {
  6694. if libc.Bool(0 != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  6695. (*(*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)
  6696. } else {
  6697. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6698. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  6699. }
  6700. }
  6701. }
  6702. result3 = _doCdataSection(tls, parser, enc, bp+8, end, nextPtr, haveMore, account)
  6703. if result3 != int32(_XML_ERROR_NONE) {
  6704. return result3
  6705. } else {
  6706. if !(*(*uintptr)(unsafe.Pointer(bp + 8)) != 0) {
  6707. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_cdataSectionProcessor)
  6708. return result3
  6709. }
  6710. }
  6711. case -int32(5):
  6712. if haveMore != 0 {
  6713. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6714. return int32(_XML_ERROR_NONE)
  6715. }
  6716. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  6717. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  6718. *(*uintptr)(unsafe.Pointer(bp + 96)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  6719. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, end, bp+96, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd)
  6720. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf, int32(int64(*(*uintptr)(unsafe.Pointer(bp + 96)))-int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf)))
  6721. } else {
  6722. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, *(*uintptr)(unsafe.Pointer(bp)), int32(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp)))))
  6723. }
  6724. } else {
  6725. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6726. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), end)
  6727. }
  6728. }
  6729. /* We are at the end of the final buffer, should we check for
  6730. XML_SUSPENDED, XML_FINISHED?
  6731. */
  6732. if startTagLevel == 0 {
  6733. *(*uintptr)(unsafe.Pointer(eventPP)) = end
  6734. return int32(_XML_ERROR_NO_ELEMENTS)
  6735. }
  6736. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel != startTagLevel {
  6737. *(*uintptr)(unsafe.Pointer(eventPP)) = end
  6738. return int32(_XML_ERROR_ASYNC_ENTITY)
  6739. }
  6740. *(*uintptr)(unsafe.Pointer(nextPtr)) = end
  6741. return int32(_XML_ERROR_NONE)
  6742. case int32(m_XML_TOK_DATA_CHARS):
  6743. charDataHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler
  6744. if charDataHandler != 0 {
  6745. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  6746. for {
  6747. *(*uintptr)(unsafe.Pointer(bp + 104)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  6748. convert_res1 = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, *(*uintptr)(unsafe.Pointer(bp + 8)), bp+104, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd)
  6749. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6750. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{charDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf, int32(int64(*(*uintptr)(unsafe.Pointer(bp + 104)))-int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf)))
  6751. if convert_res1 == int32(_XML_CONVERT_COMPLETED) || convert_res1 == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  6752. break
  6753. }
  6754. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6755. goto _10
  6756. _10:
  6757. }
  6758. } else {
  6759. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{charDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, *(*uintptr)(unsafe.Pointer(bp)), int32(int64(*(*uintptr)(unsafe.Pointer(bp + 8)))-int64(*(*uintptr)(unsafe.Pointer(bp)))))
  6760. }
  6761. } else {
  6762. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6763. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  6764. }
  6765. }
  6766. case int32(m_XML_TOK_PI):
  6767. if !(_reportProcessingInstruction(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8))) != 0) {
  6768. return int32(_XML_ERROR_NO_MEMORY)
  6769. }
  6770. case int32(m_XML_TOK_COMMENT):
  6771. if !(_reportComment(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8))) != 0) {
  6772. return int32(_XML_ERROR_NO_MEMORY)
  6773. }
  6774. default:
  6775. /* All of the tokens produced by XmlContentTok() have their own
  6776. * explicit cases, so this default is not strictly necessary.
  6777. * However it is a useful safety net, so we retain the code and
  6778. * simply exclude it from the coverage tests.
  6779. *
  6780. * LCOV_EXCL_START
  6781. */
  6782. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6783. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  6784. }
  6785. break
  6786. /* LCOV_EXCL_STOP */
  6787. }
  6788. v11 = *(*uintptr)(unsafe.Pointer(bp + 8))
  6789. *(*uintptr)(unsafe.Pointer(bp)) = v11
  6790. *(*uintptr)(unsafe.Pointer(eventPP)) = v11
  6791. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  6792. case int32(_XML_SUSPENDED):
  6793. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6794. return int32(_XML_ERROR_NONE)
  6795. case int32(_XML_FINISHED):
  6796. return int32(_XML_ERROR_ABORTED)
  6797. default:
  6798. }
  6799. goto _1
  6800. _1:
  6801. }
  6802. /* not reached */
  6803. return r
  6804. }
  6805. // C documentation
  6806. //
  6807. // /* This function does not call free() on the allocated memory, merely
  6808. // * moving it to the parser's m_freeBindingList where it can be freed or
  6809. // * reused as appropriate.
  6810. // */
  6811. func _freeBindings(tls *libc.TLS, parser TXML_Parser, bindings uintptr) {
  6812. var b uintptr
  6813. _ = b
  6814. for bindings != 0 {
  6815. b = bindings
  6816. /* m_startNamespaceDeclHandler will have been called for this
  6817. * binding in addBindings(), so call the end handler now.
  6818. */
  6819. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler != 0 {
  6820. (*(*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)
  6821. }
  6822. bindings = (*TBINDING)(unsafe.Pointer(bindings)).FnextTagBinding
  6823. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  6824. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = b
  6825. (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fbinding = (*TBINDING)(unsafe.Pointer(b)).FprevPrefixBinding
  6826. }
  6827. }
  6828. // C documentation
  6829. //
  6830. // /* Precondition: all arguments must be non-NULL;
  6831. // Purpose:
  6832. // - normalize attributes
  6833. // - check attributes for well-formedness
  6834. // - generate namespace aware attribute names (URI, prefix)
  6835. // - build list of attributes for startElementHandler
  6836. // - default attributes
  6837. // - process namespace declarations (check and report them)
  6838. // - generate namespace aware element name (URI, prefix)
  6839. // */
  6840. func _storeAtts(tls *libc.TLS, parser TXML_Parser, enc uintptr, attStr uintptr, tagNamePtr uintptr, bindingsPtr uintptr, account _XML_Account) (r _XML_Error) {
  6841. bp := tls.Alloc(80)
  6842. defer tls.Free(80)
  6843. 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
  6844. var attIndex, i, j, j1, n, nDefaultAtts, nPrefixes, oldAttsSize, prefixLen, v13, v17, v2, v23, v30, v33, v38, v40, v6, v7, v8, v9 int32
  6845. var c TXML_Char
  6846. var isCdata TXML_Bool
  6847. var mask, uriHash, version, v14 uint64
  6848. var nsAttsSize uint32
  6849. var oldNsAttsPower, step, v10 uint8
  6850. var result, result1, result2 _XML_Error
  6851. var _ /* sip_key at bp+56 */ Tsipkey
  6852. var _ /* sip_state at bp+0 */ Tsiphash
  6853. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  6854. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* the attribute list for the application */
  6855. attIndex = 0
  6856. nPrefixes = 0
  6857. /* lookup the element type name */
  6858. elementType = _lookup(tls, parser, dtd+40, (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr, uint64(0))
  6859. if !(elementType != 0) {
  6860. name = _poolCopyString(tls, dtd+160, (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr)
  6861. if !(name != 0) {
  6862. return int32(_XML_ERROR_NO_MEMORY)
  6863. }
  6864. elementType = _lookup(tls, parser, dtd+40, name, uint64(40))
  6865. if !(elementType != 0) {
  6866. return int32(_XML_ERROR_NO_MEMORY)
  6867. }
  6868. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 && !(_setElementTypePrefix(tls, parser, elementType) != 0) {
  6869. return int32(_XML_ERROR_NO_MEMORY)
  6870. }
  6871. }
  6872. nDefaultAtts = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FnDefaultAtts
  6873. /* get the attributes from the tokenizer */
  6874. 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)
  6875. /* Detect and prevent integer overflow */
  6876. if n > int32(m___INT_MAX__)-nDefaultAtts {
  6877. return int32(_XML_ERROR_NO_MEMORY)
  6878. }
  6879. if n+nDefaultAtts > (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize {
  6880. oldAttsSize = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize
  6881. /* Detect and prevent integer overflow */
  6882. if nDefaultAtts > libc.Int32FromInt32(m___INT_MAX__)-libc.Int32FromInt32(m_INIT_ATTS_SIZE) || n > int32(m___INT_MAX__)-(nDefaultAtts+int32(m_INIT_ATTS_SIZE)) {
  6883. return int32(_XML_ERROR_NO_MEMORY)
  6884. }
  6885. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = n + nDefaultAtts + int32(m_INIT_ATTS_SIZE)
  6886. /* Detect and prevent integer overflow.
  6887. * The preprocessor guard addresses the "always false" warning
  6888. * from -Wtype-limits on platforms where
  6889. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  6890. temp = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts, libc.Uint64FromInt32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize)*libc.Uint64FromInt64(32))
  6891. if temp == libc.UintptrFromInt32(0) {
  6892. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = oldAttsSize
  6893. return int32(_XML_ERROR_NO_MEMORY)
  6894. }
  6895. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts = temp
  6896. if n > oldAttsSize {
  6897. (*(*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)
  6898. }
  6899. }
  6900. appAtts = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts
  6901. i = 0
  6902. for {
  6903. if !(i < n) {
  6904. break
  6905. }
  6906. currAtt = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32
  6907. /* add the name and value to the attribute list */
  6908. 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)))
  6909. if !(attId != 0) {
  6910. return int32(_XML_ERROR_NO_MEMORY)
  6911. }
  6912. /* Detect duplicate attributes by their QNames. This does not work when
  6913. namespace processing is turned on and different prefixes for the same
  6914. namespace are used. For this case we have a check further down.
  6915. */
  6916. if *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname + uintptr(-libc.Int32FromInt32(1)))) != 0 {
  6917. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6918. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).Fname
  6919. }
  6920. return int32(_XML_ERROR_DUPLICATE_ATTRIBUTE)
  6921. }
  6922. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname + uintptr(-libc.Int32FromInt32(1)))) = int8(1)
  6923. v2 = attIndex
  6924. attIndex++
  6925. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v2)*8)) = (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname
  6926. if !((*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).Fnormalized != 0) {
  6927. isCdata = libc.Uint8FromInt32(1)
  6928. /* figure out whether declared as other than CDATA */
  6929. if (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).FmaybeTokenized != 0 {
  6930. j = 0
  6931. for {
  6932. if !(j < nDefaultAtts) {
  6933. break
  6934. }
  6935. if attId == (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FdefaultAtts + uintptr(j)*24))).Fid {
  6936. isCdata = (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FdefaultAtts + uintptr(j)*24))).FisCdata
  6937. break
  6938. }
  6939. goto _3
  6940. _3:
  6941. ;
  6942. j++
  6943. }
  6944. }
  6945. /* normalize the attribute value */
  6946. result = _storeAttributeValue(tls, parser, enc, isCdata, (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).FvaluePtr, (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).FvalueEnd, parser+784, account)
  6947. if result != 0 {
  6948. return result
  6949. }
  6950. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)) = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  6951. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  6952. } else {
  6953. /* the value did not need normalizing */
  6954. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)) = _poolStoreString(tls, parser+784, enc, (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).FvaluePtr, (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).FvalueEnd)
  6955. if *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)) == uintptr(0) {
  6956. return int32(_XML_ERROR_NO_MEMORY)
  6957. }
  6958. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  6959. }
  6960. /* handle prefixed attribute names */
  6961. if (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fprefix != 0 {
  6962. if (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fxmlns != 0 {
  6963. /* deal with namespace declarations here */
  6964. result1 = _addBinding(tls, parser, (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fprefix, attId, *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)), bindingsPtr)
  6965. if result1 != 0 {
  6966. return result1
  6967. }
  6968. attIndex--
  6969. } else {
  6970. /* deal with other prefixed names later */
  6971. attIndex++
  6972. nPrefixes++
  6973. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname + uintptr(-libc.Int32FromInt32(1)))) = int8(2)
  6974. }
  6975. } else {
  6976. attIndex++
  6977. }
  6978. goto _1
  6979. _1:
  6980. ;
  6981. i++
  6982. }
  6983. /* set-up for XML_GetSpecifiedAttributeCount and XML_GetIdAttributeIndex */
  6984. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nSpecifiedAtts = attIndex
  6985. 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 {
  6986. i = 0
  6987. for {
  6988. if !(i < attIndex) {
  6989. break
  6990. }
  6991. if *(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8)) == (*TATTRIBUTE_ID)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FidAtt)).Fname {
  6992. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_idAttIndex = i
  6993. break
  6994. }
  6995. goto _4
  6996. _4:
  6997. ;
  6998. i += int32(2)
  6999. }
  7000. } else {
  7001. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_idAttIndex = -int32(1)
  7002. }
  7003. /* do attribute defaulting */
  7004. i = 0
  7005. for {
  7006. if !(i < nDefaultAtts) {
  7007. break
  7008. }
  7009. da = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FdefaultAtts + uintptr(i)*24
  7010. 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 {
  7011. if (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fprefix != 0 {
  7012. if (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fxmlns != 0 {
  7013. 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)
  7014. if result2 != 0 {
  7015. return result2
  7016. }
  7017. } else {
  7018. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname + uintptr(-libc.Int32FromInt32(1)))) = int8(2)
  7019. nPrefixes++
  7020. v6 = attIndex
  7021. attIndex++
  7022. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v6)*8)) = (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname
  7023. v7 = attIndex
  7024. attIndex++
  7025. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v7)*8)) = (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fvalue
  7026. }
  7027. } else {
  7028. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname + uintptr(-libc.Int32FromInt32(1)))) = int8(1)
  7029. v8 = attIndex
  7030. attIndex++
  7031. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v8)*8)) = (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname
  7032. v9 = attIndex
  7033. attIndex++
  7034. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v9)*8)) = (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fvalue
  7035. }
  7036. }
  7037. goto _5
  7038. _5:
  7039. ;
  7040. i++
  7041. }
  7042. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)) = uintptr(0)
  7043. /* expand prefixed attribute names, check for duplicates,
  7044. and clear flags that say whether attributes were specified */
  7045. i = 0
  7046. if nPrefixes != 0 { /* hash table index */
  7047. version = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsVersion
  7048. /* Detect and prevent invalid shift */
  7049. if uint64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower) >= libc.Uint64FromInt64(4)*libc.Uint64FromInt32(8) {
  7050. return int32(_XML_ERROR_NO_MEMORY)
  7051. }
  7052. nsAttsSize = uint32(1) << (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower
  7053. oldNsAttsPower = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower
  7054. /* size of hash table must be at least 2 * (# of prefixed attributes) */
  7055. if nPrefixes<<int32(1)>>(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower != 0 {
  7056. /* hash table size must also be a power of 2 and >= 8 */
  7057. for {
  7058. v11 = parser + 760
  7059. v10 = *(*uint8)(unsafe.Pointer(v11))
  7060. *(*uint8)(unsafe.Pointer(v11))++
  7061. if !(nPrefixes>>v10 != 0) {
  7062. break
  7063. }
  7064. }
  7065. if libc.Int32FromUint8((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower) < int32(3) {
  7066. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = uint8(3)
  7067. }
  7068. /* Detect and prevent invalid shift */
  7069. if uint64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower) >= libc.Uint64FromInt64(4)*libc.Uint64FromInt32(8) {
  7070. /* Restore actual size of memory in m_nsAtts */
  7071. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = oldNsAttsPower
  7072. return int32(_XML_ERROR_NO_MEMORY)
  7073. }
  7074. nsAttsSize = uint32(1) << (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower
  7075. /* Detect and prevent integer overflow.
  7076. * The preprocessor guard addresses the "always false" warning
  7077. * from -Wtype-limits on platforms where
  7078. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  7079. temp1 = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts, uint64(nsAttsSize)*libc.Uint64FromInt64(24))
  7080. if !(temp1 != 0) {
  7081. /* Restore actual size of memory in m_nsAtts */
  7082. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = oldNsAttsPower
  7083. return int32(_XML_ERROR_NO_MEMORY)
  7084. }
  7085. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts = temp1
  7086. version = uint64(0) /* force re-initialization of m_nsAtts hash table */
  7087. }
  7088. /* using a version flag saves us from initializing m_nsAtts every time */
  7089. if !(version != 0) { /* initialize version flags when version wraps around */
  7090. version = uint64(m_INIT_ATTS_VERSION)
  7091. j1 = libc.Int32FromUint32(nsAttsSize)
  7092. for {
  7093. if !(j1 != 0) {
  7094. break
  7095. }
  7096. j1--
  7097. v13 = j1
  7098. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(v13)*24))).Fversion = version
  7099. goto _12
  7100. _12:
  7101. }
  7102. }
  7103. version--
  7104. v14 = version
  7105. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsVersion = v14
  7106. /* expand prefixed names and check for duplicates */
  7107. for {
  7108. if !(i < attIndex) {
  7109. break
  7110. }
  7111. s = *(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8))
  7112. if int32(*(*TXML_Char)(unsafe.Pointer(s + uintptr(-libc.Int32FromInt32(1))))) == int32(2) {
  7113. _copy_salt_to_sipkey(tls, parser, bp+56)
  7114. _sip24_init(tls, bp, bp+56)
  7115. *(*TXML_Char)(unsafe.Pointer(s + uintptr(-libc.Int32FromInt32(1)))) = 0 /* clear flag */
  7116. id = _lookup(tls, parser, dtd+80, s, uint64(0))
  7117. if !(id != 0) || !((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix != 0) {
  7118. /* This code is walking through the appAtts array, dealing
  7119. * with (in this case) a prefixed attribute name. To be in
  7120. * the array, the attribute must have already been bound, so
  7121. * has to have passed through the hash table lookup once
  7122. * already. That implies that an entry for it already
  7123. * exists, so the lookup above will return a pointer to
  7124. * already allocated memory. There is no opportunaity for
  7125. * the allocator to fail, so the condition above cannot be
  7126. * fulfilled.
  7127. *
  7128. * Since it is difficult to be certain that the above
  7129. * analysis is complete, we retain the test and merely
  7130. * remove the code from coverage tests.
  7131. */
  7132. return int32(_XML_ERROR_NO_MEMORY) /* LCOV_EXCL_LINE */
  7133. }
  7134. b = (*TPREFIX)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix)).Fbinding
  7135. if !(b != 0) {
  7136. return int32(_XML_ERROR_UNBOUND_PREFIX)
  7137. }
  7138. j1 = 0
  7139. for {
  7140. if !(j1 < (*TBINDING)(unsafe.Pointer(b)).FuriLen) {
  7141. break
  7142. }
  7143. c = *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Furi + uintptr(j1)))
  7144. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  7145. v17 = 0
  7146. } else {
  7147. v19 = parser + 784 + 24
  7148. v18 = *(*uintptr)(unsafe.Pointer(v19))
  7149. *(*uintptr)(unsafe.Pointer(v19))++
  7150. *(*TXML_Char)(unsafe.Pointer(v18)) = c
  7151. v17 = libc.Int32FromInt32(1)
  7152. }
  7153. if !(v17 != 0) {
  7154. return int32(_XML_ERROR_NO_MEMORY)
  7155. }
  7156. goto _16
  7157. _16:
  7158. ;
  7159. j1++
  7160. }
  7161. _sip24_update(tls, bp, (*TBINDING)(unsafe.Pointer(b)).Furi, libc.Uint64FromInt32((*TBINDING)(unsafe.Pointer(b)).FuriLen)*uint64(1))
  7162. for {
  7163. v20 = s
  7164. s++
  7165. if !(int32(*(*TXML_Char)(unsafe.Pointer(v20))) != int32(m_ASCII_COLON)) {
  7166. break
  7167. }
  7168. }
  7169. _sip24_update(tls, bp, s, _keylen(tls, s)*uint64(1))
  7170. for { /* copies null terminator */
  7171. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  7172. v23 = 0
  7173. } else {
  7174. v25 = parser + 784 + 24
  7175. v24 = *(*uintptr)(unsafe.Pointer(v25))
  7176. *(*uintptr)(unsafe.Pointer(v25))++
  7177. *(*TXML_Char)(unsafe.Pointer(v24)) = *(*TXML_Char)(unsafe.Pointer(s))
  7178. v23 = libc.Int32FromInt32(1)
  7179. }
  7180. if !(v23 != 0) {
  7181. return int32(_XML_ERROR_NO_MEMORY)
  7182. }
  7183. goto _22
  7184. _22:
  7185. ;
  7186. v21 = s
  7187. s++
  7188. if !(*(*TXML_Char)(unsafe.Pointer(v21)) != 0) {
  7189. break
  7190. }
  7191. }
  7192. uriHash = _sip24_final(tls, bp)
  7193. /* Check hash table for duplicate of expanded name (uriName).
  7194. Derived from code in lookup(parser, HASH_TABLE *table, ...).
  7195. */
  7196. step = uint8(0)
  7197. mask = uint64(nsAttsSize - uint32(1))
  7198. j1 = libc.Int32FromUint64(uriHash & mask) /* index into hash table */
  7199. for (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fversion == version {
  7200. /* for speed we compare stored hash values first */
  7201. if uriHash == (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fhash {
  7202. s1 = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  7203. s2 = (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).FuriName
  7204. /* s1 is null terminated, but not s2 */
  7205. for {
  7206. if !(int32(*(*TXML_Char)(unsafe.Pointer(s1))) == int32(*(*TXML_Char)(unsafe.Pointer(s2))) && int32(*(*TXML_Char)(unsafe.Pointer(s1))) != 0) {
  7207. break
  7208. }
  7209. goto _26
  7210. _26:
  7211. ;
  7212. s1++
  7213. s2++
  7214. }
  7215. if int32(*(*TXML_Char)(unsafe.Pointer(s1))) == 0 {
  7216. return int32(_XML_ERROR_DUPLICATE_ATTRIBUTE)
  7217. }
  7218. }
  7219. if !(step != 0) {
  7220. step = uint8(uriHash & ^mask >> (libc.Int32FromUint8((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower)-libc.Int32FromInt32(1)) & (mask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  7221. }
  7222. if j1 < libc.Int32FromUint8(step) {
  7223. j1 = int32(uint32(j1) + (nsAttsSize - uint32(step)))
  7224. } else {
  7225. j1 -= libc.Int32FromUint8(step)
  7226. }
  7227. }
  7228. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets != 0 { /* append namespace separator and prefix */
  7229. *(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fptr + uintptr(-libc.Int32FromInt32(1)))) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  7230. s = (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fname
  7231. for {
  7232. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  7233. v30 = 0
  7234. } else {
  7235. v32 = parser + 784 + 24
  7236. v31 = *(*uintptr)(unsafe.Pointer(v32))
  7237. *(*uintptr)(unsafe.Pointer(v32))++
  7238. *(*TXML_Char)(unsafe.Pointer(v31)) = *(*TXML_Char)(unsafe.Pointer(s))
  7239. v30 = libc.Int32FromInt32(1)
  7240. }
  7241. if !(v30 != 0) {
  7242. return int32(_XML_ERROR_NO_MEMORY)
  7243. }
  7244. goto _29
  7245. _29:
  7246. ;
  7247. v28 = s
  7248. s++
  7249. if !(*(*TXML_Char)(unsafe.Pointer(v28)) != 0) {
  7250. break
  7251. }
  7252. }
  7253. }
  7254. /* store expanded name in attribute list */
  7255. s = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  7256. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  7257. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8)) = s
  7258. /* fill empty slot with new version, uriName and hash value */
  7259. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fversion = version
  7260. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fhash = uriHash
  7261. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).FuriName = s
  7262. nPrefixes--
  7263. v33 = nPrefixes
  7264. if !(v33 != 0) {
  7265. i += int32(2)
  7266. break
  7267. }
  7268. } else { /* not prefixed */
  7269. *(*TXML_Char)(unsafe.Pointer(s + uintptr(-libc.Int32FromInt32(1)))) = 0
  7270. } /* clear flag */
  7271. goto _15
  7272. _15:
  7273. ;
  7274. i += int32(2)
  7275. }
  7276. }
  7277. /* clear flags for the remaining attributes */
  7278. for {
  7279. if !(i < attIndex) {
  7280. break
  7281. }
  7282. *(*TXML_Char)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8)) + uintptr(-libc.Int32FromInt32(1)))) = 0
  7283. goto _34
  7284. _34:
  7285. ;
  7286. i += int32(2)
  7287. }
  7288. binding = *(*uintptr)(unsafe.Pointer(bindingsPtr))
  7289. for {
  7290. if !(binding != 0) {
  7291. break
  7292. }
  7293. *(*TXML_Char)(unsafe.Pointer((*Tattribute_id)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).FattId)).Fname + uintptr(-libc.Int32FromInt32(1)))) = 0
  7294. goto _35
  7295. _35:
  7296. ;
  7297. binding = (*TBINDING)(unsafe.Pointer(binding)).FnextTagBinding
  7298. }
  7299. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0) {
  7300. return int32(_XML_ERROR_NONE)
  7301. }
  7302. /* expand the element type name */
  7303. if (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fprefix != 0 {
  7304. binding = (*TPREFIX)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fprefix)).Fbinding
  7305. if !(binding != 0) {
  7306. return int32(_XML_ERROR_UNBOUND_PREFIX)
  7307. }
  7308. localPart = (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr
  7309. for {
  7310. v36 = localPart
  7311. localPart++
  7312. if !(int32(*(*TXML_Char)(unsafe.Pointer(v36))) != int32(m_ASCII_COLON)) {
  7313. break
  7314. }
  7315. }
  7316. } else {
  7317. if (*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding != 0 {
  7318. binding = (*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding
  7319. localPart = (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr
  7320. } else {
  7321. return int32(_XML_ERROR_NONE)
  7322. }
  7323. }
  7324. prefixLen = 0
  7325. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets != 0 && (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname != 0 {
  7326. for {
  7327. v38 = prefixLen
  7328. prefixLen++
  7329. if !(*(*TXML_Char)(unsafe.Pointer((*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname + uintptr(v38))) != 0) {
  7330. break
  7331. }
  7332. goto _37
  7333. _37:
  7334. } /* prefixLen includes null terminator */
  7335. }
  7336. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).FlocalPart = localPart
  7337. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).FuriLen = (*TBINDING)(unsafe.Pointer(binding)).FuriLen
  7338. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fprefix = (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname
  7339. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).FprefixLen = prefixLen
  7340. i = 0
  7341. for {
  7342. v40 = i
  7343. i++
  7344. if !(*(*TXML_Char)(unsafe.Pointer(localPart + uintptr(v40))) != 0) {
  7345. break
  7346. }
  7347. goto _39
  7348. _39:
  7349. } /* i includes null terminator */
  7350. /* Detect and prevent integer overflow */
  7351. if (*TBINDING)(unsafe.Pointer(binding)).FuriLen > int32(m___INT_MAX__)-prefixLen || i > int32(m___INT_MAX__)-((*TBINDING)(unsafe.Pointer(binding)).FuriLen+prefixLen) {
  7352. return int32(_XML_ERROR_NO_MEMORY)
  7353. }
  7354. n = i + (*TBINDING)(unsafe.Pointer(binding)).FuriLen + prefixLen
  7355. if n > (*TBINDING)(unsafe.Pointer(binding)).FuriAlloc {
  7356. /* Detect and prevent integer overflow */
  7357. if n > libc.Int32FromInt32(m___INT_MAX__)-libc.Int32FromInt32(m_EXPAND_SPARE) {
  7358. return int32(_XML_ERROR_NO_MEMORY)
  7359. }
  7360. /* Detect and prevent integer overflow.
  7361. * The preprocessor guard addresses the "always false" warning
  7362. * from -Wtype-limits on platforms where
  7363. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  7364. uri = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32(n+libc.Int32FromInt32(m_EXPAND_SPARE))*libc.Uint64FromInt64(1))
  7365. if !(uri != 0) {
  7366. return int32(_XML_ERROR_NO_MEMORY)
  7367. }
  7368. (*TBINDING)(unsafe.Pointer(binding)).FuriAlloc = n + int32(m_EXPAND_SPARE)
  7369. libc.X__builtin___memcpy_chk(tls, uri, (*TBINDING)(unsafe.Pointer(binding)).Furi, libc.Uint64FromInt32((*TBINDING)(unsafe.Pointer(binding)).FuriLen)*uint64(1), ^t__predefined_size_t(0))
  7370. p = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  7371. for {
  7372. if !(p != 0) {
  7373. break
  7374. }
  7375. if (*TTAG)(unsafe.Pointer(p)).Fname.Fstr == (*TBINDING)(unsafe.Pointer(binding)).Furi {
  7376. (*TTAG)(unsafe.Pointer(p)).Fname.Fstr = uri
  7377. }
  7378. goto _41
  7379. _41:
  7380. ;
  7381. p = (*TTAG)(unsafe.Pointer(p)).Fparent
  7382. }
  7383. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TBINDING)(unsafe.Pointer(binding)).Furi)
  7384. (*TBINDING)(unsafe.Pointer(binding)).Furi = uri
  7385. }
  7386. /* if m_namespaceSeparator != '\0' then uri includes it already */
  7387. uri = (*TBINDING)(unsafe.Pointer(binding)).Furi + uintptr((*TBINDING)(unsafe.Pointer(binding)).FuriLen)
  7388. libc.X__builtin___memcpy_chk(tls, uri, localPart, libc.Uint64FromInt32(i)*uint64(1), ^t__predefined_size_t(0))
  7389. /* we always have a namespace separator between localPart and prefix */
  7390. if prefixLen != 0 {
  7391. uri += uintptr(i - int32(1))
  7392. *(*TXML_Char)(unsafe.Pointer(uri)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator /* replace null terminator */
  7393. libc.X__builtin___memcpy_chk(tls, uri+uintptr(1), (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname, libc.Uint64FromInt32(prefixLen)*uint64(1), ^t__predefined_size_t(0))
  7394. }
  7395. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr = (*TBINDING)(unsafe.Pointer(binding)).Furi
  7396. return int32(_XML_ERROR_NONE)
  7397. }
  7398. func _is_rfc3986_uri_char(tls *libc.TLS, candidate TXML_Char) (r TXML_Bool) {
  7399. // For the RFC 3986 ANBF grammar see
  7400. // https://datatracker.ietf.org/doc/html/rfc3986#appendix-A
  7401. switch int32(candidate) {
  7402. // From rule "ALPHA" (uppercase half)
  7403. case int32('A'):
  7404. fallthrough
  7405. case int32('B'):
  7406. fallthrough
  7407. case int32('C'):
  7408. fallthrough
  7409. case int32('D'):
  7410. fallthrough
  7411. case int32('E'):
  7412. fallthrough
  7413. case int32('F'):
  7414. fallthrough
  7415. case int32('G'):
  7416. fallthrough
  7417. case int32('H'):
  7418. fallthrough
  7419. case int32('I'):
  7420. fallthrough
  7421. case int32('J'):
  7422. fallthrough
  7423. case int32('K'):
  7424. fallthrough
  7425. case int32('L'):
  7426. fallthrough
  7427. case int32('M'):
  7428. fallthrough
  7429. case int32('N'):
  7430. fallthrough
  7431. case int32('O'):
  7432. fallthrough
  7433. case int32('P'):
  7434. fallthrough
  7435. case int32('Q'):
  7436. fallthrough
  7437. case int32('R'):
  7438. fallthrough
  7439. case int32('S'):
  7440. fallthrough
  7441. case int32('T'):
  7442. fallthrough
  7443. case int32('U'):
  7444. fallthrough
  7445. case int32('V'):
  7446. fallthrough
  7447. case int32('W'):
  7448. fallthrough
  7449. case int32('X'):
  7450. fallthrough
  7451. case int32('Y'):
  7452. fallthrough
  7453. case int32('Z'):
  7454. // From rule "ALPHA" (lowercase half)
  7455. fallthrough
  7456. case int32('a'):
  7457. fallthrough
  7458. case int32('b'):
  7459. fallthrough
  7460. case int32('c'):
  7461. fallthrough
  7462. case int32('d'):
  7463. fallthrough
  7464. case int32('e'):
  7465. fallthrough
  7466. case int32('f'):
  7467. fallthrough
  7468. case int32('g'):
  7469. fallthrough
  7470. case int32('h'):
  7471. fallthrough
  7472. case int32('i'):
  7473. fallthrough
  7474. case int32('j'):
  7475. fallthrough
  7476. case int32('k'):
  7477. fallthrough
  7478. case int32('l'):
  7479. fallthrough
  7480. case int32('m'):
  7481. fallthrough
  7482. case int32('n'):
  7483. fallthrough
  7484. case int32('o'):
  7485. fallthrough
  7486. case int32('p'):
  7487. fallthrough
  7488. case int32('q'):
  7489. fallthrough
  7490. case int32('r'):
  7491. fallthrough
  7492. case int32('s'):
  7493. fallthrough
  7494. case int32('t'):
  7495. fallthrough
  7496. case int32('u'):
  7497. fallthrough
  7498. case int32('v'):
  7499. fallthrough
  7500. case int32('w'):
  7501. fallthrough
  7502. case int32('x'):
  7503. fallthrough
  7504. case int32('y'):
  7505. fallthrough
  7506. case int32('z'):
  7507. // From rule "DIGIT"
  7508. fallthrough
  7509. case int32('0'):
  7510. fallthrough
  7511. case int32('1'):
  7512. fallthrough
  7513. case int32('2'):
  7514. fallthrough
  7515. case int32('3'):
  7516. fallthrough
  7517. case int32('4'):
  7518. fallthrough
  7519. case int32('5'):
  7520. fallthrough
  7521. case int32('6'):
  7522. fallthrough
  7523. case int32('7'):
  7524. fallthrough
  7525. case int32('8'):
  7526. fallthrough
  7527. case int32('9'):
  7528. // From rule "pct-encoded"
  7529. fallthrough
  7530. case int32('%'):
  7531. // From rule "unreserved"
  7532. fallthrough
  7533. case int32('-'):
  7534. fallthrough
  7535. case int32('.'):
  7536. fallthrough
  7537. case int32('_'):
  7538. fallthrough
  7539. case int32('~'):
  7540. // From rule "gen-delims"
  7541. fallthrough
  7542. case int32(':'):
  7543. fallthrough
  7544. case int32('/'):
  7545. fallthrough
  7546. case int32('?'):
  7547. fallthrough
  7548. case int32('#'):
  7549. fallthrough
  7550. case int32('['):
  7551. fallthrough
  7552. case int32(']'):
  7553. fallthrough
  7554. case int32('@'):
  7555. // From rule "sub-delims"
  7556. fallthrough
  7557. case int32('!'):
  7558. fallthrough
  7559. case int32('$'):
  7560. fallthrough
  7561. case int32('&'):
  7562. fallthrough
  7563. case int32('\''):
  7564. fallthrough
  7565. case int32('('):
  7566. fallthrough
  7567. case int32(')'):
  7568. fallthrough
  7569. case int32('*'):
  7570. fallthrough
  7571. case int32('+'):
  7572. fallthrough
  7573. case int32(','):
  7574. fallthrough
  7575. case int32(';'):
  7576. fallthrough
  7577. case int32('='):
  7578. return libc.Uint8FromInt32(1)
  7579. default:
  7580. return libc.Uint8FromInt32(0)
  7581. }
  7582. return r
  7583. }
  7584. // C documentation
  7585. //
  7586. // /* addBinding() overwrites the value of prefix->binding without checking.
  7587. // Therefore one must keep track of the old value outside of addBinding().
  7588. // */
  7589. func _addBinding(tls *libc.TLS, parser TXML_Parser, prefix uintptr, attId uintptr, uri uintptr, bindingsPtr uintptr) (r _XML_Error) {
  7590. var b, temp, v3 uintptr
  7591. var isXML, isXMLNS, mustBeXML TXML_Bool
  7592. var len1, v2 int32
  7593. _, _, _, _, _, _, _, _ = b, isXML, isXMLNS, len1, mustBeXML, temp, v2, v3
  7594. mustBeXML = libc.Uint8FromInt32(0)
  7595. isXML = libc.Uint8FromInt32(1)
  7596. isXMLNS = libc.Uint8FromInt32(1)
  7597. /* empty URI is only valid for default namespace per XML NS 1.0 (not 1.1) */
  7598. if int32(*(*TXML_Char)(unsafe.Pointer(uri))) == int32('\000') && (*TPREFIX)(unsafe.Pointer(prefix)).Fname != 0 {
  7599. return int32(_XML_ERROR_UNDECLARING_PREFIX)
  7600. }
  7601. if (*TPREFIX)(unsafe.Pointer(prefix)).Fname != 0 && int32(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname))) == int32(m_ASCII_x) && int32(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 1))) == int32(m_ASCII_m) && int32(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 2))) == int32(m_ASCII_l) {
  7602. /* Not allowed to bind xmlns */
  7603. if int32(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 3))) == int32(m_ASCII_n) && int32(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 4))) == int32(m_ASCII_s) && int32(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 5))) == int32('\000') {
  7604. return int32(_XML_ERROR_RESERVED_PREFIX_XMLNS)
  7605. }
  7606. if int32(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 3))) == int32('\000') {
  7607. mustBeXML = libc.Uint8FromInt32(1)
  7608. }
  7609. }
  7610. len1 = 0
  7611. for {
  7612. if !(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1))) != 0) {
  7613. break
  7614. }
  7615. if isXML != 0 && (len1 > _xmlLen || int32(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) != int32(_xmlNamespace[len1])) {
  7616. isXML = libc.Uint8FromInt32(0)
  7617. }
  7618. if !(mustBeXML != 0) && isXMLNS != 0 && (len1 > _xmlnsLen || int32(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) != int32(_xmlnsNamespace[len1])) {
  7619. isXMLNS = libc.Uint8FromInt32(0)
  7620. }
  7621. // NOTE: While Expat does not validate namespace URIs against RFC 3986
  7622. // today (and is not REQUIRED to do so with regard to the XML 1.0
  7623. // namespaces specification) we have to at least make sure, that
  7624. // the application on top of Expat (that is likely splitting expanded
  7625. // element names ("qualified names") of form
  7626. // "[uri sep] local [sep prefix] '\0'" back into 1, 2 or 3 pieces
  7627. // in its element handler code) cannot be confused by an attacker
  7628. // putting additional namespace separator characters into namespace
  7629. // declarations. That would be ambiguous and not to be expected.
  7630. //
  7631. // While the HTML API docs of function XML_ParserCreateNS have been
  7632. // advising against use of a namespace separator character that can
  7633. // appear in a URI for >20 years now, some widespread applications
  7634. // are using URI characters (':' (colon) in particular) for a
  7635. // namespace separator, in practice. To keep these applications
  7636. // functional, we only reject namespaces URIs containing the
  7637. // application-chosen namespace separator if the chosen separator
  7638. // is a non-URI character with regard to RFC 3986.
  7639. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 && int32(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) == int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator) && !(_is_rfc3986_uri_char(tls, *(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) != 0) {
  7640. return int32(_XML_ERROR_SYNTAX)
  7641. }
  7642. goto _1
  7643. _1:
  7644. ;
  7645. len1++
  7646. }
  7647. isXML = libc.BoolUint8(isXML != 0 && len1 == _xmlLen)
  7648. isXMLNS = libc.BoolUint8(isXMLNS != 0 && len1 == _xmlnsLen)
  7649. if libc.Int32FromUint8(mustBeXML) != libc.Int32FromUint8(isXML) {
  7650. if mustBeXML != 0 {
  7651. v2 = int32(_XML_ERROR_RESERVED_PREFIX_XML)
  7652. } else {
  7653. v2 = int32(_XML_ERROR_RESERVED_NAMESPACE_URI)
  7654. }
  7655. return v2
  7656. }
  7657. if isXMLNS != 0 {
  7658. return int32(_XML_ERROR_RESERVED_NAMESPACE_URI)
  7659. }
  7660. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  7661. len1++
  7662. }
  7663. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList != 0 {
  7664. b = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  7665. if len1 > (*TBINDING)(unsafe.Pointer(b)).FuriAlloc {
  7666. /* Detect and prevent integer overflow */
  7667. if len1 > libc.Int32FromInt32(m___INT_MAX__)-libc.Int32FromInt32(m_EXPAND_SPARE) {
  7668. return int32(_XML_ERROR_NO_MEMORY)
  7669. }
  7670. /* Detect and prevent integer overflow.
  7671. * The preprocessor guard addresses the "always false" warning
  7672. * from -Wtype-limits on platforms where
  7673. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  7674. temp = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TBINDING)(unsafe.Pointer(b)).Furi, libc.Uint64FromInt64(1)*libc.Uint64FromInt32(len1+libc.Int32FromInt32(m_EXPAND_SPARE)))
  7675. if temp == libc.UintptrFromInt32(0) {
  7676. return int32(_XML_ERROR_NO_MEMORY)
  7677. }
  7678. (*TBINDING)(unsafe.Pointer(b)).Furi = temp
  7679. (*TBINDING)(unsafe.Pointer(b)).FuriAlloc = len1 + int32(m_EXPAND_SPARE)
  7680. }
  7681. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding
  7682. } else {
  7683. b = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(48))
  7684. if !(b != 0) {
  7685. return int32(_XML_ERROR_NO_MEMORY)
  7686. }
  7687. /* Detect and prevent integer overflow */
  7688. if len1 > libc.Int32FromInt32(m___INT_MAX__)-libc.Int32FromInt32(m_EXPAND_SPARE) {
  7689. return int32(_XML_ERROR_NO_MEMORY)
  7690. }
  7691. /* Detect and prevent integer overflow.
  7692. * The preprocessor guard addresses the "always false" warning
  7693. * from -Wtype-limits on platforms where
  7694. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  7695. (*TBINDING)(unsafe.Pointer(b)).Furi = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(1)*libc.Uint64FromInt32(len1+libc.Int32FromInt32(m_EXPAND_SPARE)))
  7696. if !((*TBINDING)(unsafe.Pointer(b)).Furi != 0) {
  7697. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, b)
  7698. return int32(_XML_ERROR_NO_MEMORY)
  7699. }
  7700. (*TBINDING)(unsafe.Pointer(b)).FuriAlloc = len1 + int32(m_EXPAND_SPARE)
  7701. }
  7702. (*TBINDING)(unsafe.Pointer(b)).FuriLen = len1
  7703. libc.X__builtin___memcpy_chk(tls, (*TBINDING)(unsafe.Pointer(b)).Furi, uri, libc.Uint64FromInt32(len1)*uint64(1), ^t__predefined_size_t(0))
  7704. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  7705. *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Furi + uintptr(len1-int32(1)))) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  7706. }
  7707. (*TBINDING)(unsafe.Pointer(b)).Fprefix = prefix
  7708. (*TBINDING)(unsafe.Pointer(b)).FattId = attId
  7709. (*TBINDING)(unsafe.Pointer(b)).FprevPrefixBinding = (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding
  7710. /* NULL binding when default namespace undeclared */
  7711. if int32(*(*TXML_Char)(unsafe.Pointer(uri))) == int32('\000') && prefix == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd+304 {
  7712. (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding = libc.UintptrFromInt32(0)
  7713. } else {
  7714. (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding = b
  7715. }
  7716. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = *(*uintptr)(unsafe.Pointer(bindingsPtr))
  7717. *(*uintptr)(unsafe.Pointer(bindingsPtr)) = b
  7718. /* if attId == NULL then we are not starting a namespace scope */
  7719. if attId != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler != 0 {
  7720. if (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding != 0 {
  7721. v3 = uri
  7722. } else {
  7723. v3 = uintptr(0)
  7724. }
  7725. (*(*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)
  7726. }
  7727. return int32(_XML_ERROR_NONE)
  7728. }
  7729. // "http://www.w3.org/XML/1998/namespace"
  7730. var _xmlNamespace = [37]TXML_Char{
  7731. 0: int8(m_ASCII_h),
  7732. 1: int8(m_ASCII_t),
  7733. 2: int8(m_ASCII_t),
  7734. 3: int8(m_ASCII_p),
  7735. 4: int8(m_ASCII_COLON),
  7736. 5: int8(m_ASCII_SLASH),
  7737. 6: int8(m_ASCII_SLASH),
  7738. 7: int8(m_ASCII_w),
  7739. 8: int8(m_ASCII_w),
  7740. 9: int8(m_ASCII_w),
  7741. 10: int8(m_ASCII_PERIOD),
  7742. 11: int8(m_ASCII_w),
  7743. 12: int8(m_ASCII_3),
  7744. 13: int8(m_ASCII_PERIOD),
  7745. 14: int8(m_ASCII_o),
  7746. 15: int8(m_ASCII_r),
  7747. 16: int8(m_ASCII_g),
  7748. 17: int8(m_ASCII_SLASH),
  7749. 18: int8(m_ASCII_X),
  7750. 19: int8(m_ASCII_M),
  7751. 20: int8(m_ASCII_L),
  7752. 21: int8(m_ASCII_SLASH),
  7753. 22: int8(m_ASCII_1),
  7754. 23: int8(m_ASCII_9),
  7755. 24: int8(m_ASCII_9),
  7756. 25: int8(m_ASCII_8),
  7757. 26: int8(m_ASCII_SLASH),
  7758. 27: int8(m_ASCII_n),
  7759. 28: int8(m_ASCII_a),
  7760. 29: int8(m_ASCII_m),
  7761. 30: int8(m_ASCII_e),
  7762. 31: int8(m_ASCII_s),
  7763. 32: int8(m_ASCII_p),
  7764. 33: int8(m_ASCII_a),
  7765. 34: int8(m_ASCII_c),
  7766. 35: int8(m_ASCII_e),
  7767. }
  7768. var _xmlLen = libc.Int32FromUint64(libc.Uint64FromInt32(libc.Int32FromInt64(37))/libc.Uint64FromInt64(1) - libc.Uint64FromInt32(1))
  7769. // "http://www.w3.org/2000/xmlns/"
  7770. var _xmlnsNamespace = [30]TXML_Char{
  7771. 0: int8(m_ASCII_h),
  7772. 1: int8(m_ASCII_t),
  7773. 2: int8(m_ASCII_t),
  7774. 3: int8(m_ASCII_p),
  7775. 4: int8(m_ASCII_COLON),
  7776. 5: int8(m_ASCII_SLASH),
  7777. 6: int8(m_ASCII_SLASH),
  7778. 7: int8(m_ASCII_w),
  7779. 8: int8(m_ASCII_w),
  7780. 9: int8(m_ASCII_w),
  7781. 10: int8(m_ASCII_PERIOD),
  7782. 11: int8(m_ASCII_w),
  7783. 12: int8(m_ASCII_3),
  7784. 13: int8(m_ASCII_PERIOD),
  7785. 14: int8(m_ASCII_o),
  7786. 15: int8(m_ASCII_r),
  7787. 16: int8(m_ASCII_g),
  7788. 17: int8(m_ASCII_SLASH),
  7789. 18: int8(m_ASCII_2),
  7790. 19: int8(m_ASCII_0),
  7791. 20: int8(m_ASCII_0),
  7792. 21: int8(m_ASCII_0),
  7793. 22: int8(m_ASCII_SLASH),
  7794. 23: int8(m_ASCII_x),
  7795. 24: int8(m_ASCII_m),
  7796. 25: int8(m_ASCII_l),
  7797. 26: int8(m_ASCII_n),
  7798. 27: int8(m_ASCII_s),
  7799. 28: int8(m_ASCII_SLASH),
  7800. }
  7801. var _xmlnsLen = libc.Int32FromUint64(libc.Uint64FromInt32(libc.Int32FromInt64(30))/libc.Uint64FromInt64(1) - libc.Uint64FromInt32(1))
  7802. // C documentation
  7803. //
  7804. // /* The idea here is to avoid using stack for each CDATA section when
  7805. // the whole file is parsed with one call.
  7806. // */
  7807. func _cdataSectionProcessor(tls *libc.TLS, parser TXML_Parser, _start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  7808. bp := tls.Alloc(16)
  7809. defer tls.Free(16)
  7810. *(*uintptr)(unsafe.Pointer(bp)) = _start
  7811. var result _XML_Error
  7812. _ = result
  7813. 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))
  7814. if result != int32(_XML_ERROR_NONE) {
  7815. return result
  7816. }
  7817. if *(*uintptr)(unsafe.Pointer(bp)) != 0 {
  7818. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 { /* we are parsing an external entity */
  7819. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityContentProcessor)
  7820. return _externalEntityContentProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, endPtr)
  7821. } else {
  7822. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_contentProcessor)
  7823. return _contentProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, endPtr)
  7824. }
  7825. }
  7826. return result
  7827. }
  7828. // C documentation
  7829. //
  7830. // /* startPtr gets set to non-null if the section is closed, and to null if
  7831. // the section is not yet closed.
  7832. // */
  7833. 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) {
  7834. bp := tls.Alloc(32)
  7835. defer tls.Free(32)
  7836. var charDataHandler TXML_CharacterDataHandler
  7837. var convert_res _XML_Convert_Result
  7838. var eventEndPP, eventPP, v3 uintptr
  7839. var tok int32
  7840. var _ /* c at bp+16 */ TXML_Char
  7841. var _ /* dataPtr at bp+24 */ uintptr
  7842. var _ /* next at bp+8 */ uintptr
  7843. var _ /* s at bp+0 */ uintptr
  7844. _, _, _, _, _, _ = charDataHandler, convert_res, eventEndPP, eventPP, tok, v3
  7845. *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(startPtr))
  7846. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  7847. eventPP = parser + 544
  7848. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  7849. eventEndPP = parser + 552
  7850. } else {
  7851. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  7852. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  7853. }
  7854. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  7855. *(*uintptr)(unsafe.Pointer(startPtr)) = libc.UintptrFromInt32(0)
  7856. for {
  7857. *(*uintptr)(unsafe.Pointer(bp + 8)) = *(*uintptr)(unsafe.Pointer(bp)) /* in case of XML_TOK_NONE or XML_TOK_PARTIAL */
  7858. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 2*8))})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+8)
  7859. if !(_accountingDiffTolerated(tls, parser, tok, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)), int32(4044), account) != 0) {
  7860. _accountingOnAbort(tls, parser)
  7861. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  7862. }
  7863. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  7864. switch tok {
  7865. case int32(m_XML_TOK_CDATA_SECT_CLOSE):
  7866. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler != 0 {
  7867. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg)
  7868. } else {
  7869. if libc.Bool(0 != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  7870. (*(*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)
  7871. } else {
  7872. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7873. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  7874. }
  7875. }
  7876. }
  7877. *(*uintptr)(unsafe.Pointer(startPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  7878. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  7879. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  7880. return int32(_XML_ERROR_ABORTED)
  7881. } else {
  7882. return int32(_XML_ERROR_NONE)
  7883. }
  7884. fallthrough
  7885. case int32(m_XML_TOK_DATA_NEWLINE):
  7886. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  7887. *(*TXML_Char)(unsafe.Pointer(bp + 16)) = int8(0xA)
  7888. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, bp+16, int32(1))
  7889. } else {
  7890. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7891. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  7892. }
  7893. }
  7894. case int32(m_XML_TOK_DATA_CHARS):
  7895. charDataHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler
  7896. if charDataHandler != 0 {
  7897. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  7898. for {
  7899. *(*uintptr)(unsafe.Pointer(bp + 24)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  7900. convert_res = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, *(*uintptr)(unsafe.Pointer(bp + 8)), bp+24, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd)
  7901. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  7902. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{charDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf, int32(int64(*(*uintptr)(unsafe.Pointer(bp + 24)))-int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf)))
  7903. if convert_res == int32(_XML_CONVERT_COMPLETED) || convert_res == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  7904. break
  7905. }
  7906. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  7907. goto _2
  7908. _2:
  7909. }
  7910. } else {
  7911. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{charDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, *(*uintptr)(unsafe.Pointer(bp)), int32(int64(*(*uintptr)(unsafe.Pointer(bp + 8)))-int64(*(*uintptr)(unsafe.Pointer(bp)))))
  7912. }
  7913. } else {
  7914. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7915. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  7916. }
  7917. }
  7918. case m_XML_TOK_INVALID:
  7919. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  7920. return int32(_XML_ERROR_INVALID_TOKEN)
  7921. case -int32(2):
  7922. if haveMore != 0 {
  7923. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  7924. return int32(_XML_ERROR_NONE)
  7925. }
  7926. return int32(_XML_ERROR_PARTIAL_CHAR)
  7927. case -int32(1):
  7928. fallthrough
  7929. case -int32(4):
  7930. if haveMore != 0 {
  7931. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  7932. return int32(_XML_ERROR_NONE)
  7933. }
  7934. return int32(_XML_ERROR_UNCLOSED_CDATA_SECTION)
  7935. default:
  7936. /* Every token returned by XmlCdataSectionTok() has its own
  7937. * explicit case, so this default case will never be executed.
  7938. * We retain it as a safety net and exclude it from the coverage
  7939. * statistics.
  7940. *
  7941. * LCOV_EXCL_START
  7942. */
  7943. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  7944. return int32(_XML_ERROR_UNEXPECTED_STATE)
  7945. /* LCOV_EXCL_STOP */
  7946. }
  7947. v3 = *(*uintptr)(unsafe.Pointer(bp + 8))
  7948. *(*uintptr)(unsafe.Pointer(bp)) = v3
  7949. *(*uintptr)(unsafe.Pointer(eventPP)) = v3
  7950. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  7951. case int32(_XML_SUSPENDED):
  7952. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  7953. return int32(_XML_ERROR_NONE)
  7954. case int32(_XML_FINISHED):
  7955. return int32(_XML_ERROR_ABORTED)
  7956. default:
  7957. }
  7958. goto _1
  7959. _1:
  7960. }
  7961. /* not reached */
  7962. return r
  7963. }
  7964. // C documentation
  7965. //
  7966. // /* The idea here is to avoid using stack for each IGNORE section when
  7967. // the whole file is parsed with one call.
  7968. // */
  7969. func _ignoreSectionProcessor(tls *libc.TLS, parser TXML_Parser, _start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  7970. bp := tls.Alloc(16)
  7971. defer tls.Free(16)
  7972. *(*uintptr)(unsafe.Pointer(bp)) = _start
  7973. var result _XML_Error
  7974. _ = result
  7975. 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)))
  7976. if result != int32(_XML_ERROR_NONE) {
  7977. return result
  7978. }
  7979. if *(*uintptr)(unsafe.Pointer(bp)) != 0 {
  7980. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  7981. return _prologProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, endPtr)
  7982. }
  7983. return result
  7984. }
  7985. // C documentation
  7986. //
  7987. // /* startPtr gets set to non-null is the section is closed, and to null
  7988. // if the section is not yet closed.
  7989. // */
  7990. func _doIgnoreSection(tls *libc.TLS, parser TXML_Parser, enc uintptr, startPtr uintptr, end uintptr, nextPtr uintptr, haveMore TXML_Bool) (r _XML_Error) {
  7991. bp := tls.Alloc(16)
  7992. defer tls.Free(16)
  7993. var eventEndPP, eventPP, s uintptr
  7994. var tok int32
  7995. var _ /* next at bp+0 */ uintptr
  7996. _, _, _, _ = eventEndPP, eventPP, s, tok
  7997. *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(startPtr))
  7998. s = *(*uintptr)(unsafe.Pointer(startPtr))
  7999. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8000. eventPP = parser + 544
  8001. *(*uintptr)(unsafe.Pointer(eventPP)) = s
  8002. eventEndPP = parser + 552
  8003. } else {
  8004. /* It's not entirely clear, but it seems the following two lines
  8005. * of code cannot be executed. The only occasions on which 'enc'
  8006. * is not 'encoding' are when this function is called
  8007. * from the internal entity processing, and IGNORE sections are an
  8008. * error in internal entities.
  8009. *
  8010. * Since it really isn't clear that this is true, we keep the code
  8011. * and just remove it from our coverage tests.
  8012. *
  8013. * LCOV_EXCL_START
  8014. */
  8015. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  8016. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  8017. /* LCOV_EXCL_STOP */
  8018. }
  8019. *(*uintptr)(unsafe.Pointer(eventPP)) = s
  8020. *(*uintptr)(unsafe.Pointer(startPtr)) = libc.UintptrFromInt32(0)
  8021. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 3*8))})))(tls, enc, s, end, bp)
  8022. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4196), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  8023. _accountingOnAbort(tls, parser)
  8024. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  8025. }
  8026. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  8027. switch tok {
  8028. case int32(m_XML_TOK_IGNORE_SECT):
  8029. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  8030. _reportDefault(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  8031. }
  8032. *(*uintptr)(unsafe.Pointer(startPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  8033. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  8034. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  8035. return int32(_XML_ERROR_ABORTED)
  8036. } else {
  8037. return int32(_XML_ERROR_NONE)
  8038. }
  8039. fallthrough
  8040. case m_XML_TOK_INVALID:
  8041. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  8042. return int32(_XML_ERROR_INVALID_TOKEN)
  8043. case -int32(2):
  8044. if haveMore != 0 {
  8045. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  8046. return int32(_XML_ERROR_NONE)
  8047. }
  8048. return int32(_XML_ERROR_PARTIAL_CHAR)
  8049. case -int32(1):
  8050. fallthrough
  8051. case -int32(4):
  8052. if haveMore != 0 {
  8053. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  8054. return int32(_XML_ERROR_NONE)
  8055. }
  8056. return int32(_XML_ERROR_SYNTAX) /* XML_ERROR_UNCLOSED_IGNORE_SECTION */
  8057. default:
  8058. /* All of the tokens that XmlIgnoreSectionTok() returns have
  8059. * explicit cases to handle them, so this default case is never
  8060. * executed. We keep it as a safety net anyway, and remove it
  8061. * from our test coverage statistics.
  8062. *
  8063. * LCOV_EXCL_START
  8064. */
  8065. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  8066. return int32(_XML_ERROR_UNEXPECTED_STATE)
  8067. /* LCOV_EXCL_STOP */
  8068. }
  8069. /* not reached */
  8070. return r
  8071. }
  8072. func _initializeEncoding(tls *libc.TLS, parser TXML_Parser) (r _XML_Error) {
  8073. var s uintptr
  8074. var v1 func(*libc.TLS, uintptr, uintptr, uintptr) int32
  8075. _, _ = s, v1
  8076. s = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName
  8077. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  8078. v1 = XXmlInitEncodingNS
  8079. } else {
  8080. v1 = XXmlInitEncoding
  8081. }
  8082. if v1(tls, parser+296, parser+288, s) != 0 {
  8083. return int32(_XML_ERROR_NONE)
  8084. }
  8085. return _handleUnknownEncoding(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName)
  8086. }
  8087. func _processXmlDecl(tls *libc.TLS, parser TXML_Parser, isGeneralTextEntity int32, s uintptr, next uintptr) (r _XML_Error) {
  8088. bp := tls.Alloc(48)
  8089. defer tls.Free(48)
  8090. var result _XML_Error
  8091. var storedEncName, storedversion uintptr
  8092. var v1 func(*libc.TLS, int32, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr) int32
  8093. var _ /* encodingName at bp+0 */ uintptr
  8094. var _ /* newEncoding at bp+8 */ uintptr
  8095. var _ /* standalone at bp+32 */ int32
  8096. var _ /* version at bp+16 */ uintptr
  8097. var _ /* versionend at bp+24 */ uintptr
  8098. _, _, _, _ = result, storedEncName, storedversion, v1
  8099. *(*uintptr)(unsafe.Pointer(bp)) = libc.UintptrFromInt32(0)
  8100. storedEncName = libc.UintptrFromInt32(0)
  8101. *(*uintptr)(unsafe.Pointer(bp + 8)) = libc.UintptrFromInt32(0)
  8102. *(*uintptr)(unsafe.Pointer(bp + 16)) = libc.UintptrFromInt32(0)
  8103. *(*uintptr)(unsafe.Pointer(bp + 24)) = libc.UintptrFromInt32(0)
  8104. storedversion = libc.UintptrFromInt32(0)
  8105. *(*int32)(unsafe.Pointer(bp + 32)) = -int32(1)
  8106. if !(_accountingDiffTolerated(tls, parser, int32(m_XML_TOK_XML_DECL), s, next, int32(4288), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  8107. _accountingOnAbort(tls, parser)
  8108. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  8109. }
  8110. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  8111. v1 = XXmlParseXmlDeclNS
  8112. } else {
  8113. v1 = XXmlParseXmlDecl
  8114. }
  8115. if !(v1(tls, isGeneralTextEntity, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, next, parser+544, bp+16, bp+24, bp, bp+8, bp+32) != 0) {
  8116. if isGeneralTextEntity != 0 {
  8117. return int32(_XML_ERROR_TEXT_DECL)
  8118. } else {
  8119. return int32(_XML_ERROR_XML_DECL)
  8120. }
  8121. }
  8122. if !(isGeneralTextEntity != 0) && *(*int32)(unsafe.Pointer(bp + 32)) == int32(1) {
  8123. (*TDTD)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd)).Fstandalone = libc.Uint8FromInt32(1)
  8124. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing == int32(_XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE) {
  8125. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = int32(_XML_PARAM_ENTITY_PARSING_NEVER)
  8126. }
  8127. }
  8128. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler != 0 {
  8129. if *(*uintptr)(unsafe.Pointer(bp)) != libc.UintptrFromInt32(0) {
  8130. storedEncName = _poolStoreString(tls, parser+832, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp))+uintptr((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FnameLength})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, *(*uintptr)(unsafe.Pointer(bp)))))
  8131. if !(storedEncName != 0) {
  8132. return int32(_XML_ERROR_NO_MEMORY)
  8133. }
  8134. (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fptr
  8135. }
  8136. if *(*uintptr)(unsafe.Pointer(bp + 16)) != 0 {
  8137. storedversion = _poolStoreString(tls, parser+832, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, *(*uintptr)(unsafe.Pointer(bp + 16)), *(*uintptr)(unsafe.Pointer(bp + 24))-uintptr((*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FminBytesPerChar))
  8138. if !(storedversion != 0) {
  8139. return int32(_XML_ERROR_NO_MEMORY)
  8140. }
  8141. }
  8142. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, storedversion, storedEncName, *(*int32)(unsafe.Pointer(bp + 32)))
  8143. } else {
  8144. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  8145. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, next)
  8146. }
  8147. }
  8148. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName == libc.UintptrFromInt32(0) {
  8149. if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 {
  8150. /* Check that the specified encoding does not conflict with what
  8151. * the parser has already deduced. Do we have the same number
  8152. * of bytes in the smallest representation of a character? If
  8153. * this is UTF-16, is it the same endianness?
  8154. */
  8155. if (*TENCODING)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FminBytesPerChar != (*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FminBytesPerChar || (*TENCODING)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FminBytesPerChar == int32(2) && *(*uintptr)(unsafe.Pointer(bp + 8)) != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8156. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  8157. return int32(_XML_ERROR_INCORRECT_ENCODING)
  8158. }
  8159. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding = *(*uintptr)(unsafe.Pointer(bp + 8))
  8160. } else {
  8161. if *(*uintptr)(unsafe.Pointer(bp)) != 0 {
  8162. if !(storedEncName != 0) {
  8163. storedEncName = _poolStoreString(tls, parser+832, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp))+uintptr((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FnameLength})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, *(*uintptr)(unsafe.Pointer(bp)))))
  8164. if !(storedEncName != 0) {
  8165. return int32(_XML_ERROR_NO_MEMORY)
  8166. }
  8167. }
  8168. result = _handleUnknownEncoding(tls, parser, storedEncName)
  8169. _poolClear(tls, parser+832)
  8170. if result == int32(_XML_ERROR_UNKNOWN_ENCODING) {
  8171. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  8172. }
  8173. return result
  8174. }
  8175. }
  8176. }
  8177. if storedEncName != 0 || storedversion != 0 {
  8178. _poolClear(tls, parser+832)
  8179. }
  8180. return int32(_XML_ERROR_NONE)
  8181. }
  8182. func _handleUnknownEncoding(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) (r _XML_Error) {
  8183. bp := tls.Alloc(1056)
  8184. defer tls.Free(1056)
  8185. var enc uintptr
  8186. var i int32
  8187. var v2 func(*libc.TLS, uintptr, uintptr, TCONVERTER, uintptr) uintptr
  8188. var _ /* info at bp+0 */ TXML_Encoding
  8189. _, _, _ = enc, i, v2
  8190. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler != 0 {
  8191. i = 0
  8192. for {
  8193. if !(i < int32(256)) {
  8194. break
  8195. }
  8196. *(*int32)(unsafe.Pointer(bp + uintptr(i)*4)) = -int32(1)
  8197. goto _1
  8198. _1:
  8199. ;
  8200. i++
  8201. }
  8202. (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fconvert = libc.UintptrFromInt32(0)
  8203. (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata = libc.UintptrFromInt32(0)
  8204. (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease = libc.UintptrFromInt32(0)
  8205. 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 {
  8206. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32(XXmlSizeOfUnknownEncoding(tls)))
  8207. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem != 0) {
  8208. if (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease != 0 {
  8209. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease})))(tls, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata)
  8210. }
  8211. return int32(_XML_ERROR_NO_MEMORY)
  8212. }
  8213. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  8214. v2 = XXmlInitUnknownEncodingNS
  8215. } else {
  8216. v2 = XXmlInitUnknownEncoding
  8217. }
  8218. enc = v2(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem, bp, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fconvert, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata)
  8219. if enc != 0 {
  8220. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData = (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata
  8221. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease = (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease
  8222. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding = enc
  8223. return int32(_XML_ERROR_NONE)
  8224. }
  8225. }
  8226. if (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease != libc.UintptrFromInt32(0) {
  8227. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease})))(tls, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata)
  8228. }
  8229. }
  8230. return int32(_XML_ERROR_UNKNOWN_ENCODING)
  8231. }
  8232. func _prologInitProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  8233. var result _XML_Error
  8234. _ = result
  8235. result = _initializeEncoding(tls, parser)
  8236. if result != int32(_XML_ERROR_NONE) {
  8237. return result
  8238. }
  8239. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  8240. return _prologProcessor(tls, parser, s, end, nextPtr)
  8241. }
  8242. func _externalParEntInitProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  8243. var result _XML_Error
  8244. _ = result
  8245. result = _initializeEncoding(tls, parser)
  8246. if result != int32(_XML_ERROR_NONE) {
  8247. return result
  8248. }
  8249. /* we know now that XML_Parse(Buffer) has been called,
  8250. so we consider the external parameter entity read */
  8251. (*TDTD)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd)).FparamEntityRead = libc.Uint8FromInt32(1)
  8252. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue != 0 {
  8253. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_entityValueInitProcessor)
  8254. return _entityValueInitProcessor(tls, parser, s, end, nextPtr)
  8255. } else {
  8256. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalParEntProcessor)
  8257. return _externalParEntProcessor(tls, parser, s, end, nextPtr)
  8258. }
  8259. return r
  8260. }
  8261. func _entityValueInitProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  8262. bp := tls.Alloc(16)
  8263. defer tls.Free(16)
  8264. var result _XML_Error
  8265. var start uintptr
  8266. var tok int32
  8267. var _ /* next at bp+0 */ uintptr
  8268. _, _, _ = result, start, tok
  8269. start = s
  8270. *(*uintptr)(unsafe.Pointer(bp)) = start
  8271. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  8272. for {
  8273. 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)
  8274. /* Note: Except for XML_TOK_BOM below, these bytes are accounted later in:
  8275. - storeEntityValue
  8276. - processXmlDecl
  8277. */
  8278. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = *(*uintptr)(unsafe.Pointer(bp))
  8279. if tok <= 0 {
  8280. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) && tok != m_XML_TOK_INVALID {
  8281. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  8282. return int32(_XML_ERROR_NONE)
  8283. }
  8284. switch tok {
  8285. case m_XML_TOK_INVALID:
  8286. return int32(_XML_ERROR_INVALID_TOKEN)
  8287. case -int32(1):
  8288. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  8289. case -int32(2):
  8290. return int32(_XML_ERROR_PARTIAL_CHAR)
  8291. case -int32(4): /* start == end */
  8292. fallthrough
  8293. default:
  8294. break
  8295. }
  8296. /* found end of entity value - can store it now */
  8297. return _storeEntityValue(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, end, int32(_XML_ACCOUNT_DIRECT))
  8298. } else {
  8299. if tok == int32(m_XML_TOK_XML_DECL) {
  8300. result = _processXmlDecl(tls, parser, 0, start, *(*uintptr)(unsafe.Pointer(bp)))
  8301. if result != int32(_XML_ERROR_NONE) {
  8302. return result
  8303. }
  8304. /* At this point, m_parsingStatus.parsing cannot be XML_SUSPENDED. For
  8305. * that to happen, a parameter entity parsing handler must have attempted
  8306. * to suspend the parser, which fails and raises an error. The parser can
  8307. * be aborted, but can't be suspended.
  8308. */
  8309. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  8310. return int32(_XML_ERROR_ABORTED)
  8311. }
  8312. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  8313. /* stop scanning for text declaration - we found one */
  8314. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_entityValueProcessor)
  8315. return _entityValueProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, nextPtr)
  8316. } else {
  8317. if tok == int32(m_XML_TOK_BOM) && *(*uintptr)(unsafe.Pointer(bp)) == end && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  8318. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4495), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  8319. _accountingOnAbort(tls, parser)
  8320. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  8321. }
  8322. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  8323. return int32(_XML_ERROR_NONE)
  8324. } else {
  8325. if tok == int32(m_XML_TOK_INSTANCE_START) {
  8326. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  8327. return int32(_XML_ERROR_SYNTAX)
  8328. }
  8329. }
  8330. }
  8331. }
  8332. start = *(*uintptr)(unsafe.Pointer(bp))
  8333. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  8334. goto _1
  8335. _1:
  8336. }
  8337. return r
  8338. }
  8339. func _externalParEntProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  8340. bp := tls.Alloc(16)
  8341. defer tls.Free(16)
  8342. var tok int32
  8343. var _ /* next at bp+0 */ uintptr
  8344. _ = tok
  8345. *(*uintptr)(unsafe.Pointer(bp)) = s
  8346. 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)
  8347. if tok <= 0 {
  8348. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) && tok != m_XML_TOK_INVALID {
  8349. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  8350. return int32(_XML_ERROR_NONE)
  8351. }
  8352. switch tok {
  8353. case m_XML_TOK_INVALID:
  8354. return int32(_XML_ERROR_INVALID_TOKEN)
  8355. case -int32(1):
  8356. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  8357. case -int32(2):
  8358. return int32(_XML_ERROR_PARTIAL_CHAR)
  8359. case -int32(4): /* start == end */
  8360. fallthrough
  8361. default:
  8362. break
  8363. }
  8364. } else {
  8365. if tok == int32(m_XML_TOK_BOM) {
  8366. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4548), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  8367. _accountingOnAbort(tls, parser)
  8368. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  8369. }
  8370. s = *(*uintptr)(unsafe.Pointer(bp))
  8371. 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)
  8372. }
  8373. }
  8374. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  8375. 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))
  8376. }
  8377. func _entityValueProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  8378. bp := tls.Alloc(16)
  8379. defer tls.Free(16)
  8380. var enc, start uintptr
  8381. var tok int32
  8382. var _ /* next at bp+0 */ uintptr
  8383. _, _, _ = enc, start, tok
  8384. start = s
  8385. *(*uintptr)(unsafe.Pointer(bp)) = s
  8386. enc = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding
  8387. for {
  8388. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc))})))(tls, enc, start, end, bp)
  8389. /* Note: These bytes are accounted later in:
  8390. - storeEntityValue
  8391. */
  8392. if tok <= 0 {
  8393. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) && tok != m_XML_TOK_INVALID {
  8394. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  8395. return int32(_XML_ERROR_NONE)
  8396. }
  8397. switch tok {
  8398. case m_XML_TOK_INVALID:
  8399. return int32(_XML_ERROR_INVALID_TOKEN)
  8400. case -int32(1):
  8401. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  8402. case -int32(2):
  8403. return int32(_XML_ERROR_PARTIAL_CHAR)
  8404. case -int32(4): /* start == end */
  8405. fallthrough
  8406. default:
  8407. break
  8408. }
  8409. /* found end of entity value - can store it now */
  8410. return _storeEntityValue(tls, parser, enc, s, end, int32(_XML_ACCOUNT_DIRECT))
  8411. }
  8412. start = *(*uintptr)(unsafe.Pointer(bp))
  8413. goto _1
  8414. _1:
  8415. }
  8416. return r
  8417. }
  8418. func _prologProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  8419. bp := tls.Alloc(16)
  8420. defer tls.Free(16)
  8421. var tok int32
  8422. var _ /* next at bp+0 */ uintptr
  8423. _ = tok
  8424. *(*uintptr)(unsafe.Pointer(bp)) = s
  8425. 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)
  8426. 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))
  8427. }
  8428. 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) {
  8429. bp := tls.Alloc(16)
  8430. defer tls.Free(16)
  8431. *(*uintptr)(unsafe.Pointer(bp)) = _next
  8432. 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
  8433. var betweenDecl, hadParamEntityRefs, hadParamEntityRefs1, handleDefault TXML_Bool
  8434. var myindex, myindex1, role, v66, v69, v73, v76, v82, v84, v85 int32
  8435. var nameLen, v88 Tsize_t
  8436. var quant _XML_Content_Quant
  8437. var result, result1, result2, result3, result4, result5 _XML_Error
  8438. var v72, v79, v83 bool
  8439. var v81 uint32
  8440. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  8441. /* save one level of indirection */
  8442. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  8443. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8444. eventPP = parser + 544
  8445. eventEndPP = parser + 552
  8446. } else {
  8447. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  8448. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  8449. }
  8450. for {
  8451. handleDefault = libc.Uint8FromInt32(1)
  8452. *(*uintptr)(unsafe.Pointer(eventPP)) = s
  8453. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  8454. if tok <= 0 {
  8455. if haveMore != 0 && tok != m_XML_TOK_INVALID {
  8456. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  8457. return int32(_XML_ERROR_NONE)
  8458. }
  8459. switch tok {
  8460. case m_XML_TOK_INVALID:
  8461. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  8462. return int32(_XML_ERROR_INVALID_TOKEN)
  8463. case -int32(1):
  8464. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  8465. case -int32(2):
  8466. return int32(_XML_ERROR_PARTIAL_CHAR)
  8467. case -int32(m_XML_TOK_PROLOG_S):
  8468. tok = -tok
  8469. case -int32(4):
  8470. /* for internal PE NOT referenced between declarations */
  8471. if enc != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding && !((*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities)).FbetweenDecl != 0) {
  8472. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  8473. return int32(_XML_ERROR_NONE)
  8474. }
  8475. /* WFC: PE Between Declarations - must check that PE contains
  8476. complete markup, not only for external PEs, but also for
  8477. internal PEs if the reference occurs between declarations.
  8478. */
  8479. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0 || enc != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8480. if (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPROLOG_STATE)(unsafe.Pointer(parser + 496)).Fhandler})))(tls, parser+496, -int32(4), end, end, enc) == int32(_XML_ROLE_ERROR) {
  8481. return int32(_XML_ERROR_INCOMPLETE_PE)
  8482. }
  8483. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  8484. return int32(_XML_ERROR_NONE)
  8485. }
  8486. return int32(_XML_ERROR_NO_ELEMENTS)
  8487. default:
  8488. tok = -tok
  8489. *(*uintptr)(unsafe.Pointer(bp)) = end
  8490. break
  8491. }
  8492. }
  8493. role = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPROLOG_STATE)(unsafe.Pointer(parser + 496)).Fhandler})))(tls, parser+496, tok, s, *(*uintptr)(unsafe.Pointer(bp)), enc)
  8494. switch role {
  8495. case int32(_XML_ROLE_INSTANCE_START): // bytes accounted in contentProcessor
  8496. fallthrough
  8497. case int32(_XML_ROLE_XML_DECL): // bytes accounted in processXmlDecl
  8498. fallthrough
  8499. case int32(_XML_ROLE_TEXT_DECL): // bytes accounted in processXmlDecl
  8500. default:
  8501. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4717), account) != 0) {
  8502. _accountingOnAbort(tls, parser)
  8503. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  8504. }
  8505. }
  8506. switch role {
  8507. case int32(_XML_ROLE_XML_DECL):
  8508. goto _2
  8509. case int32(_XML_ROLE_DOCTYPE_NAME):
  8510. goto _3
  8511. case int32(_XML_ROLE_DOCTYPE_INTERNAL_SUBSET):
  8512. goto _4
  8513. case int32(_XML_ROLE_TEXT_DECL):
  8514. goto _5
  8515. case int32(_XML_ROLE_DOCTYPE_PUBLIC_ID):
  8516. goto _6
  8517. case int32(_XML_ROLE_ENTITY_PUBLIC_ID):
  8518. goto _7
  8519. case int32(_XML_ROLE_DOCTYPE_CLOSE):
  8520. goto _8
  8521. case int32(_XML_ROLE_INSTANCE_START):
  8522. goto _9
  8523. case int32(_XML_ROLE_ATTLIST_ELEMENT_NAME):
  8524. goto _10
  8525. case int32(_XML_ROLE_ATTRIBUTE_NAME):
  8526. goto _11
  8527. case int32(_XML_ROLE_ATTRIBUTE_TYPE_CDATA):
  8528. goto _12
  8529. case int32(_XML_ROLE_ATTRIBUTE_TYPE_ID):
  8530. goto _13
  8531. case int32(_XML_ROLE_ATTRIBUTE_TYPE_IDREF):
  8532. goto _14
  8533. case int32(_XML_ROLE_ATTRIBUTE_TYPE_IDREFS):
  8534. goto _15
  8535. case int32(_XML_ROLE_ATTRIBUTE_TYPE_ENTITY):
  8536. goto _16
  8537. case int32(_XML_ROLE_ATTRIBUTE_TYPE_ENTITIES):
  8538. goto _17
  8539. case int32(_XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN):
  8540. goto _18
  8541. case int32(_XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS):
  8542. goto _19
  8543. case int32(_XML_ROLE_ATTRIBUTE_NOTATION_VALUE):
  8544. goto _20
  8545. case int32(_XML_ROLE_ATTRIBUTE_ENUM_VALUE):
  8546. goto _21
  8547. case int32(_XML_ROLE_REQUIRED_ATTRIBUTE_VALUE):
  8548. goto _22
  8549. case int32(_XML_ROLE_IMPLIED_ATTRIBUTE_VALUE):
  8550. goto _23
  8551. case int32(_XML_ROLE_FIXED_ATTRIBUTE_VALUE):
  8552. goto _24
  8553. case int32(_XML_ROLE_DEFAULT_ATTRIBUTE_VALUE):
  8554. goto _25
  8555. case int32(_XML_ROLE_ENTITY_VALUE):
  8556. goto _26
  8557. case int32(_XML_ROLE_DOCTYPE_SYSTEM_ID):
  8558. goto _27
  8559. case int32(_XML_ROLE_ENTITY_SYSTEM_ID):
  8560. goto _28
  8561. case int32(_XML_ROLE_ENTITY_COMPLETE):
  8562. goto _29
  8563. case int32(_XML_ROLE_ENTITY_NOTATION_NAME):
  8564. goto _30
  8565. case int32(_XML_ROLE_GENERAL_ENTITY_NAME):
  8566. goto _31
  8567. case int32(_XML_ROLE_PARAM_ENTITY_NAME):
  8568. goto _32
  8569. case int32(_XML_ROLE_NOTATION_NAME):
  8570. goto _33
  8571. case int32(_XML_ROLE_NOTATION_PUBLIC_ID):
  8572. goto _34
  8573. case int32(_XML_ROLE_NOTATION_SYSTEM_ID):
  8574. goto _35
  8575. case int32(_XML_ROLE_NOTATION_NO_SYSTEM_ID):
  8576. goto _36
  8577. case int32(_XML_ROLE_ERROR):
  8578. goto _37
  8579. case int32(_XML_ROLE_IGNORE_SECT):
  8580. goto _38
  8581. case int32(_XML_ROLE_GROUP_OPEN):
  8582. goto _39
  8583. case int32(_XML_ROLE_GROUP_SEQUENCE):
  8584. goto _40
  8585. case int32(_XML_ROLE_GROUP_CHOICE):
  8586. goto _41
  8587. case int32(_XML_ROLE_INNER_PARAM_ENTITY_REF):
  8588. goto _42
  8589. case int32(_XML_ROLE_PARAM_ENTITY_REF):
  8590. goto _43
  8591. case int32(_XML_ROLE_ELEMENT_NAME):
  8592. goto _44
  8593. case int32(_XML_ROLE_CONTENT_EMPTY):
  8594. goto _45
  8595. case int32(_XML_ROLE_CONTENT_ANY):
  8596. goto _46
  8597. case int32(_XML_ROLE_CONTENT_PCDATA):
  8598. goto _47
  8599. case int32(_XML_ROLE_CONTENT_ELEMENT):
  8600. goto _48
  8601. case int32(_XML_ROLE_CONTENT_ELEMENT_OPT):
  8602. goto _49
  8603. case int32(_XML_ROLE_CONTENT_ELEMENT_REP):
  8604. goto _50
  8605. case int32(_XML_ROLE_CONTENT_ELEMENT_PLUS):
  8606. goto _51
  8607. case int32(_XML_ROLE_GROUP_CLOSE):
  8608. goto _52
  8609. case int32(_XML_ROLE_GROUP_CLOSE_OPT):
  8610. goto _53
  8611. case int32(_XML_ROLE_GROUP_CLOSE_REP):
  8612. goto _54
  8613. case int32(_XML_ROLE_GROUP_CLOSE_PLUS):
  8614. goto _55
  8615. case int32(_XML_ROLE_PI):
  8616. goto _56
  8617. case int32(_XML_ROLE_COMMENT):
  8618. goto _57
  8619. case int32(_XML_ROLE_NONE):
  8620. goto _58
  8621. case int32(_XML_ROLE_DOCTYPE_NONE):
  8622. goto _59
  8623. case int32(_XML_ROLE_ENTITY_NONE):
  8624. goto _60
  8625. case int32(_XML_ROLE_NOTATION_NONE):
  8626. goto _61
  8627. case int32(_XML_ROLE_ATTLIST_NONE):
  8628. goto _62
  8629. case int32(_XML_ROLE_ELEMENT_NONE):
  8630. goto _63
  8631. }
  8632. goto _64
  8633. _2:
  8634. ;
  8635. result = _processXmlDecl(tls, parser, 0, s, *(*uintptr)(unsafe.Pointer(bp)))
  8636. if result != int32(_XML_ERROR_NONE) {
  8637. return result
  8638. }
  8639. enc = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding
  8640. handleDefault = libc.Uint8FromInt32(0)
  8641. goto _64
  8642. _3:
  8643. ;
  8644. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  8645. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName = _poolStoreString(tls, parser+784, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  8646. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName != 0) {
  8647. return int32(_XML_ERROR_NO_MEMORY)
  8648. }
  8649. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  8650. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid = libc.UintptrFromInt32(0)
  8651. handleDefault = libc.Uint8FromInt32(0)
  8652. }
  8653. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = libc.UintptrFromInt32(0) /* always initialize to NULL */
  8654. goto _64
  8655. _4:
  8656. ;
  8657. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  8658. (*(*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))
  8659. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName = libc.UintptrFromInt32(0)
  8660. _poolClear(tls, parser+784)
  8661. handleDefault = libc.Uint8FromInt32(0)
  8662. }
  8663. goto _64
  8664. _5:
  8665. ;
  8666. result1 = _processXmlDecl(tls, parser, int32(1), s, *(*uintptr)(unsafe.Pointer(bp)))
  8667. if result1 != int32(_XML_ERROR_NONE) {
  8668. return result1
  8669. }
  8670. enc = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding
  8671. handleDefault = libc.Uint8FromInt32(0)
  8672. goto _64
  8673. _6:
  8674. ;
  8675. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  8676. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  8677. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  8678. return int32(_XML_ERROR_NO_MEMORY)
  8679. }
  8680. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  8681. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  8682. 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) {
  8683. return int32(_XML_ERROR_PUBLICID)
  8684. }
  8685. pubId = _poolStoreString(tls, parser+784, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  8686. if !(pubId != 0) {
  8687. return int32(_XML_ERROR_NO_MEMORY)
  8688. }
  8689. _normalizePublicId(tls, pubId)
  8690. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  8691. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid = pubId
  8692. handleDefault = libc.Uint8FromInt32(0)
  8693. goto alreadyChecked
  8694. }
  8695. /* fall through */
  8696. _7:
  8697. ;
  8698. 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) {
  8699. return int32(_XML_ERROR_PUBLICID)
  8700. }
  8701. goto alreadyChecked
  8702. alreadyChecked:
  8703. ;
  8704. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  8705. tem = _poolStoreString(tls, dtd+160, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  8706. if !(tem != 0) {
  8707. return int32(_XML_ERROR_NO_MEMORY)
  8708. }
  8709. _normalizePublicId(tls, tem)
  8710. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = tem
  8711. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  8712. /* Don't suppress the default handler if we fell through from
  8713. * the XML_ROLE_DOCTYPE_PUBLIC_ID case.
  8714. */
  8715. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 && role == int32(_XML_ROLE_ENTITY_PUBLIC_ID) {
  8716. handleDefault = libc.Uint8FromInt32(0)
  8717. }
  8718. }
  8719. goto _64
  8720. _8:
  8721. ;
  8722. if libc.Int32FromUint8(allowClosingDoctype) != libc.Int32FromUint8(libc.Uint8FromInt32(1)) {
  8723. /* Must not close doctype from within expanded parameter entities */
  8724. return int32(_XML_ERROR_INVALID_TOKEN)
  8725. }
  8726. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName != 0 {
  8727. (*(*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)
  8728. _poolClear(tls, parser+784)
  8729. handleDefault = libc.Uint8FromInt32(0)
  8730. }
  8731. /* parser->m_doctypeSysid will be non-NULL in the case of a previous
  8732. XML_ROLE_DOCTYPE_SYSTEM_ID, even if parser->m_startDoctypeDeclHandler
  8733. was not set, indicating an external subset
  8734. */
  8735. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid != 0 || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD != 0 {
  8736. hadParamEntityRefs = (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs
  8737. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  8738. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  8739. entity = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  8740. if !(entity != 0) {
  8741. /* The external subset name "#" will have already been
  8742. * inserted into the hash table at the start of the
  8743. * external entity parsing, so no allocation will happen
  8744. * and lookup() cannot fail.
  8745. */
  8746. return int32(_XML_ERROR_NO_MEMORY) /* LCOV_EXCL_LINE */
  8747. }
  8748. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD != 0 {
  8749. (*TENTITY)(unsafe.Pointer(entity)).Fbase = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  8750. }
  8751. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  8752. 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) {
  8753. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  8754. }
  8755. if (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0 {
  8756. 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) {
  8757. return int32(_XML_ERROR_NOT_STANDALONE)
  8758. }
  8759. } else {
  8760. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid != 0) {
  8761. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = hadParamEntityRefs
  8762. }
  8763. }
  8764. /* end of DTD - no need to update dtd->keepProcessing */
  8765. }
  8766. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  8767. }
  8768. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler != 0 {
  8769. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg)
  8770. handleDefault = libc.Uint8FromInt32(0)
  8771. }
  8772. goto _64
  8773. _9:
  8774. ;
  8775. /* if there is no DOCTYPE declaration then now is the
  8776. last chance to read the foreign DTD
  8777. */
  8778. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD != 0 {
  8779. hadParamEntityRefs1 = (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs
  8780. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  8781. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  8782. entity1 = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  8783. if !(entity1 != 0) {
  8784. return int32(_XML_ERROR_NO_MEMORY)
  8785. }
  8786. (*TENTITY)(unsafe.Pointer(entity1)).Fbase = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  8787. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  8788. 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) {
  8789. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  8790. }
  8791. if (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0 {
  8792. 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) {
  8793. return int32(_XML_ERROR_NOT_STANDALONE)
  8794. }
  8795. } else {
  8796. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = hadParamEntityRefs1
  8797. }
  8798. /* end of DTD - no need to update dtd->keepProcessing */
  8799. }
  8800. }
  8801. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_contentProcessor)
  8802. return _contentProcessor(tls, parser, s, end, nextPtr)
  8803. _10:
  8804. ;
  8805. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = _getElementType(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  8806. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType != 0) {
  8807. return int32(_XML_ERROR_NO_MEMORY)
  8808. }
  8809. goto checkAttListDeclHandler
  8810. _11:
  8811. ;
  8812. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId = _getAttributeId(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  8813. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId != 0) {
  8814. return int32(_XML_ERROR_NO_MEMORY)
  8815. }
  8816. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata = libc.Uint8FromInt32(0)
  8817. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = libc.UintptrFromInt32(0)
  8818. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId = libc.Uint8FromInt32(0)
  8819. goto checkAttListDeclHandler
  8820. _12:
  8821. ;
  8822. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata = libc.Uint8FromInt32(1)
  8823. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeCDATA))
  8824. goto checkAttListDeclHandler
  8825. _13:
  8826. ;
  8827. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId = libc.Uint8FromInt32(1)
  8828. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeID))
  8829. goto checkAttListDeclHandler
  8830. _14:
  8831. ;
  8832. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeIDREF))
  8833. goto checkAttListDeclHandler
  8834. _15:
  8835. ;
  8836. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeIDREFS))
  8837. goto checkAttListDeclHandler
  8838. _16:
  8839. ;
  8840. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeENTITY))
  8841. goto checkAttListDeclHandler
  8842. _17:
  8843. ;
  8844. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeENTITIES))
  8845. goto checkAttListDeclHandler
  8846. _18:
  8847. ;
  8848. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeNMTOKEN))
  8849. goto checkAttListDeclHandler
  8850. _19:
  8851. ;
  8852. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeNMTOKENS))
  8853. goto checkAttListDeclHandler
  8854. checkAttListDeclHandler:
  8855. ;
  8856. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 {
  8857. handleDefault = libc.Uint8FromInt32(0)
  8858. }
  8859. goto _64
  8860. _21:
  8861. ;
  8862. _20:
  8863. ;
  8864. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 {
  8865. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType != 0 {
  8866. prefix = uintptr(unsafe.Pointer(&_enumValueSep))
  8867. } else {
  8868. if role == int32(_XML_ROLE_ATTRIBUTE_NOTATION_VALUE) {
  8869. v65 = uintptr(unsafe.Pointer(&_notationPrefix))
  8870. } else {
  8871. v65 = uintptr(unsafe.Pointer(&_enumValueStart))
  8872. }
  8873. prefix = v65
  8874. }
  8875. if !(_poolAppendString(tls, parser+784, prefix) != 0) {
  8876. return int32(_XML_ERROR_NO_MEMORY)
  8877. }
  8878. if !(_poolAppend(tls, parser+784, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  8879. return int32(_XML_ERROR_NO_MEMORY)
  8880. }
  8881. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  8882. handleDefault = libc.Uint8FromInt32(0)
  8883. }
  8884. goto _64
  8885. _23:
  8886. ;
  8887. _22:
  8888. ;
  8889. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  8890. 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) {
  8891. return int32(_XML_ERROR_NO_MEMORY)
  8892. }
  8893. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType != 0 {
  8894. if int32(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_LPAREN) || int32(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_N) && int32(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType + 1))) == int32(m_ASCII_O) {
  8895. /* Enumerated or Notation type */
  8896. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8897. v66 = 0
  8898. } else {
  8899. v68 = parser + 784 + 24
  8900. v67 = *(*uintptr)(unsafe.Pointer(v68))
  8901. *(*uintptr)(unsafe.Pointer(v68))++
  8902. *(*TXML_Char)(unsafe.Pointer(v67)) = int8(m_ASCII_RPAREN)
  8903. v66 = libc.Int32FromInt32(1)
  8904. }
  8905. if v72 = !(v66 != 0); !v72 {
  8906. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8907. v69 = 0
  8908. } else {
  8909. v71 = parser + 784 + 24
  8910. v70 = *(*uintptr)(unsafe.Pointer(v71))
  8911. *(*uintptr)(unsafe.Pointer(v71))++
  8912. *(*TXML_Char)(unsafe.Pointer(v70)) = int8('\000')
  8913. v69 = libc.Int32FromInt32(1)
  8914. }
  8915. }
  8916. if v72 || !(v69 != 0) {
  8917. return int32(_XML_ERROR_NO_MEMORY)
  8918. }
  8919. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  8920. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  8921. }
  8922. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  8923. (*(*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)))
  8924. handleDefault = libc.Uint8FromInt32(0)
  8925. }
  8926. }
  8927. _poolClear(tls, parser+784)
  8928. goto _64
  8929. _25:
  8930. ;
  8931. _24:
  8932. ;
  8933. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  8934. result2 = _storeAttributeValue(tls, parser, enc, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), dtd+160, int32(_XML_ACCOUNT_NONE))
  8935. if result2 != 0 {
  8936. return result2
  8937. }
  8938. attVal = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  8939. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  8940. /* ID attributes aren't allowed to have a default */
  8941. 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) {
  8942. return int32(_XML_ERROR_NO_MEMORY)
  8943. }
  8944. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType != 0 {
  8945. if int32(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_LPAREN) || int32(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_N) && int32(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType + 1))) == int32(m_ASCII_O) {
  8946. /* Enumerated or Notation type */
  8947. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8948. v73 = 0
  8949. } else {
  8950. v75 = parser + 784 + 24
  8951. v74 = *(*uintptr)(unsafe.Pointer(v75))
  8952. *(*uintptr)(unsafe.Pointer(v75))++
  8953. *(*TXML_Char)(unsafe.Pointer(v74)) = int8(m_ASCII_RPAREN)
  8954. v73 = libc.Int32FromInt32(1)
  8955. }
  8956. if v79 = !(v73 != 0); !v79 {
  8957. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8958. v76 = 0
  8959. } else {
  8960. v78 = parser + 784 + 24
  8961. v77 = *(*uintptr)(unsafe.Pointer(v78))
  8962. *(*uintptr)(unsafe.Pointer(v78))++
  8963. *(*TXML_Char)(unsafe.Pointer(v77)) = int8('\000')
  8964. v76 = libc.Int32FromInt32(1)
  8965. }
  8966. }
  8967. if v79 || !(v76 != 0) {
  8968. return int32(_XML_ERROR_NO_MEMORY)
  8969. }
  8970. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  8971. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  8972. }
  8973. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  8974. (*(*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)))
  8975. _poolClear(tls, parser+784)
  8976. handleDefault = libc.Uint8FromInt32(0)
  8977. }
  8978. }
  8979. goto _64
  8980. _26:
  8981. ;
  8982. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  8983. 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))
  8984. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  8985. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FtextPtr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fstart
  8986. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FtextLen = int32(int64((*TSTRING_POOL)(unsafe.Pointer(dtd+208)).Fptr) - int64((*TSTRING_POOL)(unsafe.Pointer(dtd+208)).Fstart))
  8987. (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fptr
  8988. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  8989. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  8990. (*(*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))
  8991. handleDefault = libc.Uint8FromInt32(0)
  8992. }
  8993. } else {
  8994. (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fstart
  8995. }
  8996. if result3 != int32(_XML_ERROR_NONE) {
  8997. return result3
  8998. }
  8999. }
  9000. goto _64
  9001. _27:
  9002. ;
  9003. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  9004. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  9005. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  9006. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = _poolStoreString(tls, parser+784, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  9007. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid == libc.UintptrFromInt32(0) {
  9008. return int32(_XML_ERROR_NO_MEMORY)
  9009. }
  9010. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  9011. handleDefault = libc.Uint8FromInt32(0)
  9012. } else {
  9013. /* use externalSubsetName to make parser->m_doctypeSysid non-NULL
  9014. for the case where no parser->m_startDoctypeDeclHandler is set */
  9015. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = uintptr(unsafe.Pointer(&_externalSubsetName))
  9016. }
  9017. 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) {
  9018. return int32(_XML_ERROR_NOT_STANDALONE)
  9019. }
  9020. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  9021. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  9022. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  9023. return int32(_XML_ERROR_NO_MEMORY)
  9024. }
  9025. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = libc.UintptrFromInt32(0)
  9026. }
  9027. /* fall through */
  9028. _28:
  9029. ;
  9030. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  9031. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FsystemId = _poolStoreString(tls, dtd+160, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  9032. if !((*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FsystemId != 0) {
  9033. return int32(_XML_ERROR_NO_MEMORY)
  9034. }
  9035. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fbase = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  9036. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  9037. /* Don't suppress the default handler if we fell through from
  9038. * the XML_ROLE_DOCTYPE_SYSTEM_ID case.
  9039. */
  9040. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 && role == int32(_XML_ROLE_ENTITY_SYSTEM_ID) {
  9041. handleDefault = libc.Uint8FromInt32(0)
  9042. }
  9043. }
  9044. goto _64
  9045. _29:
  9046. ;
  9047. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  9048. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  9049. (*(*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))
  9050. handleDefault = libc.Uint8FromInt32(0)
  9051. }
  9052. goto _64
  9053. _30:
  9054. ;
  9055. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  9056. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fnotation = _poolStoreString(tls, dtd+160, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  9057. if !((*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fnotation != 0) {
  9058. return int32(_XML_ERROR_NO_MEMORY)
  9059. }
  9060. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  9061. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler != 0 {
  9062. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  9063. (*(*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)
  9064. handleDefault = libc.Uint8FromInt32(0)
  9065. } else {
  9066. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  9067. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  9068. (*(*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)
  9069. handleDefault = libc.Uint8FromInt32(0)
  9070. }
  9071. }
  9072. }
  9073. goto _64
  9074. _31:
  9075. ;
  9076. 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 {
  9077. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  9078. goto _64
  9079. }
  9080. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  9081. name = _poolStoreString(tls, dtd+160, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  9082. if !(name != 0) {
  9083. return int32(_XML_ERROR_NO_MEMORY)
  9084. }
  9085. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd, name, uint64(64))
  9086. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  9087. return int32(_XML_ERROR_NO_MEMORY)
  9088. }
  9089. if (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fname != name {
  9090. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  9091. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  9092. } else {
  9093. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  9094. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = libc.UintptrFromInt32(0)
  9095. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fis_param = libc.Uint8FromInt32(0)
  9096. /* if we have a parent parser or are reading an internal parameter
  9097. entity, then the entity declaration is not considered "internal"
  9098. */
  9099. (*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))
  9100. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  9101. handleDefault = libc.Uint8FromInt32(0)
  9102. }
  9103. }
  9104. } else {
  9105. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  9106. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  9107. }
  9108. goto _64
  9109. _32:
  9110. ;
  9111. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  9112. name1 = _poolStoreString(tls, dtd+160, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  9113. if !(name1 != 0) {
  9114. return int32(_XML_ERROR_NO_MEMORY)
  9115. }
  9116. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd+264, name1, uint64(64))
  9117. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  9118. return int32(_XML_ERROR_NO_MEMORY)
  9119. }
  9120. if (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fname != name1 {
  9121. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  9122. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  9123. } else {
  9124. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  9125. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = libc.UintptrFromInt32(0)
  9126. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fis_param = libc.Uint8FromInt32(1)
  9127. /* if we have a parent parser or are reading an internal parameter
  9128. entity, then the entity declaration is not considered "internal"
  9129. */
  9130. (*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))
  9131. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  9132. handleDefault = libc.Uint8FromInt32(0)
  9133. }
  9134. }
  9135. } else {
  9136. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  9137. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  9138. }
  9139. goto _64
  9140. _33:
  9141. ;
  9142. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId = libc.UintptrFromInt32(0)
  9143. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName = libc.UintptrFromInt32(0)
  9144. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  9145. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName = _poolStoreString(tls, parser+784, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  9146. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName != 0) {
  9147. return int32(_XML_ERROR_NO_MEMORY)
  9148. }
  9149. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  9150. handleDefault = libc.Uint8FromInt32(0)
  9151. }
  9152. goto _64
  9153. _34:
  9154. ;
  9155. 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) {
  9156. return int32(_XML_ERROR_PUBLICID)
  9157. }
  9158. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName != 0 { /* means m_notationDeclHandler != NULL */
  9159. tem1 = _poolStoreString(tls, parser+784, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  9160. if !(tem1 != 0) {
  9161. return int32(_XML_ERROR_NO_MEMORY)
  9162. }
  9163. _normalizePublicId(tls, tem1)
  9164. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId = tem1
  9165. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  9166. handleDefault = libc.Uint8FromInt32(0)
  9167. }
  9168. goto _64
  9169. _35:
  9170. ;
  9171. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  9172. systemId = _poolStoreString(tls, parser+784, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  9173. if !(systemId != 0) {
  9174. return int32(_XML_ERROR_NO_MEMORY)
  9175. }
  9176. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  9177. (*(*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)
  9178. handleDefault = libc.Uint8FromInt32(0)
  9179. }
  9180. _poolClear(tls, parser+784)
  9181. goto _64
  9182. _36:
  9183. ;
  9184. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  9185. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  9186. (*(*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)
  9187. handleDefault = libc.Uint8FromInt32(0)
  9188. }
  9189. _poolClear(tls, parser+784)
  9190. goto _64
  9191. _37:
  9192. ;
  9193. switch tok {
  9194. case int32(m_XML_TOK_PARAM_ENTITY_REF):
  9195. /* PE references in internal subset are
  9196. not allowed within declarations. */
  9197. return int32(_XML_ERROR_PARAM_ENTITY_REF)
  9198. case int32(m_XML_TOK_XML_DECL):
  9199. return int32(_XML_ERROR_MISPLACED_XML_PI)
  9200. default:
  9201. return int32(_XML_ERROR_SYNTAX)
  9202. }
  9203. _38:
  9204. ;
  9205. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  9206. _reportDefault(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  9207. }
  9208. handleDefault = libc.Uint8FromInt32(0)
  9209. result4 = _doIgnoreSection(tls, parser, enc, bp, end, nextPtr, haveMore)
  9210. if result4 != int32(_XML_ERROR_NONE) {
  9211. return result4
  9212. } else {
  9213. if !(*(*uintptr)(unsafe.Pointer(bp)) != 0) {
  9214. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_ignoreSectionProcessor)
  9215. return result4
  9216. }
  9217. }
  9218. goto _64
  9219. _39:
  9220. ;
  9221. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel >= (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize {
  9222. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize != 0 {
  9223. /* Detect and prevent integer overflow */
  9224. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize > libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromUint32(2) {
  9225. return int32(_XML_ERROR_NO_MEMORY)
  9226. }
  9227. p80 = parser + 888
  9228. *(*uint32)(unsafe.Pointer(p80)) *= uint32(2)
  9229. new_connector = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector, uint64(*(*uint32)(unsafe.Pointer(p80))))
  9230. if new_connector == libc.UintptrFromInt32(0) {
  9231. *(*uint32)(unsafe.Pointer(parser + 888)) /= uint32(2)
  9232. return int32(_XML_ERROR_NO_MEMORY)
  9233. }
  9234. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector = new_connector
  9235. if (*TDTD)(unsafe.Pointer(dtd)).FscaffIndex != 0 {
  9236. /* Detect and prevent integer overflow.
  9237. * The preprocessor guard addresses the "always false" warning
  9238. * from -Wtype-limits on platforms where
  9239. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  9240. new_scaff_index = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TDTD)(unsafe.Pointer(dtd)).FscaffIndex, uint64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize)*libc.Uint64FromInt64(4))
  9241. if new_scaff_index == libc.UintptrFromInt32(0) {
  9242. return int32(_XML_ERROR_NO_MEMORY)
  9243. }
  9244. (*TDTD)(unsafe.Pointer(dtd)).FscaffIndex = new_scaff_index
  9245. }
  9246. } else {
  9247. v81 = libc.Uint32FromInt32(32)
  9248. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize = v81
  9249. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, uint64(v81))
  9250. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector != 0) {
  9251. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize = uint32(0)
  9252. return int32(_XML_ERROR_NO_MEMORY)
  9253. }
  9254. }
  9255. }
  9256. *(*int8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) = 0
  9257. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  9258. myindex = _nextScaffoldPart(tls, parser)
  9259. if myindex < 0 {
  9260. return int32(_XML_ERROR_NO_MEMORY)
  9261. }
  9262. *(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel)*4)) = myindex
  9263. (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel++
  9264. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex)*32))).Ftype1 = int32(_XML_CTYPE_SEQ)
  9265. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  9266. handleDefault = libc.Uint8FromInt32(0)
  9267. }
  9268. }
  9269. goto _64
  9270. _40:
  9271. ;
  9272. if int32(*(*int8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel)))) == int32(m_ASCII_PIPE) {
  9273. return int32(_XML_ERROR_SYNTAX)
  9274. }
  9275. *(*int8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) = int8(m_ASCII_COMMA)
  9276. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  9277. handleDefault = libc.Uint8FromInt32(0)
  9278. }
  9279. goto _64
  9280. _41:
  9281. ;
  9282. if int32(*(*int8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel)))) == int32(m_ASCII_COMMA) {
  9283. return int32(_XML_ERROR_SYNTAX)
  9284. }
  9285. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 && !(*(*int8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) != 0) && (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(*(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel-int32(1))*4)))*32))).Ftype1 != int32(_XML_CTYPE_MIXED) {
  9286. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(*(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel-int32(1))*4)))*32))).Ftype1 = int32(_XML_CTYPE_CHOICE)
  9287. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  9288. handleDefault = libc.Uint8FromInt32(0)
  9289. }
  9290. }
  9291. *(*int8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) = int8(m_ASCII_PIPE)
  9292. goto _64
  9293. _43:
  9294. ;
  9295. _42:
  9296. ;
  9297. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  9298. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0) {
  9299. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  9300. } else {
  9301. name2 = _poolStoreString(tls, dtd+160, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  9302. if !(name2 != 0) {
  9303. return int32(_XML_ERROR_NO_MEMORY)
  9304. }
  9305. entity2 = _lookup(tls, parser, dtd+264, name2, uint64(0))
  9306. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  9307. /* first, determine if a check for an existing declaration is needed;
  9308. if yes, check that the entity exists, and that it is internal,
  9309. otherwise call the skipped entity handler
  9310. */
  9311. if v83 = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FdocumentEntity != 0; v83 {
  9312. if (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0 {
  9313. v82 = libc.BoolInt32(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0))
  9314. } else {
  9315. v82 = libc.BoolInt32(!((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0))
  9316. }
  9317. }
  9318. if v83 && v82 != 0 {
  9319. if !(entity2 != 0) {
  9320. return int32(_XML_ERROR_UNDEFINED_ENTITY)
  9321. } else {
  9322. if !((*TENTITY)(unsafe.Pointer(entity2)).Fis_internal != 0) {
  9323. /* It's hard to exhaustively search the code to be sure,
  9324. * but there doesn't seem to be a way of executing the
  9325. * following line. There are two cases:
  9326. *
  9327. * If 'standalone' is false, the DTD must have no
  9328. * parameter entities or we wouldn't have passed the outer
  9329. * 'if' statement. That means the only entity in the hash
  9330. * table is the external subset name "#" which cannot be
  9331. * given as a parameter entity name in XML syntax, so the
  9332. * lookup must have returned NULL and we don't even reach
  9333. * the test for an internal entity.
  9334. *
  9335. * If 'standalone' is true, it does not seem to be
  9336. * possible to create entities taking this code path that
  9337. * are not internal entities, so fail the test above.
  9338. *
  9339. * Because this analysis is very uncertain, the code is
  9340. * being left in place and merely removed from the
  9341. * coverage test statistics.
  9342. */
  9343. return int32(_XML_ERROR_ENTITY_DECLARED_IN_PE) /* LCOV_EXCL_LINE */
  9344. }
  9345. }
  9346. } else {
  9347. if !(entity2 != 0) {
  9348. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  9349. /* cannot report skipped entities in declarations */
  9350. if role == int32(_XML_ROLE_PARAM_ENTITY_REF) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler != 0 {
  9351. (*(*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))
  9352. handleDefault = libc.Uint8FromInt32(0)
  9353. }
  9354. goto _64
  9355. }
  9356. }
  9357. if (*TENTITY)(unsafe.Pointer(entity2)).Fopen != 0 {
  9358. return int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  9359. }
  9360. if (*TENTITY)(unsafe.Pointer(entity2)).FtextPtr != 0 {
  9361. if role == int32(_XML_ROLE_PARAM_ENTITY_REF) {
  9362. v84 = libc.Int32FromUint8(libc.Uint8FromInt32(1))
  9363. } else {
  9364. v84 = libc.Int32FromUint8(libc.Uint8FromInt32(0))
  9365. }
  9366. betweenDecl = libc.Uint8FromInt32(v84)
  9367. result5 = _processInternalEntity(tls, parser, entity2, betweenDecl)
  9368. if result5 != int32(_XML_ERROR_NONE) {
  9369. return result5
  9370. }
  9371. handleDefault = libc.Uint8FromInt32(0)
  9372. goto _64
  9373. }
  9374. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  9375. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  9376. (*TENTITY)(unsafe.Pointer(entity2)).Fopen = libc.Uint8FromInt32(1)
  9377. _entityTrackingOnOpen(tls, parser, entity2, int32(5439))
  9378. 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) {
  9379. _entityTrackingOnClose(tls, parser, entity2, int32(5443))
  9380. (*TENTITY)(unsafe.Pointer(entity2)).Fopen = libc.Uint8FromInt32(0)
  9381. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  9382. }
  9383. _entityTrackingOnClose(tls, parser, entity2, int32(5447))
  9384. (*TENTITY)(unsafe.Pointer(entity2)).Fopen = libc.Uint8FromInt32(0)
  9385. handleDefault = libc.Uint8FromInt32(0)
  9386. if !((*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0) {
  9387. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  9388. goto _64
  9389. }
  9390. } else {
  9391. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  9392. goto _64
  9393. }
  9394. }
  9395. 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) {
  9396. return int32(_XML_ERROR_NOT_STANDALONE)
  9397. }
  9398. goto _64
  9399. /* Element declaration stuff */
  9400. _44:
  9401. ;
  9402. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  9403. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = _getElementType(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  9404. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType != 0) {
  9405. return int32(_XML_ERROR_NO_MEMORY)
  9406. }
  9407. (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel = 0
  9408. (*TDTD)(unsafe.Pointer(dtd)).FscaffCount = uint32(0)
  9409. (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl = libc.Uint8FromInt32(1)
  9410. handleDefault = libc.Uint8FromInt32(0)
  9411. }
  9412. goto _64
  9413. _46:
  9414. ;
  9415. _45:
  9416. ;
  9417. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  9418. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  9419. content = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(32))
  9420. if !(content != 0) {
  9421. return int32(_XML_ERROR_NO_MEMORY)
  9422. }
  9423. (*TXML_Content)(unsafe.Pointer(content)).Fquant = int32(_XML_CQUANT_NONE)
  9424. (*TXML_Content)(unsafe.Pointer(content)).Fname = libc.UintptrFromInt32(0)
  9425. (*TXML_Content)(unsafe.Pointer(content)).Fnumchildren = uint32(0)
  9426. (*TXML_Content)(unsafe.Pointer(content)).Fchildren = libc.UintptrFromInt32(0)
  9427. if role == int32(_XML_ROLE_CONTENT_ANY) {
  9428. v85 = int32(_XML_CTYPE_ANY)
  9429. } else {
  9430. v85 = int32(_XML_CTYPE_EMPTY)
  9431. }
  9432. (*TXML_Content)(unsafe.Pointer(content)).Ftype1 = v85
  9433. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  9434. (*(*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)
  9435. handleDefault = libc.Uint8FromInt32(0)
  9436. }
  9437. (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl = libc.Uint8FromInt32(0)
  9438. }
  9439. goto _64
  9440. _47:
  9441. ;
  9442. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  9443. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(*(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel-int32(1))*4)))*32))).Ftype1 = int32(_XML_CTYPE_MIXED)
  9444. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  9445. handleDefault = libc.Uint8FromInt32(0)
  9446. }
  9447. }
  9448. goto _64
  9449. _48:
  9450. ;
  9451. quant = int32(_XML_CQUANT_NONE)
  9452. goto elementContent
  9453. _49:
  9454. ;
  9455. quant = int32(_XML_CQUANT_OPT)
  9456. goto elementContent
  9457. _50:
  9458. ;
  9459. quant = int32(_XML_CQUANT_REP)
  9460. goto elementContent
  9461. _51:
  9462. ;
  9463. quant = int32(_XML_CQUANT_PLUS)
  9464. goto elementContent
  9465. elementContent:
  9466. ;
  9467. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  9468. if quant == int32(_XML_CQUANT_NONE) {
  9469. v86 = *(*uintptr)(unsafe.Pointer(bp))
  9470. } else {
  9471. v86 = *(*uintptr)(unsafe.Pointer(bp)) - uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  9472. }
  9473. nxt = v86
  9474. myindex1 = _nextScaffoldPart(tls, parser)
  9475. if myindex1 < 0 {
  9476. return int32(_XML_ERROR_NO_MEMORY)
  9477. }
  9478. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex1)*32))).Ftype1 = int32(_XML_CTYPE_NAME)
  9479. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex1)*32))).Fquant = quant
  9480. el = _getElementType(tls, parser, enc, s, nxt)
  9481. if !(el != 0) {
  9482. return int32(_XML_ERROR_NO_MEMORY)
  9483. }
  9484. name3 = (*TELEMENT_TYPE)(unsafe.Pointer(el)).Fname
  9485. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex1)*32))).Fname = name3
  9486. nameLen = uint64(0)
  9487. for {
  9488. v88 = nameLen
  9489. nameLen++
  9490. if !(*(*TXML_Char)(unsafe.Pointer(name3 + uintptr(v88))) != 0) {
  9491. break
  9492. }
  9493. goto _87
  9494. _87:
  9495. }
  9496. /* Detect and prevent integer overflow */
  9497. if nameLen > uint64(libc.Uint32FromInt32(m___INT_MAX__)*libc.Uint32FromUint32(2)+libc.Uint32FromUint32(1)-(*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen) {
  9498. return int32(_XML_ERROR_NO_MEMORY)
  9499. }
  9500. *(*uint32)(unsafe.Pointer(dtd + 336)) += uint32(nameLen)
  9501. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  9502. handleDefault = libc.Uint8FromInt32(0)
  9503. }
  9504. }
  9505. goto _64
  9506. _52:
  9507. ;
  9508. quant = int32(_XML_CQUANT_NONE)
  9509. goto closeGroup
  9510. _53:
  9511. ;
  9512. quant = int32(_XML_CQUANT_OPT)
  9513. goto closeGroup
  9514. _54:
  9515. ;
  9516. quant = int32(_XML_CQUANT_REP)
  9517. goto closeGroup
  9518. _55:
  9519. ;
  9520. quant = int32(_XML_CQUANT_PLUS)
  9521. goto closeGroup
  9522. closeGroup:
  9523. ;
  9524. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  9525. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  9526. handleDefault = libc.Uint8FromInt32(0)
  9527. }
  9528. (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel--
  9529. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(*(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel)*4)))*32))).Fquant = quant
  9530. if (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel == 0 {
  9531. if !(handleDefault != 0) {
  9532. model = _build_model(tls, parser)
  9533. if !(model != 0) {
  9534. return int32(_XML_ERROR_NO_MEMORY)
  9535. }
  9536. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  9537. (*(*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)
  9538. }
  9539. (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl = libc.Uint8FromInt32(0)
  9540. (*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen = uint32(0)
  9541. }
  9542. }
  9543. goto _64
  9544. /* End element declaration stuff */
  9545. _56:
  9546. ;
  9547. if !(_reportProcessingInstruction(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  9548. return int32(_XML_ERROR_NO_MEMORY)
  9549. }
  9550. handleDefault = libc.Uint8FromInt32(0)
  9551. goto _64
  9552. _57:
  9553. ;
  9554. if !(_reportComment(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  9555. return int32(_XML_ERROR_NO_MEMORY)
  9556. }
  9557. handleDefault = libc.Uint8FromInt32(0)
  9558. goto _64
  9559. _58:
  9560. ;
  9561. switch tok {
  9562. case int32(m_XML_TOK_BOM):
  9563. handleDefault = libc.Uint8FromInt32(0)
  9564. break
  9565. }
  9566. goto _64
  9567. _59:
  9568. ;
  9569. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  9570. handleDefault = libc.Uint8FromInt32(0)
  9571. }
  9572. goto _64
  9573. _60:
  9574. ;
  9575. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  9576. handleDefault = libc.Uint8FromInt32(0)
  9577. }
  9578. goto _64
  9579. _61:
  9580. ;
  9581. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  9582. handleDefault = libc.Uint8FromInt32(0)
  9583. }
  9584. goto _64
  9585. _62:
  9586. ;
  9587. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 {
  9588. handleDefault = libc.Uint8FromInt32(0)
  9589. }
  9590. goto _64
  9591. _63:
  9592. ;
  9593. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  9594. handleDefault = libc.Uint8FromInt32(0)
  9595. }
  9596. goto _64
  9597. _64:
  9598. ; /* end of big switch */
  9599. if handleDefault != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  9600. _reportDefault(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  9601. }
  9602. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  9603. case int32(_XML_SUSPENDED):
  9604. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  9605. return int32(_XML_ERROR_NONE)
  9606. case int32(_XML_FINISHED):
  9607. return int32(_XML_ERROR_ABORTED)
  9608. default:
  9609. s = *(*uintptr)(unsafe.Pointer(bp))
  9610. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc))})))(tls, enc, s, end, bp)
  9611. }
  9612. goto _1
  9613. _1:
  9614. }
  9615. /* not reached */
  9616. return r
  9617. }
  9618. var _externalSubsetName = [2]TXML_Char{
  9619. 0: int8(m_ASCII_HASH),
  9620. }
  9621. var _atypeCDATA = [6]TXML_Char{
  9622. 0: int8(m_ASCII_C),
  9623. 1: int8(m_ASCII_D),
  9624. 2: int8(m_ASCII_A),
  9625. 3: int8(m_ASCII_T),
  9626. 4: int8(m_ASCII_A),
  9627. }
  9628. var _atypeID = [3]TXML_Char{
  9629. 0: int8(m_ASCII_I),
  9630. 1: int8(m_ASCII_D),
  9631. }
  9632. var _atypeIDREF = [6]TXML_Char{
  9633. 0: int8(m_ASCII_I),
  9634. 1: int8(m_ASCII_D),
  9635. 2: int8(m_ASCII_R),
  9636. 3: int8(m_ASCII_E),
  9637. 4: int8(m_ASCII_F),
  9638. }
  9639. var _atypeIDREFS = [7]TXML_Char{
  9640. 0: int8(m_ASCII_I),
  9641. 1: int8(m_ASCII_D),
  9642. 2: int8(m_ASCII_R),
  9643. 3: int8(m_ASCII_E),
  9644. 4: int8(m_ASCII_F),
  9645. 5: int8(m_ASCII_S),
  9646. }
  9647. var _atypeENTITY = [7]TXML_Char{
  9648. 0: int8(m_ASCII_E),
  9649. 1: int8(m_ASCII_N),
  9650. 2: int8(m_ASCII_T),
  9651. 3: int8(m_ASCII_I),
  9652. 4: int8(m_ASCII_T),
  9653. 5: int8(m_ASCII_Y),
  9654. }
  9655. var _atypeENTITIES = [9]TXML_Char{
  9656. 0: int8(m_ASCII_E),
  9657. 1: int8(m_ASCII_N),
  9658. 2: int8(m_ASCII_T),
  9659. 3: int8(m_ASCII_I),
  9660. 4: int8(m_ASCII_T),
  9661. 5: int8(m_ASCII_I),
  9662. 6: int8(m_ASCII_E),
  9663. 7: int8(m_ASCII_S),
  9664. }
  9665. var _atypeNMTOKEN = [8]TXML_Char{
  9666. 0: int8(m_ASCII_N),
  9667. 1: int8(m_ASCII_M),
  9668. 2: int8(m_ASCII_T),
  9669. 3: int8(m_ASCII_O),
  9670. 4: int8(m_ASCII_K),
  9671. 5: int8(m_ASCII_E),
  9672. 6: int8(m_ASCII_N),
  9673. }
  9674. var _atypeNMTOKENS = [9]TXML_Char{
  9675. 0: int8(m_ASCII_N),
  9676. 1: int8(m_ASCII_M),
  9677. 2: int8(m_ASCII_T),
  9678. 3: int8(m_ASCII_O),
  9679. 4: int8(m_ASCII_K),
  9680. 5: int8(m_ASCII_E),
  9681. 6: int8(m_ASCII_N),
  9682. 7: int8(m_ASCII_S),
  9683. }
  9684. var _notationPrefix = [10]TXML_Char{
  9685. 0: int8(m_ASCII_N),
  9686. 1: int8(m_ASCII_O),
  9687. 2: int8(m_ASCII_T),
  9688. 3: int8(m_ASCII_A),
  9689. 4: int8(m_ASCII_T),
  9690. 5: int8(m_ASCII_I),
  9691. 6: int8(m_ASCII_O),
  9692. 7: int8(m_ASCII_N),
  9693. 8: int8(m_ASCII_LPAREN),
  9694. }
  9695. var _enumValueSep = [2]TXML_Char{
  9696. 0: int8(m_ASCII_PIPE),
  9697. }
  9698. var _enumValueStart = [2]TXML_Char{
  9699. 0: int8(m_ASCII_LPAREN),
  9700. }
  9701. func _epilogProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  9702. bp := tls.Alloc(16)
  9703. defer tls.Free(16)
  9704. var tok int32
  9705. var v2 uintptr
  9706. var _ /* next at bp+0 */ uintptr
  9707. _, _ = tok, v2
  9708. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_epilogProcessor)
  9709. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = s
  9710. for {
  9711. *(*uintptr)(unsafe.Pointer(bp)) = libc.UintptrFromInt32(0)
  9712. 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)
  9713. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(5652), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  9714. _accountingOnAbort(tls, parser)
  9715. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  9716. }
  9717. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = *(*uintptr)(unsafe.Pointer(bp))
  9718. switch tok {
  9719. /* report partial linebreak - it might be the last token */
  9720. case -int32(m_XML_TOK_PROLOG_S):
  9721. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  9722. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp)))
  9723. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  9724. return int32(_XML_ERROR_ABORTED)
  9725. }
  9726. }
  9727. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  9728. return int32(_XML_ERROR_NONE)
  9729. case -int32(4):
  9730. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  9731. return int32(_XML_ERROR_NONE)
  9732. case int32(m_XML_TOK_PROLOG_S):
  9733. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  9734. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp)))
  9735. }
  9736. case int32(m_XML_TOK_PI):
  9737. if !(_reportProcessingInstruction(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  9738. return int32(_XML_ERROR_NO_MEMORY)
  9739. }
  9740. case int32(m_XML_TOK_COMMENT):
  9741. if !(_reportComment(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  9742. return int32(_XML_ERROR_NO_MEMORY)
  9743. }
  9744. case m_XML_TOK_INVALID:
  9745. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  9746. return int32(_XML_ERROR_INVALID_TOKEN)
  9747. case -int32(1):
  9748. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  9749. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  9750. return int32(_XML_ERROR_NONE)
  9751. }
  9752. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  9753. case -int32(2):
  9754. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  9755. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  9756. return int32(_XML_ERROR_NONE)
  9757. }
  9758. return int32(_XML_ERROR_PARTIAL_CHAR)
  9759. default:
  9760. return int32(_XML_ERROR_JUNK_AFTER_DOC_ELEMENT)
  9761. }
  9762. v2 = *(*uintptr)(unsafe.Pointer(bp))
  9763. s = v2
  9764. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = v2
  9765. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  9766. case int32(_XML_SUSPENDED):
  9767. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  9768. return int32(_XML_ERROR_NONE)
  9769. case int32(_XML_FINISHED):
  9770. return int32(_XML_ERROR_ABORTED)
  9771. default:
  9772. }
  9773. goto _1
  9774. _1:
  9775. }
  9776. return r
  9777. }
  9778. func _processInternalEntity(tls *libc.TLS, parser TXML_Parser, entity uintptr, betweenDecl TXML_Bool) (r _XML_Error) {
  9779. bp := tls.Alloc(16)
  9780. defer tls.Free(16)
  9781. var openEntity, textEnd, textStart uintptr
  9782. var result _XML_Error
  9783. var tok int32
  9784. var _ /* next at bp+0 */ uintptr
  9785. _, _, _, _, _ = openEntity, result, textEnd, textStart, tok
  9786. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities != 0 {
  9787. openEntity = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  9788. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  9789. } else {
  9790. openEntity = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(40))
  9791. if !(openEntity != 0) {
  9792. return int32(_XML_ERROR_NO_MEMORY)
  9793. }
  9794. }
  9795. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  9796. _entityTrackingOnOpen(tls, parser, entity, int32(5732))
  9797. (*TENTITY)(unsafe.Pointer(entity)).Fprocessed = 0
  9798. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  9799. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = openEntity
  9800. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fentity = entity
  9801. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FstartTagLevel = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel
  9802. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FbetweenDecl = betweenDecl
  9803. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FinternalEventPtr = libc.UintptrFromInt32(0)
  9804. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FinternalEventEndPtr = libc.UintptrFromInt32(0)
  9805. textStart = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr
  9806. textEnd = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen)
  9807. /* Set a safe default value in case 'next' does not get set */
  9808. *(*uintptr)(unsafe.Pointer(bp)) = textStart
  9809. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  9810. 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)
  9811. 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))
  9812. } else {
  9813. 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))
  9814. }
  9815. if result == int32(_XML_ERROR_NONE) {
  9816. if textEnd != *(*uintptr)(unsafe.Pointer(bp)) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  9817. (*TENTITY)(unsafe.Pointer(entity)).Fprocessed = int32(int64(*(*uintptr)(unsafe.Pointer(bp))) - int64(textStart))
  9818. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_internalEntityProcessor)
  9819. } else {
  9820. _entityTrackingOnClose(tls, parser, entity, int32(5766))
  9821. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  9822. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  9823. /* put openEntity back in list of free instances */
  9824. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  9825. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = openEntity
  9826. }
  9827. }
  9828. return result
  9829. }
  9830. func _internalEntityProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  9831. bp := tls.Alloc(16)
  9832. defer tls.Free(16)
  9833. var entity, openEntity, textEnd, textStart uintptr
  9834. var result _XML_Error
  9835. var tok, tok1, v1 int32
  9836. var _ /* next at bp+0 */ uintptr
  9837. _, _, _, _, _, _, _, _ = entity, openEntity, result, textEnd, textStart, tok, tok1, v1
  9838. openEntity = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  9839. if !(openEntity != 0) {
  9840. return int32(_XML_ERROR_UNEXPECTED_STATE)
  9841. }
  9842. entity = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fentity
  9843. textStart = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).Fprocessed)
  9844. textEnd = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen)
  9845. /* Set a safe default value in case 'next' does not get set */
  9846. *(*uintptr)(unsafe.Pointer(bp)) = textStart
  9847. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  9848. 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)
  9849. 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))
  9850. } else {
  9851. 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))
  9852. }
  9853. if result != int32(_XML_ERROR_NONE) {
  9854. return result
  9855. }
  9856. if textEnd != *(*uintptr)(unsafe.Pointer(bp)) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  9857. (*TENTITY)(unsafe.Pointer(entity)).Fprocessed = int32(int64(*(*uintptr)(unsafe.Pointer(bp))) - int64((*TENTITY)(unsafe.Pointer(entity)).FtextPtr))
  9858. return result
  9859. }
  9860. _entityTrackingOnClose(tls, parser, entity, int32(5817))
  9861. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  9862. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  9863. /* put openEntity back in list of free instances */
  9864. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  9865. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = openEntity
  9866. // If there are more open entities we want to stop right here and have the
  9867. // upcoming call to XML_ResumeParser continue with entity content, or it would
  9868. // be ignored altogether.
  9869. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != libc.UintptrFromInt32(0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  9870. return int32(_XML_ERROR_NONE)
  9871. }
  9872. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  9873. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  9874. 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)
  9875. 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))
  9876. } else {
  9877. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_contentProcessor)
  9878. /* see externalEntityContentProcessor vs contentProcessor */
  9879. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 {
  9880. v1 = int32(1)
  9881. } else {
  9882. v1 = 0
  9883. }
  9884. 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))
  9885. if result == int32(_XML_ERROR_NONE) {
  9886. if !(_storeRawNames(tls, parser) != 0) {
  9887. return int32(_XML_ERROR_NO_MEMORY)
  9888. }
  9889. }
  9890. return result
  9891. }
  9892. return r
  9893. }
  9894. func _errorProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  9895. _ = s
  9896. _ = end
  9897. _ = nextPtr
  9898. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode
  9899. }
  9900. 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) {
  9901. var result _XML_Error
  9902. var v1 int32
  9903. var v2, v3 uintptr
  9904. _, _, _, _ = result, v1, v2, v3
  9905. result = _appendAttributeValue(tls, parser, enc, isCdata, ptr, end, pool, account)
  9906. if result != 0 {
  9907. return result
  9908. }
  9909. if !(isCdata != 0) && int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart) != 0 && int32(*(*TXML_Char)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20) {
  9910. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr--
  9911. }
  9912. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  9913. v1 = 0
  9914. } else {
  9915. v3 = pool + 24
  9916. v2 = *(*uintptr)(unsafe.Pointer(v3))
  9917. *(*uintptr)(unsafe.Pointer(v3))++
  9918. *(*TXML_Char)(unsafe.Pointer(v2)) = int8('\000')
  9919. v1 = libc.Int32FromInt32(1)
  9920. }
  9921. if !(v1 != 0) {
  9922. return int32(_XML_ERROR_NO_MEMORY)
  9923. }
  9924. return int32(_XML_ERROR_NONE)
  9925. }
  9926. 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) {
  9927. bp := tls.Alloc(16)
  9928. defer tls.Free(16)
  9929. var checkEntityDecl int8
  9930. var dtd, entity, name, textEnd, v10, v11, v4, v5, v7, v8 uintptr
  9931. var i, n, tok, v12, v3, v6, v9 int32
  9932. var result _XML_Error
  9933. var v13 bool
  9934. var _ /* buf at bp+8 */ [4]TXML_Char
  9935. var _ /* ch at bp+12 */ TXML_Char
  9936. var _ /* next at bp+0 */ uintptr
  9937. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = checkEntityDecl, dtd, entity, i, n, name, result, textEnd, tok, v10, v11, v12, v13, v3, v4, v5, v6, v7, v8, v9
  9938. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  9939. for {
  9940. *(*uintptr)(unsafe.Pointer(bp)) = ptr /* XmlAttributeValueTok doesn't always set the last arg */
  9941. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 32))})))(tls, enc, ptr, end, bp)
  9942. if !(_accountingDiffTolerated(tls, parser, tok, ptr, *(*uintptr)(unsafe.Pointer(bp)), int32(5896), account) != 0) {
  9943. _accountingOnAbort(tls, parser)
  9944. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  9945. }
  9946. switch tok {
  9947. case -int32(4):
  9948. return int32(_XML_ERROR_NONE)
  9949. case m_XML_TOK_INVALID:
  9950. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  9951. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  9952. }
  9953. return int32(_XML_ERROR_INVALID_TOKEN)
  9954. case -int32(1):
  9955. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  9956. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  9957. }
  9958. return int32(_XML_ERROR_INVALID_TOKEN)
  9959. case int32(m_XML_TOK_CHAR_REF):
  9960. n = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FcharRefNumber})))(tls, enc, ptr)
  9961. if n < 0 {
  9962. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  9963. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  9964. }
  9965. return int32(_XML_ERROR_BAD_CHAR_REF)
  9966. }
  9967. if !(isCdata != 0) && n == int32(0x20) && (int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart) == 0 || int32(*(*TXML_Char)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20)) {
  9968. break
  9969. }
  9970. n = XXmlUtf8Encode(tls, n, bp+8)
  9971. /* The XmlEncode() functions can never return 0 here. That
  9972. * error return happens if the code point passed in is either
  9973. * negative or greater than or equal to 0x110000. The
  9974. * XmlCharRefNumber() functions will all return a number
  9975. * strictly less than 0x110000 or a negative value if an error
  9976. * occurred. The negative value is intercepted above, so
  9977. * XmlEncode() is never passed a value it might return an
  9978. * error for.
  9979. */
  9980. i = 0
  9981. for {
  9982. if !(i < n) {
  9983. break
  9984. }
  9985. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  9986. v3 = 0
  9987. } else {
  9988. v5 = pool + 24
  9989. v4 = *(*uintptr)(unsafe.Pointer(v5))
  9990. *(*uintptr)(unsafe.Pointer(v5))++
  9991. *(*TXML_Char)(unsafe.Pointer(v4)) = (*(*[4]TXML_Char)(unsafe.Pointer(bp + 8)))[i]
  9992. v3 = libc.Int32FromInt32(1)
  9993. }
  9994. if !(v3 != 0) {
  9995. return int32(_XML_ERROR_NO_MEMORY)
  9996. }
  9997. goto _2
  9998. _2:
  9999. ;
  10000. i++
  10001. }
  10002. case int32(m_XML_TOK_DATA_CHARS):
  10003. if !(_poolAppend(tls, pool, enc, ptr, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  10004. return int32(_XML_ERROR_NO_MEMORY)
  10005. }
  10006. case -int32(3):
  10007. *(*uintptr)(unsafe.Pointer(bp)) = ptr + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  10008. /* fall through */
  10009. fallthrough
  10010. case int32(m_XML_TOK_ATTRIBUTE_VALUE_S):
  10011. fallthrough
  10012. case int32(m_XML_TOK_DATA_NEWLINE):
  10013. if !(isCdata != 0) && (int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart) == 0 || int32(*(*TXML_Char)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20)) {
  10014. break
  10015. }
  10016. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  10017. v6 = 0
  10018. } else {
  10019. v8 = pool + 24
  10020. v7 = *(*uintptr)(unsafe.Pointer(v8))
  10021. *(*uintptr)(unsafe.Pointer(v8))++
  10022. *(*TXML_Char)(unsafe.Pointer(v7)) = int8(0x20)
  10023. v6 = libc.Int32FromInt32(1)
  10024. }
  10025. if !(v6 != 0) {
  10026. return int32(_XML_ERROR_NO_MEMORY)
  10027. }
  10028. case int32(m_XML_TOK_ENTITY_REF):
  10029. *(*TXML_Char)(unsafe.Pointer(bp + 12)) = int8((*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FpredefinedEntityName})))(tls, enc, ptr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)))
  10030. if *(*TXML_Char)(unsafe.Pointer(bp + 12)) != 0 {
  10031. /* NOTE: We are replacing 4-6 characters original input for 1 character
  10032. * so there is no amplification and hence recording without
  10033. * protection. */
  10034. _accountingDiffTolerated(tls, parser, tok, bp+12, bp+12+uintptr(1), int32(5965), int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  10035. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  10036. v9 = 0
  10037. } else {
  10038. v11 = pool + 24
  10039. v10 = *(*uintptr)(unsafe.Pointer(v11))
  10040. *(*uintptr)(unsafe.Pointer(v11))++
  10041. *(*TXML_Char)(unsafe.Pointer(v10)) = *(*TXML_Char)(unsafe.Pointer(bp + 12))
  10042. v9 = libc.Int32FromInt32(1)
  10043. }
  10044. if !(v9 != 0) {
  10045. return int32(_XML_ERROR_NO_MEMORY)
  10046. }
  10047. break
  10048. }
  10049. name = _poolStoreString(tls, parser+832, enc, ptr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  10050. if !(name != 0) {
  10051. return int32(_XML_ERROR_NO_MEMORY)
  10052. }
  10053. entity = _lookup(tls, parser, dtd, name, uint64(0))
  10054. (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fstart
  10055. /* First, determine if a check for an existing declaration is needed;
  10056. if yes, check that the entity exists, and that it is internal.
  10057. */
  10058. if pool == dtd+160 { /* are we called from prolog? */
  10059. if v13 = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FdocumentEntity != 0; v13 {
  10060. if (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0 {
  10061. v12 = libc.BoolInt32(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0))
  10062. } else {
  10063. v12 = libc.BoolInt32(!((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0))
  10064. }
  10065. }
  10066. checkEntityDecl = libc.BoolInt8(v13 && v12 != 0)
  10067. } else { /* if (pool == &parser->m_tempPool): we are called from content */
  10068. checkEntityDecl = libc.BoolInt8(!((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0) || (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0)
  10069. }
  10070. if checkEntityDecl != 0 {
  10071. if !(entity != 0) {
  10072. return int32(_XML_ERROR_UNDEFINED_ENTITY)
  10073. } else {
  10074. if !((*TENTITY)(unsafe.Pointer(entity)).Fis_internal != 0) {
  10075. return int32(_XML_ERROR_ENTITY_DECLARED_IN_PE)
  10076. }
  10077. }
  10078. } else {
  10079. if !(entity != 0) {
  10080. /* Cannot report skipped entity here - see comments on
  10081. parser->m_skippedEntityHandler.
  10082. if (parser->m_skippedEntityHandler)
  10083. parser->m_skippedEntityHandler(parser->m_handlerArg, name, 0);
  10084. */
  10085. /* Cannot call the default handler because this would be
  10086. out of sync with the call to the startElementHandler.
  10087. if ((pool == &parser->m_tempPool) && parser->m_defaultHandler)
  10088. reportDefault(parser, enc, ptr, next);
  10089. */
  10090. break
  10091. }
  10092. }
  10093. if (*TENTITY)(unsafe.Pointer(entity)).Fopen != 0 {
  10094. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  10095. /* It does not appear that this line can be executed.
  10096. *
  10097. * The "if (entity->open)" check catches recursive entity
  10098. * definitions. In order to be called with an open
  10099. * entity, it must have gone through this code before and
  10100. * been through the recursive call to
  10101. * appendAttributeValue() some lines below. That call
  10102. * sets the local encoding ("enc") to the parser's
  10103. * internal encoding (internal_utf8 or internal_utf16),
  10104. * which can never be the same as the principle encoding.
  10105. * It doesn't appear there is another code path that gets
  10106. * here with entity->open being TRUE.
  10107. *
  10108. * Since it is not certain that this logic is watertight,
  10109. * we keep the line and merely exclude it from coverage
  10110. * tests.
  10111. */
  10112. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr /* LCOV_EXCL_LINE */
  10113. }
  10114. return int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  10115. }
  10116. if (*TENTITY)(unsafe.Pointer(entity)).Fnotation != 0 {
  10117. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  10118. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  10119. }
  10120. return int32(_XML_ERROR_BINARY_ENTITY_REF)
  10121. }
  10122. if !((*TENTITY)(unsafe.Pointer(entity)).FtextPtr != 0) {
  10123. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  10124. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  10125. }
  10126. return int32(_XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF)
  10127. } else {
  10128. textEnd = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen)
  10129. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  10130. _entityTrackingOnOpen(tls, parser, entity, int32(6046))
  10131. result = _appendAttributeValue(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding, isCdata, (*TENTITY)(unsafe.Pointer(entity)).FtextPtr, textEnd, pool, int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  10132. _entityTrackingOnClose(tls, parser, entity, int32(6053))
  10133. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  10134. if result != 0 {
  10135. return result
  10136. }
  10137. }
  10138. default:
  10139. /* The only token returned by XmlAttributeValueTok() that does
  10140. * not have an explicit case here is XML_TOK_PARTIAL_CHAR.
  10141. * Getting that would require an entity name to contain an
  10142. * incomplete XML character (e.g. \xE2\x82); however previous
  10143. * tokenisers will have already recognised and rejected such
  10144. * names before XmlAttributeValueTok() gets a look-in. This
  10145. * default case should be retained as a safety net, but the code
  10146. * excluded from coverage tests.
  10147. *
  10148. * LCOV_EXCL_START
  10149. */
  10150. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  10151. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  10152. }
  10153. return int32(_XML_ERROR_UNEXPECTED_STATE)
  10154. /* LCOV_EXCL_STOP */
  10155. }
  10156. ptr = *(*uintptr)(unsafe.Pointer(bp))
  10157. goto _1
  10158. _1:
  10159. }
  10160. /* not reached */
  10161. return r
  10162. }
  10163. func _storeEntityValue(tls *libc.TLS, parser TXML_Parser, enc uintptr, entityTextPtr uintptr, entityTextEnd uintptr, account _XML_Account) (r _XML_Error) {
  10164. bp := tls.Alloc(16)
  10165. defer tls.Free(16)
  10166. var dtd, entity, name, pool, v2, v3, v5, v6 uintptr
  10167. var i, n, oldInEntityValue, tok int32
  10168. var result _XML_Error
  10169. var _ /* buf at bp+8 */ [4]TXML_Char
  10170. var _ /* next at bp+0 */ uintptr
  10171. _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, entity, i, n, name, oldInEntityValue, pool, result, tok, v2, v3, v5, v6
  10172. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  10173. pool = dtd + 208
  10174. result = int32(_XML_ERROR_NONE)
  10175. oldInEntityValue = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue
  10176. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue = int32(1)
  10177. /* never return Null for the value argument in EntityDeclHandler,
  10178. since this would indicate an external entity; therefore we
  10179. have to make sure that entityValuePool.start is not null */
  10180. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks != 0) {
  10181. if !(_poolGrow(tls, pool) != 0) {
  10182. return int32(_XML_ERROR_NO_MEMORY)
  10183. }
  10184. }
  10185. for {
  10186. *(*uintptr)(unsafe.Pointer(bp)) = entityTextPtr /* XmlEntityValueTok doesn't always set the last arg */
  10187. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 32 + 1*8))})))(tls, enc, entityTextPtr, entityTextEnd, bp)
  10188. if !(_accountingDiffTolerated(tls, parser, tok, entityTextPtr, *(*uintptr)(unsafe.Pointer(bp)), int32(6109), account) != 0) {
  10189. _accountingOnAbort(tls, parser)
  10190. result = int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  10191. goto endEntityValue
  10192. }
  10193. switch tok {
  10194. case int32(m_XML_TOK_PARAM_ENTITY_REF):
  10195. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0 || enc != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  10196. name = _poolStoreString(tls, parser+784, enc, entityTextPtr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  10197. if !(name != 0) {
  10198. result = int32(_XML_ERROR_NO_MEMORY)
  10199. goto endEntityValue
  10200. }
  10201. entity = _lookup(tls, parser, dtd+264, name, uint64(0))
  10202. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  10203. if !(entity != 0) {
  10204. /* not a well-formedness error - see XML 1.0: WFC Entity Declared */
  10205. /* cannot report skipped entity here - see comments on
  10206. parser->m_skippedEntityHandler
  10207. if (parser->m_skippedEntityHandler)
  10208. parser->m_skippedEntityHandler(parser->m_handlerArg, name, 0);
  10209. */
  10210. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  10211. goto endEntityValue
  10212. }
  10213. if (*TENTITY)(unsafe.Pointer(entity)).Fopen != 0 {
  10214. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  10215. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  10216. }
  10217. result = int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  10218. goto endEntityValue
  10219. }
  10220. if (*TENTITY)(unsafe.Pointer(entity)).FsystemId != 0 {
  10221. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  10222. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  10223. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  10224. _entityTrackingOnOpen(tls, parser, entity, int32(6152))
  10225. 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) {
  10226. _entityTrackingOnClose(tls, parser, entity, int32(6156))
  10227. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  10228. result = int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  10229. goto endEntityValue
  10230. }
  10231. _entityTrackingOnClose(tls, parser, entity, int32(6161))
  10232. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  10233. if !((*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0) {
  10234. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  10235. }
  10236. } else {
  10237. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  10238. }
  10239. } else {
  10240. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  10241. _entityTrackingOnOpen(tls, parser, entity, int32(6169))
  10242. 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))
  10243. _entityTrackingOnClose(tls, parser, entity, int32(6174))
  10244. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  10245. if result != 0 {
  10246. goto endEntityValue
  10247. }
  10248. }
  10249. break
  10250. }
  10251. /* In the internal subset, PE references are not legal
  10252. within markup declarations, e.g entity values in this case. */
  10253. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  10254. result = int32(_XML_ERROR_PARAM_ENTITY_REF)
  10255. goto endEntityValue
  10256. case -int32(4):
  10257. result = int32(_XML_ERROR_NONE)
  10258. goto endEntityValue
  10259. case int32(m_XML_TOK_ENTITY_REF):
  10260. fallthrough
  10261. case int32(m_XML_TOK_DATA_CHARS):
  10262. if !(_poolAppend(tls, pool, enc, entityTextPtr, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  10263. result = int32(_XML_ERROR_NO_MEMORY)
  10264. goto endEntityValue
  10265. }
  10266. case -int32(3):
  10267. *(*uintptr)(unsafe.Pointer(bp)) = entityTextPtr + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  10268. /* fall through */
  10269. fallthrough
  10270. case int32(m_XML_TOK_DATA_NEWLINE):
  10271. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr && !(_poolGrow(tls, pool) != 0) {
  10272. result = int32(_XML_ERROR_NO_MEMORY)
  10273. goto endEntityValue
  10274. }
  10275. v3 = pool + 24
  10276. v2 = *(*uintptr)(unsafe.Pointer(v3))
  10277. *(*uintptr)(unsafe.Pointer(v3))++
  10278. *(*TXML_Char)(unsafe.Pointer(v2)) = int8(0xA)
  10279. case int32(m_XML_TOK_CHAR_REF):
  10280. n = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FcharRefNumber})))(tls, enc, entityTextPtr)
  10281. if n < 0 {
  10282. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  10283. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  10284. }
  10285. result = int32(_XML_ERROR_BAD_CHAR_REF)
  10286. goto endEntityValue
  10287. }
  10288. n = XXmlUtf8Encode(tls, n, bp+8)
  10289. /* The XmlEncode() functions can never return 0 here. That
  10290. * error return happens if the code point passed in is either
  10291. * negative or greater than or equal to 0x110000. The
  10292. * XmlCharRefNumber() functions will all return a number
  10293. * strictly less than 0x110000 or a negative value if an error
  10294. * occurred. The negative value is intercepted above, so
  10295. * XmlEncode() is never passed a value it might return an
  10296. * error for.
  10297. */
  10298. i = 0
  10299. for {
  10300. if !(i < n) {
  10301. break
  10302. }
  10303. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr && !(_poolGrow(tls, pool) != 0) {
  10304. result = int32(_XML_ERROR_NO_MEMORY)
  10305. goto endEntityValue
  10306. }
  10307. v6 = pool + 24
  10308. v5 = *(*uintptr)(unsafe.Pointer(v6))
  10309. *(*uintptr)(unsafe.Pointer(v6))++
  10310. *(*TXML_Char)(unsafe.Pointer(v5)) = (*(*[4]TXML_Char)(unsafe.Pointer(bp + 8)))[i]
  10311. goto _4
  10312. _4:
  10313. ;
  10314. i++
  10315. }
  10316. case -int32(1):
  10317. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  10318. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  10319. }
  10320. result = int32(_XML_ERROR_INVALID_TOKEN)
  10321. goto endEntityValue
  10322. case m_XML_TOK_INVALID:
  10323. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  10324. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  10325. }
  10326. result = int32(_XML_ERROR_INVALID_TOKEN)
  10327. goto endEntityValue
  10328. default:
  10329. /* This default case should be unnecessary -- all the tokens
  10330. * that XmlEntityValueTok() can return have their own explicit
  10331. * cases -- but should be retained for safety. We do however
  10332. * exclude it from the coverage statistics.
  10333. *
  10334. * LCOV_EXCL_START
  10335. */
  10336. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  10337. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  10338. }
  10339. result = int32(_XML_ERROR_UNEXPECTED_STATE)
  10340. goto endEntityValue
  10341. /* LCOV_EXCL_STOP */
  10342. }
  10343. entityTextPtr = *(*uintptr)(unsafe.Pointer(bp))
  10344. goto _1
  10345. _1:
  10346. }
  10347. goto endEntityValue
  10348. endEntityValue:
  10349. ;
  10350. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue = oldInEntityValue
  10351. return result
  10352. }
  10353. func _normalizeLines(tls *libc.TLS, s uintptr) {
  10354. var p, v2, v3, v4, v5 uintptr
  10355. _, _, _, _, _ = p, v2, v3, v4, v5
  10356. for {
  10357. if int32(*(*TXML_Char)(unsafe.Pointer(s))) == int32('\000') {
  10358. return
  10359. }
  10360. if int32(*(*TXML_Char)(unsafe.Pointer(s))) == int32(0xD) {
  10361. break
  10362. }
  10363. goto _1
  10364. _1:
  10365. ;
  10366. s++
  10367. }
  10368. p = s
  10369. for cond := true; cond; cond = *(*TXML_Char)(unsafe.Pointer(s)) != 0 {
  10370. if int32(*(*TXML_Char)(unsafe.Pointer(s))) == int32(0xD) {
  10371. v2 = p
  10372. p++
  10373. *(*TXML_Char)(unsafe.Pointer(v2)) = int8(0xA)
  10374. s++
  10375. v3 = s
  10376. if int32(*(*TXML_Char)(unsafe.Pointer(v3))) == int32(0xA) {
  10377. s++
  10378. }
  10379. } else {
  10380. v4 = p
  10381. p++
  10382. v5 = s
  10383. s++
  10384. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(v5))
  10385. }
  10386. }
  10387. *(*TXML_Char)(unsafe.Pointer(p)) = int8('\000')
  10388. }
  10389. func _reportProcessingInstruction(tls *libc.TLS, parser TXML_Parser, enc uintptr, start uintptr, end uintptr) (r int32) {
  10390. var data, target, tem uintptr
  10391. _, _, _ = data, target, tem
  10392. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler != 0) {
  10393. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  10394. _reportDefault(tls, parser, enc, start, end)
  10395. }
  10396. return int32(1)
  10397. }
  10398. start += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar * int32(2))
  10399. tem = start + uintptr((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameLength})))(tls, enc, start))
  10400. target = _poolStoreString(tls, parser+784, enc, start, tem)
  10401. if !(target != 0) {
  10402. return 0
  10403. }
  10404. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  10405. data = _poolStoreString(tls, parser+784, enc, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FskipS})))(tls, enc, tem), end-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(2)))
  10406. if !(data != 0) {
  10407. return 0
  10408. }
  10409. _normalizeLines(tls, data)
  10410. (*(*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)
  10411. _poolClear(tls, parser+784)
  10412. return int32(1)
  10413. }
  10414. func _reportComment(tls *libc.TLS, parser TXML_Parser, enc uintptr, start uintptr, end uintptr) (r int32) {
  10415. var data uintptr
  10416. _ = data
  10417. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler != 0) {
  10418. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  10419. _reportDefault(tls, parser, enc, start, end)
  10420. }
  10421. return int32(1)
  10422. }
  10423. data = _poolStoreString(tls, parser+784, enc, start+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(4)), end-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(3)))
  10424. if !(data != 0) {
  10425. return 0
  10426. }
  10427. _normalizeLines(tls, data)
  10428. (*(*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)
  10429. _poolClear(tls, parser+784)
  10430. return int32(1)
  10431. }
  10432. func _reportDefault(tls *libc.TLS, parser TXML_Parser, enc uintptr, _s uintptr, end uintptr) {
  10433. bp := tls.Alloc(16)
  10434. defer tls.Free(16)
  10435. *(*uintptr)(unsafe.Pointer(bp)) = _s
  10436. var convert_res _XML_Convert_Result
  10437. var eventEndPP, eventPP uintptr
  10438. var _ /* dataPtr at bp+8 */ uintptr
  10439. _, _, _ = convert_res, eventEndPP, eventPP
  10440. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  10441. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  10442. eventPP = parser + 544
  10443. eventEndPP = parser + 552
  10444. } else {
  10445. /* To get here, two things must be true; the parser must be
  10446. * using a character encoding that is not the same as the
  10447. * encoding passed in, and the encoding passed in must need
  10448. * conversion to the internal format (UTF-8 unless XML_UNICODE
  10449. * is defined). The only occasions on which the encoding passed
  10450. * in is not the same as the parser's encoding are when it is
  10451. * the internal encoding (e.g. a previously defined parameter
  10452. * entity, already converted to internal format). This by
  10453. * definition doesn't need conversion, so the whole branch never
  10454. * gets executed.
  10455. *
  10456. * For safety's sake we don't delete these lines and merely
  10457. * exclude them from coverage statistics.
  10458. *
  10459. * LCOV_EXCL_START
  10460. */
  10461. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  10462. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  10463. /* LCOV_EXCL_STOP */
  10464. }
  10465. for cond := true; cond; cond = convert_res != int32(_XML_CONVERT_COMPLETED) && convert_res != int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  10466. *(*uintptr)(unsafe.Pointer(bp + 8)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  10467. convert_res = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, end, bp+8, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd)
  10468. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  10469. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf, int32(int64(*(*uintptr)(unsafe.Pointer(bp + 8)))-int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf)))
  10470. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  10471. }
  10472. } else {
  10473. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, *(*uintptr)(unsafe.Pointer(bp)), int32(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp)))))
  10474. }
  10475. }
  10476. func _defineAttribute(tls *libc.TLS, type1 uintptr, attId uintptr, isCdata TXML_Bool, isId TXML_Bool, value uintptr, parser TXML_Parser) (r int32) {
  10477. var att, temp uintptr
  10478. var count, i int32
  10479. _, _, _, _ = att, count, i, temp
  10480. if value != 0 || isId != 0 {
  10481. i = 0
  10482. for {
  10483. if !(i < (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FnDefaultAtts) {
  10484. break
  10485. }
  10486. if attId == (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts + uintptr(i)*24))).Fid {
  10487. return int32(1)
  10488. }
  10489. goto _1
  10490. _1:
  10491. ;
  10492. i++
  10493. }
  10494. if isId != 0 && !((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FidAtt != 0) && !((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fxmlns != 0) {
  10495. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FidAtt = attId
  10496. }
  10497. }
  10498. if (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FnDefaultAtts == (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts {
  10499. if (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts == 0 {
  10500. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts = int32(8)
  10501. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts)*libc.Uint64FromInt64(24))
  10502. if !((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts != 0) {
  10503. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts = 0
  10504. return 0
  10505. }
  10506. } else {
  10507. /* Detect and prevent integer overflow */
  10508. if (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts > libc.Int32FromInt32(m___INT_MAX__)/libc.Int32FromInt32(2) {
  10509. return 0
  10510. }
  10511. count = (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts * int32(2)
  10512. /* Detect and prevent integer overflow.
  10513. * The preprocessor guard addresses the "always false" warning
  10514. * from -Wtype-limits on platforms where
  10515. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  10516. temp = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts, libc.Uint64FromInt32(count)*libc.Uint64FromInt64(24))
  10517. if temp == libc.UintptrFromInt32(0) {
  10518. return 0
  10519. }
  10520. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts = count
  10521. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts = temp
  10522. }
  10523. }
  10524. att = (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts + uintptr((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FnDefaultAtts)*24
  10525. (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(att)).Fid = attId
  10526. (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(att)).Fvalue = value
  10527. (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(att)).FisCdata = isCdata
  10528. if !(isCdata != 0) {
  10529. (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).FmaybeTokenized = libc.Uint8FromInt32(1)
  10530. }
  10531. *(*int32)(unsafe.Pointer(type1 + 24)) += int32(1)
  10532. return int32(1)
  10533. }
  10534. func _setElementTypePrefix(tls *libc.TLS, parser TXML_Parser, elementType uintptr) (r int32) {
  10535. var dtd, name, prefix, s, v4, v5, v7, v8 uintptr
  10536. var v3, v6 int32
  10537. _, _, _, _, _, _, _, _, _, _ = dtd, name, prefix, s, v3, v4, v5, v6, v7, v8
  10538. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  10539. name = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fname
  10540. for {
  10541. if !(*(*TXML_Char)(unsafe.Pointer(name)) != 0) {
  10542. break
  10543. }
  10544. if int32(*(*TXML_Char)(unsafe.Pointer(name))) == int32(m_ASCII_COLON) {
  10545. s = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fname
  10546. for {
  10547. if !(s != name) {
  10548. break
  10549. }
  10550. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  10551. v3 = 0
  10552. } else {
  10553. v5 = dtd + 160 + 24
  10554. v4 = *(*uintptr)(unsafe.Pointer(v5))
  10555. *(*uintptr)(unsafe.Pointer(v5))++
  10556. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(s))
  10557. v3 = libc.Int32FromInt32(1)
  10558. }
  10559. if !(v3 != 0) {
  10560. return 0
  10561. }
  10562. goto _2
  10563. _2:
  10564. ;
  10565. s++
  10566. }
  10567. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  10568. v6 = 0
  10569. } else {
  10570. v8 = dtd + 160 + 24
  10571. v7 = *(*uintptr)(unsafe.Pointer(v8))
  10572. *(*uintptr)(unsafe.Pointer(v8))++
  10573. *(*TXML_Char)(unsafe.Pointer(v7)) = int8('\000')
  10574. v6 = libc.Int32FromInt32(1)
  10575. }
  10576. if !(v6 != 0) {
  10577. return 0
  10578. }
  10579. prefix = _lookup(tls, parser, dtd+120, (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fstart, uint64(16))
  10580. if !(prefix != 0) {
  10581. return 0
  10582. }
  10583. if (*TPREFIX)(unsafe.Pointer(prefix)).Fname == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fstart {
  10584. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  10585. } else {
  10586. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  10587. }
  10588. (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fprefix = prefix
  10589. break
  10590. }
  10591. goto _1
  10592. _1:
  10593. ;
  10594. name++
  10595. }
  10596. return int32(1)
  10597. }
  10598. func _getAttributeId(tls *libc.TLS, parser TXML_Parser, enc uintptr, start uintptr, end uintptr) (r uintptr) {
  10599. var dtd, id, name, v10, v11, v2, v3, v7, v8 uintptr
  10600. var i, j, v1, v6, v9 int32
  10601. _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, i, id, j, name, v1, v10, v11, v2, v3, v6, v7, v8, v9
  10602. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  10603. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  10604. v1 = 0
  10605. } else {
  10606. v3 = dtd + 160 + 24
  10607. v2 = *(*uintptr)(unsafe.Pointer(v3))
  10608. *(*uintptr)(unsafe.Pointer(v3))++
  10609. *(*TXML_Char)(unsafe.Pointer(v2)) = int8('\000')
  10610. v1 = libc.Int32FromInt32(1)
  10611. }
  10612. if !(v1 != 0) {
  10613. return libc.UintptrFromInt32(0)
  10614. }
  10615. name = _poolStoreString(tls, dtd+160, enc, start, end)
  10616. if !(name != 0) {
  10617. return libc.UintptrFromInt32(0)
  10618. }
  10619. /* skip quotation mark - its storage will be re-used (like in name[-1]) */
  10620. name++
  10621. id = _lookup(tls, parser, dtd+80, name, uint64(24))
  10622. if !(id != 0) {
  10623. return libc.UintptrFromInt32(0)
  10624. }
  10625. if (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fname != name {
  10626. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  10627. } else {
  10628. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  10629. if !!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0) {
  10630. if int32(*(*TXML_Char)(unsafe.Pointer(name))) == int32(m_ASCII_x) && int32(*(*TXML_Char)(unsafe.Pointer(name + 1))) == int32(m_ASCII_m) && int32(*(*TXML_Char)(unsafe.Pointer(name + 2))) == int32(m_ASCII_l) && int32(*(*TXML_Char)(unsafe.Pointer(name + 3))) == int32(m_ASCII_n) && int32(*(*TXML_Char)(unsafe.Pointer(name + 4))) == int32(m_ASCII_s) && (int32(*(*TXML_Char)(unsafe.Pointer(name + 5))) == int32('\000') || int32(*(*TXML_Char)(unsafe.Pointer(name + 5))) == int32(m_ASCII_COLON)) {
  10631. if int32(*(*TXML_Char)(unsafe.Pointer(name + 5))) == int32('\000') {
  10632. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix = dtd + 304
  10633. } else {
  10634. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix = _lookup(tls, parser, dtd+120, name+uintptr(6), uint64(16))
  10635. }
  10636. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fxmlns = libc.Uint8FromInt32(1)
  10637. } else {
  10638. i = 0
  10639. for {
  10640. if !(*(*TXML_Char)(unsafe.Pointer(name + uintptr(i))) != 0) {
  10641. break
  10642. }
  10643. /* attributes without prefix are *not* in the default namespace */
  10644. if int32(*(*TXML_Char)(unsafe.Pointer(name + uintptr(i)))) == int32(m_ASCII_COLON) {
  10645. j = 0
  10646. for {
  10647. if !(j < i) {
  10648. break
  10649. }
  10650. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  10651. v6 = 0
  10652. } else {
  10653. v8 = dtd + 160 + 24
  10654. v7 = *(*uintptr)(unsafe.Pointer(v8))
  10655. *(*uintptr)(unsafe.Pointer(v8))++
  10656. *(*TXML_Char)(unsafe.Pointer(v7)) = *(*TXML_Char)(unsafe.Pointer(name + uintptr(j)))
  10657. v6 = libc.Int32FromInt32(1)
  10658. }
  10659. if !(v6 != 0) {
  10660. return libc.UintptrFromInt32(0)
  10661. }
  10662. goto _5
  10663. _5:
  10664. ;
  10665. j++
  10666. }
  10667. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  10668. v9 = 0
  10669. } else {
  10670. v11 = dtd + 160 + 24
  10671. v10 = *(*uintptr)(unsafe.Pointer(v11))
  10672. *(*uintptr)(unsafe.Pointer(v11))++
  10673. *(*TXML_Char)(unsafe.Pointer(v10)) = int8('\000')
  10674. v9 = libc.Int32FromInt32(1)
  10675. }
  10676. if !(v9 != 0) {
  10677. return libc.UintptrFromInt32(0)
  10678. }
  10679. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix = _lookup(tls, parser, dtd+120, (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fstart, uint64(16))
  10680. if !((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix != 0) {
  10681. return libc.UintptrFromInt32(0)
  10682. }
  10683. if (*TPREFIX)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix)).Fname == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fstart {
  10684. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  10685. } else {
  10686. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  10687. }
  10688. break
  10689. }
  10690. goto _4
  10691. _4:
  10692. ;
  10693. i++
  10694. }
  10695. }
  10696. }
  10697. }
  10698. return id
  10699. }
  10700. func _getContext(tls *libc.TLS, parser TXML_Parser) (r uintptr) {
  10701. bp := tls.Alloc(16)
  10702. defer tls.Free(16)
  10703. 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
  10704. var i, i1, len1, len11, v1, v14, v17, v21, v25, v30, v33, v5, v9 int32
  10705. var needSep TXML_Bool
  10706. var v12, v28 bool
  10707. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  10708. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  10709. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  10710. needSep = libc.Uint8FromInt32(0)
  10711. if (*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding != 0 {
  10712. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  10713. v1 = 0
  10714. } else {
  10715. v3 = parser + 784 + 24
  10716. v2 = *(*uintptr)(unsafe.Pointer(v3))
  10717. *(*uintptr)(unsafe.Pointer(v3))++
  10718. *(*TXML_Char)(unsafe.Pointer(v2)) = int8(m_ASCII_EQUALS)
  10719. v1 = libc.Int32FromInt32(1)
  10720. }
  10721. if !(v1 != 0) {
  10722. return libc.UintptrFromInt32(0)
  10723. }
  10724. len1 = (*TBINDING)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding)).FuriLen
  10725. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  10726. len1--
  10727. }
  10728. i = 0
  10729. for {
  10730. if !(i < len1) {
  10731. break
  10732. }
  10733. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  10734. v5 = 0
  10735. } else {
  10736. v7 = parser + 784 + 24
  10737. v6 = *(*uintptr)(unsafe.Pointer(v7))
  10738. *(*uintptr)(unsafe.Pointer(v7))++
  10739. *(*TXML_Char)(unsafe.Pointer(v6)) = *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding)).Furi + uintptr(i)))
  10740. v5 = libc.Int32FromInt32(1)
  10741. }
  10742. if !(v5 != 0) {
  10743. /* Because of memory caching, I don't believe this line can be
  10744. * executed.
  10745. *
  10746. * This is part of a loop copying the default prefix binding
  10747. * URI into the parser's temporary string pool. Previously,
  10748. * that URI was copied into the same string pool, with a
  10749. * terminating NUL character, as part of setContext(). When
  10750. * the pool was cleared, that leaves a block definitely big
  10751. * enough to hold the URI on the free block list of the pool.
  10752. * The URI copy in getContext() therefore cannot run out of
  10753. * memory.
  10754. *
  10755. * If the pool is used between the setContext() and
  10756. * getContext() calls, the worst it can do is leave a bigger
  10757. * block on the front of the free list. Given that this is
  10758. * all somewhat inobvious and program logic can be changed, we
  10759. * don't delete the line but we do exclude it from the test
  10760. * coverage statistics.
  10761. */
  10762. return libc.UintptrFromInt32(0) /* LCOV_EXCL_LINE */
  10763. }
  10764. goto _4
  10765. _4:
  10766. ;
  10767. i++
  10768. }
  10769. needSep = libc.Uint8FromInt32(1)
  10770. }
  10771. _hashTableIterInit(tls, bp, dtd+120)
  10772. for {
  10773. prefix = _hashTableIterNext(tls, bp)
  10774. if !(prefix != 0) {
  10775. break
  10776. }
  10777. if !((*TPREFIX)(unsafe.Pointer(prefix)).Fbinding != 0) {
  10778. /* This test appears to be (justifiable) paranoia. There does
  10779. * not seem to be a way of injecting a prefix without a binding
  10780. * that doesn't get errored long before this function is called.
  10781. * The test should remain for safety's sake, so we instead
  10782. * exclude the following line from the coverage statistics.
  10783. */
  10784. goto _8 /* LCOV_EXCL_LINE */
  10785. }
  10786. if v12 = needSep != 0; v12 {
  10787. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  10788. v9 = 0
  10789. } else {
  10790. v11 = parser + 784 + 24
  10791. v10 = *(*uintptr)(unsafe.Pointer(v11))
  10792. *(*uintptr)(unsafe.Pointer(v11))++
  10793. *(*TXML_Char)(unsafe.Pointer(v10)) = int8(m_ASCII_FF)
  10794. v9 = libc.Int32FromInt32(1)
  10795. }
  10796. }
  10797. if v12 && !(v9 != 0) {
  10798. return libc.UintptrFromInt32(0)
  10799. }
  10800. s = (*TPREFIX)(unsafe.Pointer(prefix)).Fname
  10801. for {
  10802. if !(*(*TXML_Char)(unsafe.Pointer(s)) != 0) {
  10803. break
  10804. }
  10805. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  10806. v14 = 0
  10807. } else {
  10808. v16 = parser + 784 + 24
  10809. v15 = *(*uintptr)(unsafe.Pointer(v16))
  10810. *(*uintptr)(unsafe.Pointer(v16))++
  10811. *(*TXML_Char)(unsafe.Pointer(v15)) = *(*TXML_Char)(unsafe.Pointer(s))
  10812. v14 = libc.Int32FromInt32(1)
  10813. }
  10814. if !(v14 != 0) {
  10815. return libc.UintptrFromInt32(0)
  10816. }
  10817. goto _13
  10818. _13:
  10819. ;
  10820. s++
  10821. }
  10822. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  10823. v17 = 0
  10824. } else {
  10825. v19 = parser + 784 + 24
  10826. v18 = *(*uintptr)(unsafe.Pointer(v19))
  10827. *(*uintptr)(unsafe.Pointer(v19))++
  10828. *(*TXML_Char)(unsafe.Pointer(v18)) = int8(m_ASCII_EQUALS)
  10829. v17 = libc.Int32FromInt32(1)
  10830. }
  10831. if !(v17 != 0) {
  10832. return libc.UintptrFromInt32(0)
  10833. }
  10834. len11 = (*TBINDING)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fbinding)).FuriLen
  10835. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  10836. len11--
  10837. }
  10838. i1 = 0
  10839. for {
  10840. if !(i1 < len11) {
  10841. break
  10842. }
  10843. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  10844. v21 = 0
  10845. } else {
  10846. v23 = parser + 784 + 24
  10847. v22 = *(*uintptr)(unsafe.Pointer(v23))
  10848. *(*uintptr)(unsafe.Pointer(v23))++
  10849. *(*TXML_Char)(unsafe.Pointer(v22)) = *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fbinding)).Furi + uintptr(i1)))
  10850. v21 = libc.Int32FromInt32(1)
  10851. }
  10852. if !(v21 != 0) {
  10853. return libc.UintptrFromInt32(0)
  10854. }
  10855. goto _20
  10856. _20:
  10857. ;
  10858. i1++
  10859. }
  10860. needSep = libc.Uint8FromInt32(1)
  10861. goto _8
  10862. _8:
  10863. }
  10864. _hashTableIterInit(tls, bp, dtd)
  10865. for {
  10866. e = _hashTableIterNext(tls, bp)
  10867. if !(e != 0) {
  10868. break
  10869. }
  10870. if !((*TENTITY)(unsafe.Pointer(e)).Fopen != 0) {
  10871. goto _24
  10872. }
  10873. if v28 = needSep != 0; v28 {
  10874. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  10875. v25 = 0
  10876. } else {
  10877. v27 = parser + 784 + 24
  10878. v26 = *(*uintptr)(unsafe.Pointer(v27))
  10879. *(*uintptr)(unsafe.Pointer(v27))++
  10880. *(*TXML_Char)(unsafe.Pointer(v26)) = int8(m_ASCII_FF)
  10881. v25 = libc.Int32FromInt32(1)
  10882. }
  10883. }
  10884. if v28 && !(v25 != 0) {
  10885. return libc.UintptrFromInt32(0)
  10886. }
  10887. s1 = (*TENTITY)(unsafe.Pointer(e)).Fname
  10888. for {
  10889. if !(*(*TXML_Char)(unsafe.Pointer(s1)) != 0) {
  10890. break
  10891. }
  10892. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  10893. v30 = 0
  10894. } else {
  10895. v32 = parser + 784 + 24
  10896. v31 = *(*uintptr)(unsafe.Pointer(v32))
  10897. *(*uintptr)(unsafe.Pointer(v32))++
  10898. *(*TXML_Char)(unsafe.Pointer(v31)) = *(*TXML_Char)(unsafe.Pointer(s1))
  10899. v30 = libc.Int32FromInt32(1)
  10900. }
  10901. if !(v30 != 0) {
  10902. return uintptr(0)
  10903. }
  10904. goto _29
  10905. _29:
  10906. ;
  10907. s1++
  10908. }
  10909. needSep = libc.Uint8FromInt32(1)
  10910. goto _24
  10911. _24:
  10912. }
  10913. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  10914. v33 = 0
  10915. } else {
  10916. v35 = parser + 784 + 24
  10917. v34 = *(*uintptr)(unsafe.Pointer(v35))
  10918. *(*uintptr)(unsafe.Pointer(v35))++
  10919. *(*TXML_Char)(unsafe.Pointer(v34)) = int8('\000')
  10920. v33 = libc.Int32FromInt32(1)
  10921. }
  10922. if !(v33 != 0) {
  10923. return libc.UintptrFromInt32(0)
  10924. }
  10925. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  10926. }
  10927. func _setContext(tls *libc.TLS, parser TXML_Parser, context uintptr) (r TXML_Bool) {
  10928. var dtd, e, prefix, s, v10, v12, v13, v15, v16, v2, v3, v5, v6, v9 uintptr
  10929. var v1, v11, v14, v4, v8 int32
  10930. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, e, prefix, s, v1, v10, v11, v12, v13, v14, v15, v16, v2, v3, v4, v5, v6, v8, v9
  10931. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  10932. s = context
  10933. for int32(*(*TXML_Char)(unsafe.Pointer(context))) != int32('\000') {
  10934. if int32(*(*TXML_Char)(unsafe.Pointer(s))) == int32(m_ASCII_FF) || int32(*(*TXML_Char)(unsafe.Pointer(s))) == int32('\000') {
  10935. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  10936. v1 = 0
  10937. } else {
  10938. v3 = parser + 784 + 24
  10939. v2 = *(*uintptr)(unsafe.Pointer(v3))
  10940. *(*uintptr)(unsafe.Pointer(v3))++
  10941. *(*TXML_Char)(unsafe.Pointer(v2)) = int8('\000')
  10942. v1 = libc.Int32FromInt32(1)
  10943. }
  10944. if !(v1 != 0) {
  10945. return libc.Uint8FromInt32(0)
  10946. }
  10947. e = _lookup(tls, parser, dtd, (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart, uint64(0))
  10948. if e != 0 {
  10949. (*TENTITY)(unsafe.Pointer(e)).Fopen = libc.Uint8FromInt32(1)
  10950. }
  10951. if int32(*(*TXML_Char)(unsafe.Pointer(s))) != int32('\000') {
  10952. s++
  10953. }
  10954. context = s
  10955. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  10956. } else {
  10957. if int32(*(*TXML_Char)(unsafe.Pointer(s))) == int32(m_ASCII_EQUALS) {
  10958. if int64((*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart) == 0 {
  10959. prefix = dtd + 304
  10960. } else {
  10961. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  10962. v4 = 0
  10963. } else {
  10964. v6 = parser + 784 + 24
  10965. v5 = *(*uintptr)(unsafe.Pointer(v6))
  10966. *(*uintptr)(unsafe.Pointer(v6))++
  10967. *(*TXML_Char)(unsafe.Pointer(v5)) = int8('\000')
  10968. v4 = libc.Int32FromInt32(1)
  10969. }
  10970. if !(v4 != 0) {
  10971. return libc.Uint8FromInt32(0)
  10972. }
  10973. prefix = _lookup(tls, parser, dtd+120, (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart, uint64(16))
  10974. if !(prefix != 0) {
  10975. return libc.Uint8FromInt32(0)
  10976. }
  10977. if (*TPREFIX)(unsafe.Pointer(prefix)).Fname == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart {
  10978. (*TPREFIX)(unsafe.Pointer(prefix)).Fname = _poolCopyString(tls, dtd+160, (*TPREFIX)(unsafe.Pointer(prefix)).Fname)
  10979. if !((*TPREFIX)(unsafe.Pointer(prefix)).Fname != 0) {
  10980. return libc.Uint8FromInt32(0)
  10981. }
  10982. }
  10983. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  10984. }
  10985. context = s + uintptr(1)
  10986. for {
  10987. if !(int32(*(*TXML_Char)(unsafe.Pointer(context))) != int32(m_ASCII_FF) && int32(*(*TXML_Char)(unsafe.Pointer(context))) != int32('\000')) {
  10988. break
  10989. }
  10990. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  10991. v8 = 0
  10992. } else {
  10993. v10 = parser + 784 + 24
  10994. v9 = *(*uintptr)(unsafe.Pointer(v10))
  10995. *(*uintptr)(unsafe.Pointer(v10))++
  10996. *(*TXML_Char)(unsafe.Pointer(v9)) = *(*TXML_Char)(unsafe.Pointer(context))
  10997. v8 = libc.Int32FromInt32(1)
  10998. }
  10999. if !(v8 != 0) {
  11000. return libc.Uint8FromInt32(0)
  11001. }
  11002. goto _7
  11003. _7:
  11004. ;
  11005. context++
  11006. }
  11007. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  11008. v11 = 0
  11009. } else {
  11010. v13 = parser + 784 + 24
  11011. v12 = *(*uintptr)(unsafe.Pointer(v13))
  11012. *(*uintptr)(unsafe.Pointer(v13))++
  11013. *(*TXML_Char)(unsafe.Pointer(v12)) = int8('\000')
  11014. v11 = libc.Int32FromInt32(1)
  11015. }
  11016. if !(v11 != 0) {
  11017. return libc.Uint8FromInt32(0)
  11018. }
  11019. if _addBinding(tls, parser, prefix, libc.UintptrFromInt32(0), (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart, parser+704) != int32(_XML_ERROR_NONE) {
  11020. return libc.Uint8FromInt32(0)
  11021. }
  11022. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  11023. if int32(*(*TXML_Char)(unsafe.Pointer(context))) != int32('\000') {
  11024. context++
  11025. }
  11026. s = context
  11027. } else {
  11028. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  11029. v14 = 0
  11030. } else {
  11031. v16 = parser + 784 + 24
  11032. v15 = *(*uintptr)(unsafe.Pointer(v16))
  11033. *(*uintptr)(unsafe.Pointer(v16))++
  11034. *(*TXML_Char)(unsafe.Pointer(v15)) = *(*TXML_Char)(unsafe.Pointer(s))
  11035. v14 = libc.Int32FromInt32(1)
  11036. }
  11037. if !(v14 != 0) {
  11038. return libc.Uint8FromInt32(0)
  11039. }
  11040. s++
  11041. }
  11042. }
  11043. }
  11044. return libc.Uint8FromInt32(1)
  11045. }
  11046. func _normalizePublicId(tls *libc.TLS, publicId uintptr) {
  11047. var p, s, v2, v3 uintptr
  11048. _, _, _, _ = p, s, v2, v3
  11049. p = publicId
  11050. s = publicId
  11051. for {
  11052. if !(*(*TXML_Char)(unsafe.Pointer(s)) != 0) {
  11053. break
  11054. }
  11055. switch int32(*(*TXML_Char)(unsafe.Pointer(s))) {
  11056. case int32(0x20):
  11057. fallthrough
  11058. case int32(0xD):
  11059. fallthrough
  11060. case int32(0xA):
  11061. if p != publicId && int32(*(*TXML_Char)(unsafe.Pointer(p + uintptr(-libc.Int32FromInt32(1))))) != int32(0x20) {
  11062. v2 = p
  11063. p++
  11064. *(*TXML_Char)(unsafe.Pointer(v2)) = int8(0x20)
  11065. }
  11066. default:
  11067. v3 = p
  11068. p++
  11069. *(*TXML_Char)(unsafe.Pointer(v3)) = *(*TXML_Char)(unsafe.Pointer(s))
  11070. }
  11071. goto _1
  11072. _1:
  11073. ;
  11074. s++
  11075. }
  11076. if p != publicId && int32(*(*TXML_Char)(unsafe.Pointer(p + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20) {
  11077. p--
  11078. }
  11079. *(*TXML_Char)(unsafe.Pointer(p)) = int8('\000')
  11080. }
  11081. func _dtdCreate(tls *libc.TLS, ms uintptr) (r uintptr) {
  11082. var p uintptr
  11083. _ = p
  11084. p = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Fmalloc_fcn})))(tls, uint64(360))
  11085. if p == libc.UintptrFromInt32(0) {
  11086. return p
  11087. }
  11088. _poolInit(tls, p+160, ms)
  11089. _poolInit(tls, p+208, ms)
  11090. _hashTableInit(tls, p, ms)
  11091. _hashTableInit(tls, p+40, ms)
  11092. _hashTableInit(tls, p+80, ms)
  11093. _hashTableInit(tls, p+120, ms)
  11094. (*TDTD)(unsafe.Pointer(p)).FparamEntityRead = libc.Uint8FromInt32(0)
  11095. _hashTableInit(tls, p+264, ms)
  11096. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fname = libc.UintptrFromInt32(0)
  11097. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fbinding = libc.UintptrFromInt32(0)
  11098. (*TDTD)(unsafe.Pointer(p)).Fin_eldecl = libc.Uint8FromInt32(0)
  11099. (*TDTD)(unsafe.Pointer(p)).FscaffIndex = libc.UintptrFromInt32(0)
  11100. (*TDTD)(unsafe.Pointer(p)).Fscaffold = libc.UintptrFromInt32(0)
  11101. (*TDTD)(unsafe.Pointer(p)).FscaffLevel = 0
  11102. (*TDTD)(unsafe.Pointer(p)).FscaffSize = uint32(0)
  11103. (*TDTD)(unsafe.Pointer(p)).FscaffCount = uint32(0)
  11104. (*TDTD)(unsafe.Pointer(p)).FcontentStringLen = uint32(0)
  11105. (*TDTD)(unsafe.Pointer(p)).FkeepProcessing = libc.Uint8FromInt32(1)
  11106. (*TDTD)(unsafe.Pointer(p)).FhasParamEntityRefs = libc.Uint8FromInt32(0)
  11107. (*TDTD)(unsafe.Pointer(p)).Fstandalone = libc.Uint8FromInt32(0)
  11108. return p
  11109. }
  11110. func _dtdReset(tls *libc.TLS, p uintptr, ms uintptr) {
  11111. bp := tls.Alloc(16)
  11112. defer tls.Free(16)
  11113. var e uintptr
  11114. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  11115. _ = e
  11116. _hashTableIterInit(tls, bp, p+40)
  11117. for {
  11118. e = _hashTableIterNext(tls, bp)
  11119. if !(e != 0) {
  11120. break
  11121. }
  11122. if (*TELEMENT_TYPE)(unsafe.Pointer(e)).FallocDefaultAtts != 0 {
  11123. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TELEMENT_TYPE)(unsafe.Pointer(e)).FdefaultAtts)
  11124. }
  11125. goto _1
  11126. _1:
  11127. }
  11128. _hashTableClear(tls, p)
  11129. (*TDTD)(unsafe.Pointer(p)).FparamEntityRead = libc.Uint8FromInt32(0)
  11130. _hashTableClear(tls, p+264)
  11131. _hashTableClear(tls, p+40)
  11132. _hashTableClear(tls, p+80)
  11133. _hashTableClear(tls, p+120)
  11134. _poolClear(tls, p+160)
  11135. _poolClear(tls, p+208)
  11136. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fname = libc.UintptrFromInt32(0)
  11137. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fbinding = libc.UintptrFromInt32(0)
  11138. (*TDTD)(unsafe.Pointer(p)).Fin_eldecl = libc.Uint8FromInt32(0)
  11139. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).FscaffIndex)
  11140. (*TDTD)(unsafe.Pointer(p)).FscaffIndex = libc.UintptrFromInt32(0)
  11141. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).Fscaffold)
  11142. (*TDTD)(unsafe.Pointer(p)).Fscaffold = libc.UintptrFromInt32(0)
  11143. (*TDTD)(unsafe.Pointer(p)).FscaffLevel = 0
  11144. (*TDTD)(unsafe.Pointer(p)).FscaffSize = uint32(0)
  11145. (*TDTD)(unsafe.Pointer(p)).FscaffCount = uint32(0)
  11146. (*TDTD)(unsafe.Pointer(p)).FcontentStringLen = uint32(0)
  11147. (*TDTD)(unsafe.Pointer(p)).FkeepProcessing = libc.Uint8FromInt32(1)
  11148. (*TDTD)(unsafe.Pointer(p)).FhasParamEntityRefs = libc.Uint8FromInt32(0)
  11149. (*TDTD)(unsafe.Pointer(p)).Fstandalone = libc.Uint8FromInt32(0)
  11150. }
  11151. func _dtdDestroy(tls *libc.TLS, p uintptr, isDocEntity TXML_Bool, ms uintptr) {
  11152. bp := tls.Alloc(16)
  11153. defer tls.Free(16)
  11154. var e uintptr
  11155. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  11156. _ = e
  11157. _hashTableIterInit(tls, bp, p+40)
  11158. for {
  11159. e = _hashTableIterNext(tls, bp)
  11160. if !(e != 0) {
  11161. break
  11162. }
  11163. if (*TELEMENT_TYPE)(unsafe.Pointer(e)).FallocDefaultAtts != 0 {
  11164. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TELEMENT_TYPE)(unsafe.Pointer(e)).FdefaultAtts)
  11165. }
  11166. goto _1
  11167. _1:
  11168. }
  11169. _hashTableDestroy(tls, p)
  11170. _hashTableDestroy(tls, p+264)
  11171. _hashTableDestroy(tls, p+40)
  11172. _hashTableDestroy(tls, p+80)
  11173. _hashTableDestroy(tls, p+120)
  11174. _poolDestroy(tls, p+160)
  11175. _poolDestroy(tls, p+208)
  11176. if isDocEntity != 0 {
  11177. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).FscaffIndex)
  11178. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).Fscaffold)
  11179. }
  11180. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, p)
  11181. }
  11182. // C documentation
  11183. //
  11184. // /* Do a deep copy of the DTD. Return 0 for out of memory, non-zero otherwise.
  11185. // The new DTD has already been initialized.
  11186. // */
  11187. func _dtdCopy(tls *libc.TLS, oldParser TXML_Parser, newDtd uintptr, oldDtd uintptr, ms uintptr) (r int32) {
  11188. bp := tls.Alloc(16)
  11189. defer tls.Free(16)
  11190. var i, v3, v7 int32
  11191. var name, name1, name2, newA, newE, oldA, oldE, oldP, v4, v5 uintptr
  11192. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  11193. _, _, _, _, _, _, _, _, _, _, _, _, _ = i, name, name1, name2, newA, newE, oldA, oldE, oldP, v3, v4, v5, v7
  11194. /* Copy the prefix table. */
  11195. _hashTableIterInit(tls, bp, oldDtd+120)
  11196. for {
  11197. oldP = _hashTableIterNext(tls, bp)
  11198. if !(oldP != 0) {
  11199. break
  11200. }
  11201. name = _poolCopyString(tls, newDtd+160, (*TPREFIX)(unsafe.Pointer(oldP)).Fname)
  11202. if !(name != 0) {
  11203. return 0
  11204. }
  11205. if !(_lookup(tls, oldParser, newDtd+120, name, uint64(16)) != 0) {
  11206. return 0
  11207. }
  11208. goto _1
  11209. _1:
  11210. }
  11211. _hashTableIterInit(tls, bp, oldDtd+80)
  11212. /* Copy the attribute id table. */
  11213. for {
  11214. oldA = _hashTableIterNext(tls, bp)
  11215. if !(oldA != 0) {
  11216. break
  11217. }
  11218. /* Remember to allocate the scratch byte before the name. */
  11219. if (*TSTRING_POOL)(unsafe.Pointer(newDtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(newDtd+160)).Fend && !(_poolGrow(tls, newDtd+160) != 0) {
  11220. v3 = 0
  11221. } else {
  11222. v5 = newDtd + 160 + 24
  11223. v4 = *(*uintptr)(unsafe.Pointer(v5))
  11224. *(*uintptr)(unsafe.Pointer(v5))++
  11225. *(*TXML_Char)(unsafe.Pointer(v4)) = int8('\000')
  11226. v3 = libc.Int32FromInt32(1)
  11227. }
  11228. if !(v3 != 0) {
  11229. return 0
  11230. }
  11231. name1 = _poolCopyString(tls, newDtd+160, (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fname)
  11232. if !(name1 != 0) {
  11233. return 0
  11234. }
  11235. name1++
  11236. newA = _lookup(tls, oldParser, newDtd+80, name1, uint64(24))
  11237. if !(newA != 0) {
  11238. return 0
  11239. }
  11240. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).FmaybeTokenized = (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).FmaybeTokenized
  11241. if (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fprefix != 0 {
  11242. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).Fxmlns = (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fxmlns
  11243. if (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fprefix == oldDtd+304 {
  11244. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).Fprefix = newDtd + 304
  11245. } else {
  11246. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).Fprefix = _lookup(tls, oldParser, newDtd+120, (*TPREFIX)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fprefix)).Fname, uint64(0))
  11247. }
  11248. }
  11249. goto _2
  11250. _2:
  11251. }
  11252. /* Copy the element type table. */
  11253. _hashTableIterInit(tls, bp, oldDtd+40)
  11254. for {
  11255. oldE = _hashTableIterNext(tls, bp)
  11256. if !(oldE != 0) {
  11257. break
  11258. }
  11259. name2 = _poolCopyString(tls, newDtd+160, (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).Fname)
  11260. if !(name2 != 0) {
  11261. return 0
  11262. }
  11263. newE = _lookup(tls, oldParser, newDtd+40, name2, uint64(40))
  11264. if !(newE != 0) {
  11265. return 0
  11266. }
  11267. if (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FnDefaultAtts != 0 {
  11268. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Fmalloc_fcn})))(tls, libc.Uint64FromInt32((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FnDefaultAtts)*uint64(24))
  11269. if !((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts != 0) {
  11270. return 0
  11271. }
  11272. }
  11273. if (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FidAtt != 0 {
  11274. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FidAtt = _lookup(tls, oldParser, newDtd+80, (*TATTRIBUTE_ID)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FidAtt)).Fname, uint64(0))
  11275. }
  11276. v7 = (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FnDefaultAtts
  11277. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FnDefaultAtts = v7
  11278. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FallocDefaultAtts = v7
  11279. if (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).Fprefix != 0 {
  11280. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).Fprefix = _lookup(tls, oldParser, newDtd+120, (*TPREFIX)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).Fprefix)).Fname, uint64(0))
  11281. }
  11282. i = 0
  11283. for {
  11284. if !(i < (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FnDefaultAtts) {
  11285. break
  11286. }
  11287. (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*24))).Fid = _lookup(tls, oldParser, newDtd+80, (*TATTRIBUTE_ID)(unsafe.Pointer((*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FdefaultAtts + uintptr(i)*24))).Fid)).Fname, uint64(0))
  11288. (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*24))).FisCdata = (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FdefaultAtts + uintptr(i)*24))).FisCdata
  11289. if (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FdefaultAtts + uintptr(i)*24))).Fvalue != 0 {
  11290. (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*24))).Fvalue = _poolCopyString(tls, newDtd+160, (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FdefaultAtts + uintptr(i)*24))).Fvalue)
  11291. if !((*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*24))).Fvalue != 0) {
  11292. return 0
  11293. }
  11294. } else {
  11295. (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*24))).Fvalue = libc.UintptrFromInt32(0)
  11296. }
  11297. goto _8
  11298. _8:
  11299. ;
  11300. i++
  11301. }
  11302. goto _6
  11303. _6:
  11304. }
  11305. /* Copy the entity tables. */
  11306. if !(_copyEntityTable(tls, oldParser, newDtd, newDtd+160, oldDtd) != 0) {
  11307. return 0
  11308. }
  11309. if !(_copyEntityTable(tls, oldParser, newDtd+264, newDtd+160, oldDtd+264) != 0) {
  11310. return 0
  11311. }
  11312. (*TDTD)(unsafe.Pointer(newDtd)).FparamEntityRead = (*TDTD)(unsafe.Pointer(oldDtd)).FparamEntityRead
  11313. (*TDTD)(unsafe.Pointer(newDtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(oldDtd)).FkeepProcessing
  11314. (*TDTD)(unsafe.Pointer(newDtd)).FhasParamEntityRefs = (*TDTD)(unsafe.Pointer(oldDtd)).FhasParamEntityRefs
  11315. (*TDTD)(unsafe.Pointer(newDtd)).Fstandalone = (*TDTD)(unsafe.Pointer(oldDtd)).Fstandalone
  11316. /* Don't want deep copying for scaffolding */
  11317. (*TDTD)(unsafe.Pointer(newDtd)).Fin_eldecl = (*TDTD)(unsafe.Pointer(oldDtd)).Fin_eldecl
  11318. (*TDTD)(unsafe.Pointer(newDtd)).Fscaffold = (*TDTD)(unsafe.Pointer(oldDtd)).Fscaffold
  11319. (*TDTD)(unsafe.Pointer(newDtd)).FcontentStringLen = (*TDTD)(unsafe.Pointer(oldDtd)).FcontentStringLen
  11320. (*TDTD)(unsafe.Pointer(newDtd)).FscaffSize = (*TDTD)(unsafe.Pointer(oldDtd)).FscaffSize
  11321. (*TDTD)(unsafe.Pointer(newDtd)).FscaffLevel = (*TDTD)(unsafe.Pointer(oldDtd)).FscaffLevel
  11322. (*TDTD)(unsafe.Pointer(newDtd)).FscaffIndex = (*TDTD)(unsafe.Pointer(oldDtd)).FscaffIndex
  11323. return int32(1)
  11324. }
  11325. /* End dtdCopy */
  11326. func _copyEntityTable(tls *libc.TLS, oldParser TXML_Parser, newTable uintptr, newPool uintptr, oldTable uintptr) (r int32) {
  11327. bp := tls.Alloc(16)
  11328. defer tls.Free(16)
  11329. var cachedNewBase, cachedOldBase, name, newE, oldE, tem, tem1, tem2, v2 uintptr
  11330. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  11331. _, _, _, _, _, _, _, _, _ = cachedNewBase, cachedOldBase, name, newE, oldE, tem, tem1, tem2, v2
  11332. cachedOldBase = libc.UintptrFromInt32(0)
  11333. cachedNewBase = libc.UintptrFromInt32(0)
  11334. _hashTableIterInit(tls, bp, oldTable)
  11335. for {
  11336. oldE = _hashTableIterNext(tls, bp)
  11337. if !(oldE != 0) {
  11338. break
  11339. }
  11340. name = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).Fname)
  11341. if !(name != 0) {
  11342. return 0
  11343. }
  11344. newE = _lookup(tls, oldParser, newTable, name, uint64(64))
  11345. if !(newE != 0) {
  11346. return 0
  11347. }
  11348. if (*TENTITY)(unsafe.Pointer(oldE)).FsystemId != 0 {
  11349. tem = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).FsystemId)
  11350. if !(tem != 0) {
  11351. return 0
  11352. }
  11353. (*TENTITY)(unsafe.Pointer(newE)).FsystemId = tem
  11354. if (*TENTITY)(unsafe.Pointer(oldE)).Fbase != 0 {
  11355. if (*TENTITY)(unsafe.Pointer(oldE)).Fbase == cachedOldBase {
  11356. (*TENTITY)(unsafe.Pointer(newE)).Fbase = cachedNewBase
  11357. } else {
  11358. cachedOldBase = (*TENTITY)(unsafe.Pointer(oldE)).Fbase
  11359. tem = _poolCopyString(tls, newPool, cachedOldBase)
  11360. if !(tem != 0) {
  11361. return 0
  11362. }
  11363. v2 = tem
  11364. (*TENTITY)(unsafe.Pointer(newE)).Fbase = v2
  11365. cachedNewBase = v2
  11366. }
  11367. }
  11368. if (*TENTITY)(unsafe.Pointer(oldE)).FpublicId != 0 {
  11369. tem = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).FpublicId)
  11370. if !(tem != 0) {
  11371. return 0
  11372. }
  11373. (*TENTITY)(unsafe.Pointer(newE)).FpublicId = tem
  11374. }
  11375. } else {
  11376. tem1 = _poolCopyStringN(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).FtextPtr, (*TENTITY)(unsafe.Pointer(oldE)).FtextLen)
  11377. if !(tem1 != 0) {
  11378. return 0
  11379. }
  11380. (*TENTITY)(unsafe.Pointer(newE)).FtextPtr = tem1
  11381. (*TENTITY)(unsafe.Pointer(newE)).FtextLen = (*TENTITY)(unsafe.Pointer(oldE)).FtextLen
  11382. }
  11383. if (*TENTITY)(unsafe.Pointer(oldE)).Fnotation != 0 {
  11384. tem2 = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).Fnotation)
  11385. if !(tem2 != 0) {
  11386. return 0
  11387. }
  11388. (*TENTITY)(unsafe.Pointer(newE)).Fnotation = tem2
  11389. }
  11390. (*TENTITY)(unsafe.Pointer(newE)).Fis_param = (*TENTITY)(unsafe.Pointer(oldE)).Fis_param
  11391. (*TENTITY)(unsafe.Pointer(newE)).Fis_internal = (*TENTITY)(unsafe.Pointer(oldE)).Fis_internal
  11392. goto _1
  11393. _1:
  11394. }
  11395. return int32(1)
  11396. }
  11397. func _keyeq(tls *libc.TLS, s1 TKEY, s2 TKEY) (r TXML_Bool) {
  11398. for {
  11399. if !(int32(*(*TXML_Char)(unsafe.Pointer(s1))) == int32(*(*TXML_Char)(unsafe.Pointer(s2)))) {
  11400. break
  11401. }
  11402. if int32(*(*TXML_Char)(unsafe.Pointer(s1))) == 0 {
  11403. return libc.Uint8FromInt32(1)
  11404. }
  11405. goto _1
  11406. _1:
  11407. ;
  11408. s1++
  11409. s2++
  11410. }
  11411. return libc.Uint8FromInt32(0)
  11412. }
  11413. func _keylen(tls *libc.TLS, s TKEY) (r Tsize_t) {
  11414. var len1 Tsize_t
  11415. _ = len1
  11416. len1 = uint64(0)
  11417. for {
  11418. if !(*(*TXML_Char)(unsafe.Pointer(s)) != 0) {
  11419. break
  11420. }
  11421. goto _1
  11422. _1:
  11423. ;
  11424. s++
  11425. len1++
  11426. }
  11427. return len1
  11428. }
  11429. func _copy_salt_to_sipkey(tls *libc.TLS, parser TXML_Parser, key uintptr) {
  11430. *(*Tuint64_t)(unsafe.Pointer(key)) = uint64(0)
  11431. *(*Tuint64_t)(unsafe.Pointer(key + 1*8)) = _get_hash_secret_salt(tls, parser)
  11432. }
  11433. func _hash(tls *libc.TLS, parser TXML_Parser, s TKEY) (r uint64) {
  11434. bp := tls.Alloc(80)
  11435. defer tls.Free(80)
  11436. var _ /* key at bp+56 */ Tsipkey
  11437. var _ /* state at bp+0 */ Tsiphash
  11438. _ = __ccgo_fp(_sip24_valid)
  11439. _copy_salt_to_sipkey(tls, parser, bp+56)
  11440. _sip24_init(tls, bp, bp+56)
  11441. _sip24_update(tls, bp, s, _keylen(tls, s)*uint64(1))
  11442. return _sip24_final(tls, bp)
  11443. }
  11444. func _lookup(tls *libc.TLS, parser TXML_Parser, table uintptr, name TKEY, createSize Tsize_t) (r uintptr) {
  11445. var h, mask, newHash, newMask uint64
  11446. var i, j, newSize, tsize, tsize1 Tsize_t
  11447. var newPower, step uint8
  11448. var newV uintptr
  11449. _, _, _, _, _, _, _, _, _, _, _, _ = h, i, j, mask, newHash, newMask, newPower, newSize, newV, step, tsize, tsize1
  11450. if (*THASH_TABLE)(unsafe.Pointer(table)).Fsize == uint64(0) {
  11451. if !(createSize != 0) {
  11452. return libc.UintptrFromInt32(0)
  11453. }
  11454. (*THASH_TABLE)(unsafe.Pointer(table)).Fpower = uint8(m_INIT_POWER)
  11455. /* table->size is a power of 2 */
  11456. (*THASH_TABLE)(unsafe.Pointer(table)).Fsize = libc.Uint64FromInt32(1) << libc.Int32FromInt32(m_INIT_POWER)
  11457. tsize = (*THASH_TABLE)(unsafe.Pointer(table)).Fsize * uint64(8)
  11458. (*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)
  11459. if !((*THASH_TABLE)(unsafe.Pointer(table)).Fv != 0) {
  11460. (*THASH_TABLE)(unsafe.Pointer(table)).Fsize = uint64(0)
  11461. return libc.UintptrFromInt32(0)
  11462. }
  11463. libc.X__builtin___memset_chk(tls, (*THASH_TABLE)(unsafe.Pointer(table)).Fv, 0, tsize, ^t__predefined_size_t(0))
  11464. i = _hash(tls, parser, name) & ((*THASH_TABLE)(unsafe.Pointer(table)).Fsize - uint64(1))
  11465. } else {
  11466. h = _hash(tls, parser, name)
  11467. mask = (*THASH_TABLE)(unsafe.Pointer(table)).Fsize - uint64(1)
  11468. step = uint8(0)
  11469. i = h & mask
  11470. for *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0 {
  11471. if _keyeq(tls, name, (*TNAMED)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))).Fname) != 0 {
  11472. return *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8))
  11473. }
  11474. if !(step != 0) {
  11475. step = uint8(h & ^mask >> (libc.Int32FromUint8((*THASH_TABLE)(unsafe.Pointer(table)).Fpower)-libc.Int32FromInt32(1)) & (mask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  11476. }
  11477. if i < uint64(step) {
  11478. i += (*THASH_TABLE)(unsafe.Pointer(table)).Fsize - uint64(step)
  11479. } else {
  11480. i -= uint64(step)
  11481. }
  11482. }
  11483. if !(createSize != 0) {
  11484. return libc.UintptrFromInt32(0)
  11485. }
  11486. /* check for overflow (table is half full) */
  11487. if (*THASH_TABLE)(unsafe.Pointer(table)).Fused>>(libc.Int32FromUint8((*THASH_TABLE)(unsafe.Pointer(table)).Fpower)-int32(1)) != 0 {
  11488. newPower = libc.Uint8FromInt32(libc.Int32FromUint8((*THASH_TABLE)(unsafe.Pointer(table)).Fpower) + int32(1))
  11489. /* Detect and prevent invalid shift */
  11490. if uint64(newPower) >= libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8) {
  11491. return libc.UintptrFromInt32(0)
  11492. }
  11493. newSize = libc.Uint64FromInt32(1) << newPower
  11494. newMask = newSize - uint64(1)
  11495. /* Detect and prevent integer overflow */
  11496. if newSize > libc.Uint64FromInt32(-libc.Int32FromInt32(1))/libc.Uint64FromInt64(8) {
  11497. return libc.UintptrFromInt32(0)
  11498. }
  11499. tsize1 = newSize * uint64(8)
  11500. 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)
  11501. if !(newV != 0) {
  11502. return libc.UintptrFromInt32(0)
  11503. }
  11504. libc.X__builtin___memset_chk(tls, newV, 0, tsize1, ^t__predefined_size_t(0))
  11505. i = uint64(0)
  11506. for {
  11507. if !(i < (*THASH_TABLE)(unsafe.Pointer(table)).Fsize) {
  11508. break
  11509. }
  11510. if *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0 {
  11511. newHash = _hash(tls, parser, (*TNAMED)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))).Fname)
  11512. j = newHash & newMask
  11513. step = uint8(0)
  11514. for *(*uintptr)(unsafe.Pointer(newV + uintptr(j)*8)) != 0 {
  11515. if !(step != 0) {
  11516. step = uint8(newHash & ^newMask >> (libc.Int32FromUint8(newPower)-libc.Int32FromInt32(1)) & (newMask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  11517. }
  11518. if j < uint64(step) {
  11519. j += newSize - uint64(step)
  11520. } else {
  11521. j -= uint64(step)
  11522. }
  11523. }
  11524. *(*uintptr)(unsafe.Pointer(newV + uintptr(j)*8)) = *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8))
  11525. }
  11526. goto _2
  11527. _2:
  11528. ;
  11529. i++
  11530. }
  11531. (*(*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)
  11532. (*THASH_TABLE)(unsafe.Pointer(table)).Fv = newV
  11533. (*THASH_TABLE)(unsafe.Pointer(table)).Fpower = newPower
  11534. (*THASH_TABLE)(unsafe.Pointer(table)).Fsize = newSize
  11535. i = h & newMask
  11536. step = uint8(0)
  11537. for *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0 {
  11538. if !(step != 0) {
  11539. step = uint8(h & ^newMask >> (libc.Int32FromUint8(newPower)-libc.Int32FromInt32(1)) & (newMask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  11540. }
  11541. if i < uint64(step) {
  11542. i += newSize - uint64(step)
  11543. } else {
  11544. i -= uint64(step)
  11545. }
  11546. }
  11547. }
  11548. }
  11549. *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fmem)).Fmalloc_fcn})))(tls, createSize)
  11550. if !(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0) {
  11551. return libc.UintptrFromInt32(0)
  11552. }
  11553. libc.X__builtin___memset_chk(tls, *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)), 0, createSize, ^t__predefined_size_t(0))
  11554. (*TNAMED)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))).Fname = name
  11555. (*THASH_TABLE)(unsafe.Pointer(table)).Fused++
  11556. return *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8))
  11557. }
  11558. func _hashTableClear(tls *libc.TLS, table uintptr) {
  11559. var i Tsize_t
  11560. _ = i
  11561. i = uint64(0)
  11562. for {
  11563. if !(i < (*THASH_TABLE)(unsafe.Pointer(table)).Fsize) {
  11564. break
  11565. }
  11566. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fmem)).Ffree_fcn})))(tls, *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))
  11567. *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) = libc.UintptrFromInt32(0)
  11568. goto _1
  11569. _1:
  11570. ;
  11571. i++
  11572. }
  11573. (*THASH_TABLE)(unsafe.Pointer(table)).Fused = uint64(0)
  11574. }
  11575. func _hashTableDestroy(tls *libc.TLS, table uintptr) {
  11576. var i Tsize_t
  11577. _ = i
  11578. i = uint64(0)
  11579. for {
  11580. if !(i < (*THASH_TABLE)(unsafe.Pointer(table)).Fsize) {
  11581. break
  11582. }
  11583. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fmem)).Ffree_fcn})))(tls, *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))
  11584. goto _1
  11585. _1:
  11586. ;
  11587. i++
  11588. }
  11589. (*(*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)
  11590. }
  11591. func _hashTableInit(tls *libc.TLS, p uintptr, ms uintptr) {
  11592. (*THASH_TABLE)(unsafe.Pointer(p)).Fpower = uint8(0)
  11593. (*THASH_TABLE)(unsafe.Pointer(p)).Fsize = uint64(0)
  11594. (*THASH_TABLE)(unsafe.Pointer(p)).Fused = uint64(0)
  11595. (*THASH_TABLE)(unsafe.Pointer(p)).Fv = libc.UintptrFromInt32(0)
  11596. (*THASH_TABLE)(unsafe.Pointer(p)).Fmem = ms
  11597. }
  11598. func _hashTableIterInit(tls *libc.TLS, iter uintptr, table uintptr) {
  11599. var v1 uintptr
  11600. _ = v1
  11601. (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp = (*THASH_TABLE)(unsafe.Pointer(table)).Fv
  11602. if (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp != 0 {
  11603. v1 = (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp + uintptr((*THASH_TABLE)(unsafe.Pointer(table)).Fsize)*8
  11604. } else {
  11605. v1 = libc.UintptrFromInt32(0)
  11606. }
  11607. (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fend = v1
  11608. }
  11609. func _hashTableIterNext(tls *libc.TLS, iter uintptr) (r uintptr) {
  11610. var tem, v1, v2 uintptr
  11611. _, _, _ = tem, v1, v2
  11612. for (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp != (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fend {
  11613. v2 = iter
  11614. v1 = *(*uintptr)(unsafe.Pointer(v2))
  11615. *(*uintptr)(unsafe.Pointer(v2)) += 8
  11616. tem = *(*uintptr)(unsafe.Pointer(v1))
  11617. if tem != 0 {
  11618. return tem
  11619. }
  11620. }
  11621. return libc.UintptrFromInt32(0)
  11622. }
  11623. func _poolInit(tls *libc.TLS, pool uintptr, ms uintptr) {
  11624. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = libc.UintptrFromInt32(0)
  11625. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = libc.UintptrFromInt32(0)
  11626. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = libc.UintptrFromInt32(0)
  11627. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = libc.UintptrFromInt32(0)
  11628. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = libc.UintptrFromInt32(0)
  11629. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem = ms
  11630. }
  11631. func _poolClear(tls *libc.TLS, pool uintptr) {
  11632. var p, tem uintptr
  11633. _, _ = p, tem
  11634. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks != 0) {
  11635. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  11636. } else {
  11637. p = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  11638. for p != 0 {
  11639. tem = (*TBLOCK)(unsafe.Pointer(p)).Fnext
  11640. (*TBLOCK)(unsafe.Pointer(p)).Fnext = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  11641. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = p
  11642. p = tem
  11643. }
  11644. }
  11645. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = libc.UintptrFromInt32(0)
  11646. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = libc.UintptrFromInt32(0)
  11647. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = libc.UintptrFromInt32(0)
  11648. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = libc.UintptrFromInt32(0)
  11649. }
  11650. func _poolDestroy(tls *libc.TLS, pool uintptr) {
  11651. var p, tem, tem1 uintptr
  11652. _, _, _ = p, tem, tem1
  11653. p = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  11654. for p != 0 {
  11655. tem = (*TBLOCK)(unsafe.Pointer(p)).Fnext
  11656. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem)).Ffree_fcn})))(tls, p)
  11657. p = tem
  11658. }
  11659. p = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  11660. for p != 0 {
  11661. tem1 = (*TBLOCK)(unsafe.Pointer(p)).Fnext
  11662. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem)).Ffree_fcn})))(tls, p)
  11663. p = tem1
  11664. }
  11665. }
  11666. func _poolAppend(tls *libc.TLS, pool uintptr, enc uintptr, _ptr uintptr, end uintptr) (r uintptr) {
  11667. bp := tls.Alloc(16)
  11668. defer tls.Free(16)
  11669. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  11670. var convert_res _XML_Convert_Result
  11671. _ = convert_res
  11672. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr != 0) && !(_poolGrow(tls, pool) != 0) {
  11673. return libc.UintptrFromInt32(0)
  11674. }
  11675. for {
  11676. convert_res = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, end, pool+24, (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend)
  11677. if convert_res == int32(_XML_CONVERT_COMPLETED) || convert_res == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  11678. break
  11679. }
  11680. if !(_poolGrow(tls, pool) != 0) {
  11681. return libc.UintptrFromInt32(0)
  11682. }
  11683. goto _1
  11684. _1:
  11685. }
  11686. return (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  11687. }
  11688. func _poolCopyString(tls *libc.TLS, pool uintptr, s uintptr) (r uintptr) {
  11689. var v1, v4, v5 uintptr
  11690. var v3 int32
  11691. _, _, _, _ = v1, v3, v4, v5
  11692. for {
  11693. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  11694. v3 = 0
  11695. } else {
  11696. v5 = pool + 24
  11697. v4 = *(*uintptr)(unsafe.Pointer(v5))
  11698. *(*uintptr)(unsafe.Pointer(v5))++
  11699. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(s))
  11700. v3 = libc.Int32FromInt32(1)
  11701. }
  11702. if !(v3 != 0) {
  11703. return libc.UintptrFromInt32(0)
  11704. }
  11705. goto _2
  11706. _2:
  11707. ;
  11708. v1 = s
  11709. s++
  11710. if !(*(*TXML_Char)(unsafe.Pointer(v1)) != 0) {
  11711. break
  11712. }
  11713. }
  11714. s = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  11715. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr
  11716. return s
  11717. }
  11718. func _poolCopyStringN(tls *libc.TLS, pool uintptr, s uintptr, n int32) (r uintptr) {
  11719. var v2 int32
  11720. var v3, v4 uintptr
  11721. _, _, _ = v2, v3, v4
  11722. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr != 0) && !(_poolGrow(tls, pool) != 0) {
  11723. /* The following line is unreachable given the current usage of
  11724. * poolCopyStringN(). Currently it is called from exactly one
  11725. * place to copy the text of a simple general entity. By that
  11726. * point, the name of the entity is already stored in the pool, so
  11727. * pool->ptr cannot be NULL.
  11728. *
  11729. * If poolCopyStringN() is used elsewhere as it well might be,
  11730. * this line may well become executable again. Regardless, this
  11731. * sort of check shouldn't be removed lightly, so we just exclude
  11732. * it from the coverage statistics.
  11733. */
  11734. return libc.UintptrFromInt32(0) /* LCOV_EXCL_LINE */
  11735. }
  11736. for {
  11737. if !(n > 0) {
  11738. break
  11739. }
  11740. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  11741. v2 = 0
  11742. } else {
  11743. v4 = pool + 24
  11744. v3 = *(*uintptr)(unsafe.Pointer(v4))
  11745. *(*uintptr)(unsafe.Pointer(v4))++
  11746. *(*TXML_Char)(unsafe.Pointer(v3)) = *(*TXML_Char)(unsafe.Pointer(s))
  11747. v2 = libc.Int32FromInt32(1)
  11748. }
  11749. if !(v2 != 0) {
  11750. return libc.UintptrFromInt32(0)
  11751. }
  11752. goto _1
  11753. _1:
  11754. ;
  11755. n--
  11756. s++
  11757. }
  11758. s = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  11759. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr
  11760. return s
  11761. }
  11762. func _poolAppendString(tls *libc.TLS, pool uintptr, s uintptr) (r uintptr) {
  11763. var v1 int32
  11764. var v2, v3 uintptr
  11765. _, _, _ = v1, v2, v3
  11766. for *(*TXML_Char)(unsafe.Pointer(s)) != 0 {
  11767. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  11768. v1 = 0
  11769. } else {
  11770. v3 = pool + 24
  11771. v2 = *(*uintptr)(unsafe.Pointer(v3))
  11772. *(*uintptr)(unsafe.Pointer(v3))++
  11773. *(*TXML_Char)(unsafe.Pointer(v2)) = *(*TXML_Char)(unsafe.Pointer(s))
  11774. v1 = libc.Int32FromInt32(1)
  11775. }
  11776. if !(v1 != 0) {
  11777. return libc.UintptrFromInt32(0)
  11778. }
  11779. s++
  11780. }
  11781. return (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  11782. }
  11783. func _poolStoreString(tls *libc.TLS, pool uintptr, enc uintptr, ptr uintptr, end uintptr) (r uintptr) {
  11784. var v1, v2 uintptr
  11785. _, _ = v1, v2
  11786. if !(_poolAppend(tls, pool, enc, ptr, end) != 0) {
  11787. return libc.UintptrFromInt32(0)
  11788. }
  11789. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  11790. return libc.UintptrFromInt32(0)
  11791. }
  11792. v2 = pool + 24
  11793. v1 = *(*uintptr)(unsafe.Pointer(v2))
  11794. *(*uintptr)(unsafe.Pointer(v2))++
  11795. *(*TXML_Char)(unsafe.Pointer(v1)) = 0
  11796. return (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  11797. }
  11798. func _poolBytesToAllocateFor(tls *libc.TLS, blockSize int32) (r Tsize_t) {
  11799. var bytesToAllocate, stretchedBlockSize int32
  11800. var stretch Tsize_t
  11801. _, _, _ = bytesToAllocate, stretch, stretchedBlockSize
  11802. /* Unprotected math would be:
  11803. ** return offsetof(BLOCK, s) + blockSize * sizeof(XML_Char);
  11804. **
  11805. ** Detect overflow, avoiding _signed_ overflow undefined behavior
  11806. ** For a + b * c we check b * c in isolation first, so that addition of a
  11807. ** on top has no chance of making us accept a small non-negative number
  11808. */
  11809. stretch = uint64(1) /* can be 4 bytes */
  11810. if blockSize <= 0 {
  11811. return uint64(0)
  11812. }
  11813. if blockSize > libc.Int32FromUint64(libc.Uint64FromInt32(m___INT_MAX__)/stretch) {
  11814. return uint64(0)
  11815. }
  11816. stretchedBlockSize = blockSize * libc.Int32FromUint64(stretch)
  11817. bytesToAllocate = libc.Int32FromUint64(uint64(libc.UintptrFromInt32(0)+12) + uint64(libc.Uint32FromInt32(stretchedBlockSize)))
  11818. if bytesToAllocate < 0 {
  11819. return uint64(0)
  11820. }
  11821. return libc.Uint64FromInt32(bytesToAllocate)
  11822. return r
  11823. }
  11824. func _poolGrow(tls *libc.TLS, pool uintptr) (r TXML_Bool) {
  11825. var blockSize, blockSize1 int32
  11826. var bytesToAllocate, bytesToAllocate1 Tsize_t
  11827. var offsetInsideBlock Tptrdiff_t
  11828. var tem, tem1, temp uintptr
  11829. _, _, _, _, _, _, _, _ = blockSize, blockSize1, bytesToAllocate, bytesToAllocate1, offsetInsideBlock, tem, tem1, temp
  11830. if (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks != 0 {
  11831. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart == uintptr(0) {
  11832. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  11833. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fnext
  11834. (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fnext = libc.UintptrFromInt32(0)
  11835. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12
  11836. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart + uintptr((*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fsize)
  11837. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  11838. return libc.Uint8FromInt32(1)
  11839. }
  11840. if int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart) < int64((*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fsize) {
  11841. tem = (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fnext
  11842. (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fnext = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  11843. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  11844. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = tem
  11845. libc.X__builtin___memcpy_chk(tls, (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks+12, (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart, libc.Uint64FromInt64(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))*uint64(1), ^t__predefined_size_t(0))
  11846. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12 + uintptr(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))
  11847. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12
  11848. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart + uintptr((*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fsize)
  11849. return libc.Uint8FromInt32(1)
  11850. }
  11851. }
  11852. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks != 0 && (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks+12 {
  11853. blockSize = libc.Int32FromUint32(libc.Uint32FromInt64(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart)) * libc.Uint32FromUint32(2))
  11854. /* NOTE: Needs to be calculated prior to calling `realloc`
  11855. to avoid dangling pointers: */
  11856. offsetInsideBlock = int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr) - int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart)
  11857. if blockSize < 0 {
  11858. /* This condition traps a situation where either more than
  11859. * INT_MAX/2 bytes have already been allocated. This isn't
  11860. * readily testable, since it is unlikely that an average
  11861. * machine will have that much memory, so we exclude it from the
  11862. * coverage statistics.
  11863. */
  11864. return libc.Uint8FromInt32(0) /* LCOV_EXCL_LINE */
  11865. }
  11866. bytesToAllocate = _poolBytesToAllocateFor(tls, blockSize)
  11867. if bytesToAllocate == uint64(0) {
  11868. return libc.Uint8FromInt32(0)
  11869. }
  11870. temp = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem)).Frealloc_fcn})))(tls, (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks, uint64(uint32(bytesToAllocate)))
  11871. if temp == libc.UintptrFromInt32(0) {
  11872. return libc.Uint8FromInt32(0)
  11873. }
  11874. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = temp
  11875. (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fsize = blockSize
  11876. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12 + uintptr(offsetInsideBlock)
  11877. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12
  11878. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart + uintptr(blockSize)
  11879. } else {
  11880. blockSize1 = int32(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend) - int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))
  11881. if blockSize1 < 0 {
  11882. /* This condition traps a situation where either more than
  11883. * INT_MAX bytes have already been allocated (which is prevented
  11884. * by various pieces of program logic, not least this one, never
  11885. * mind the unlikelihood of actually having that much memory) or
  11886. * the pool control fields have been corrupted (which could
  11887. * conceivably happen in an extremely buggy user handler
  11888. * function). Either way it isn't readily testable, so we
  11889. * exclude it from the coverage statistics.
  11890. */
  11891. return libc.Uint8FromInt32(0) /* LCOV_EXCL_LINE */
  11892. }
  11893. if blockSize1 < int32(m_INIT_BLOCK_SIZE) {
  11894. blockSize1 = int32(m_INIT_BLOCK_SIZE)
  11895. } else {
  11896. /* Detect overflow, avoiding _signed_ overflow undefined behavior */
  11897. if libc.Int32FromUint32(libc.Uint32FromInt32(blockSize1)*libc.Uint32FromUint32(2)) < 0 {
  11898. return libc.Uint8FromInt32(0)
  11899. }
  11900. blockSize1 *= int32(2)
  11901. }
  11902. bytesToAllocate1 = _poolBytesToAllocateFor(tls, blockSize1)
  11903. if bytesToAllocate1 == uint64(0) {
  11904. return libc.Uint8FromInt32(0)
  11905. }
  11906. 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)
  11907. if !(tem1 != 0) {
  11908. return libc.Uint8FromInt32(0)
  11909. }
  11910. (*TBLOCK)(unsafe.Pointer(tem1)).Fsize = blockSize1
  11911. (*TBLOCK)(unsafe.Pointer(tem1)).Fnext = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  11912. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = tem1
  11913. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr != (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart {
  11914. libc.X__builtin___memcpy_chk(tls, tem1+12, (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart, libc.Uint64FromInt64(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))*uint64(1), ^t__predefined_size_t(0))
  11915. }
  11916. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = tem1 + 12 + uintptr(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))
  11917. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = tem1 + 12
  11918. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = tem1 + 12 + uintptr(blockSize1)
  11919. }
  11920. return libc.Uint8FromInt32(1)
  11921. }
  11922. func _nextScaffoldPart(tls *libc.TLS, parser TXML_Parser) (r int32) {
  11923. var dtd, me, parent, temp, v2 uintptr
  11924. var next, v3, v4, v5 int32
  11925. var v1 uint32
  11926. _, _, _, _, _, _, _, _, _, _ = dtd, me, next, parent, temp, v1, v2, v3, v4, v5
  11927. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  11928. if !((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex != 0) {
  11929. (*TDTD)(unsafe.Pointer(dtd)).FscaffIndex = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, uint64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize)*libc.Uint64FromInt64(4))
  11930. if !((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex != 0) {
  11931. return -int32(1)
  11932. }
  11933. *(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex)) = 0
  11934. }
  11935. if (*TDTD)(unsafe.Pointer(dtd)).FscaffCount >= (*TDTD)(unsafe.Pointer(dtd)).FscaffSize {
  11936. if (*TDTD)(unsafe.Pointer(dtd)).Fscaffold != 0 {
  11937. /* Detect and prevent integer overflow */
  11938. if (*TDTD)(unsafe.Pointer(dtd)).FscaffSize > (libc.Uint32FromInt32(m___INT_MAX__)*libc.Uint32FromUint32(2)+libc.Uint32FromUint32(1))/libc.Uint32FromUint32(2) {
  11939. return -int32(1)
  11940. }
  11941. /* Detect and prevent integer overflow.
  11942. * The preprocessor guard addresses the "always false" warning
  11943. * from -Wtype-limits on platforms where
  11944. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  11945. temp = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TDTD)(unsafe.Pointer(dtd)).Fscaffold, uint64((*TDTD)(unsafe.Pointer(dtd)).FscaffSize*libc.Uint32FromInt32(2))*libc.Uint64FromInt64(32))
  11946. if temp == libc.UintptrFromInt32(0) {
  11947. return -int32(1)
  11948. }
  11949. *(*uint32)(unsafe.Pointer(dtd + 340)) *= uint32(2)
  11950. } else {
  11951. temp = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32(m_INIT_SCAFFOLD_ELEMENTS)*libc.Uint64FromInt64(32))
  11952. if temp == libc.UintptrFromInt32(0) {
  11953. return -int32(1)
  11954. }
  11955. (*TDTD)(unsafe.Pointer(dtd)).FscaffSize = uint32(m_INIT_SCAFFOLD_ELEMENTS)
  11956. }
  11957. (*TDTD)(unsafe.Pointer(dtd)).Fscaffold = temp
  11958. }
  11959. v2 = dtd + 344
  11960. v1 = *(*uint32)(unsafe.Pointer(v2))
  11961. *(*uint32)(unsafe.Pointer(v2))++
  11962. next = libc.Int32FromUint32(v1)
  11963. me = (*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(next)*32
  11964. if (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel != 0 {
  11965. parent = (*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(*(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel-int32(1))*4)))*32
  11966. if (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Flastchild != 0 {
  11967. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr((*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Flastchild)*32))).Fnextsib = next
  11968. }
  11969. if !((*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Fchildcnt != 0) {
  11970. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Ffirstchild = next
  11971. }
  11972. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Flastchild = next
  11973. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Fchildcnt++
  11974. }
  11975. v5 = libc.Int32FromInt32(0)
  11976. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Fnextsib = v5
  11977. v4 = v5
  11978. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Fchildcnt = v4
  11979. v3 = v4
  11980. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Flastchild = v3
  11981. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Ffirstchild = v3
  11982. return next
  11983. }
  11984. func _build_model(tls *libc.TLS, parser TXML_Parser) (r uintptr) {
  11985. var allocsize Tsize_t
  11986. var cn, src_node int32
  11987. var dest, destLimit, dtd, jobDest, ret, src, str, v1, v4, v6 uintptr
  11988. var i uint32
  11989. _, _, _, _, _, _, _, _, _, _, _, _, _, _ = allocsize, cn, dest, destLimit, dtd, i, jobDest, ret, src, src_node, str, v1, v4, v6
  11990. /* Function build_model transforms the existing parser->m_dtd->scaffold
  11991. * array of CONTENT_SCAFFOLD tree nodes into a new array of
  11992. * XML_Content tree nodes followed by a gapless list of zero-terminated
  11993. * strings. */
  11994. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* the current string writing location */
  11995. /* Detect and prevent integer overflow.
  11996. * The preprocessor guard addresses the "always false" warning
  11997. * from -Wtype-limits on platforms where
  11998. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  11999. if uint64((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*uint64(32) > libc.Uint64FromInt32(-libc.Int32FromInt32(1))-uint64((*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen)*uint64(1) {
  12000. return libc.UintptrFromInt32(0)
  12001. }
  12002. allocsize = uint64((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*libc.Uint64FromInt64(32) + uint64((*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen)*libc.Uint64FromInt64(1)
  12003. ret = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, allocsize)
  12004. if !(ret != 0) {
  12005. return libc.UintptrFromInt32(0)
  12006. }
  12007. /* What follows is an iterative implementation (of what was previously done
  12008. * recursively in a dedicated function called "build_node". The old recursive
  12009. * build_node could be forced into stack exhaustion from input as small as a
  12010. * few megabyte, and so that was a security issue. Hence, a function call
  12011. * stack is avoided now by resolving recursion.)
  12012. *
  12013. * The iterative approach works as follows:
  12014. *
  12015. * - We have two writing pointers, both walking up the result array; one does
  12016. * the work, the other creates "jobs" for its colleague to do, and leads
  12017. * the way:
  12018. *
  12019. * - The faster one, pointer jobDest, always leads and writes "what job
  12020. * to do" by the other, once they reach that place in the
  12021. * array: leader "jobDest" stores the source node array index (relative
  12022. * to array dtd->scaffold) in field "numchildren".
  12023. *
  12024. * - The slower one, pointer dest, looks at the value stored in the
  12025. * "numchildren" field (which actually holds a source node array index
  12026. * at that time) and puts the real data from dtd->scaffold in.
  12027. *
  12028. * - Before the loop starts, jobDest writes source array index 0
  12029. * (where the root node is located) so that dest will have something to do
  12030. * when it starts operation.
  12031. *
  12032. * - Whenever nodes with children are encountered, jobDest appends
  12033. * them as new jobs, in order. As a result, tree node siblings are
  12034. * adjacent in the resulting array, for example:
  12035. *
  12036. * [0] root, has two children
  12037. * [1] first child of 0, has three children
  12038. * [3] first child of 1, does not have children
  12039. * [4] second child of 1, does not have children
  12040. * [5] third child of 1, does not have children
  12041. * [2] second child of 0, does not have children
  12042. *
  12043. * Or (the same data) presented in flat array view:
  12044. *
  12045. * [0] root, has two children
  12046. *
  12047. * [1] first child of 0, has three children
  12048. * [2] second child of 0, does not have children
  12049. *
  12050. * [3] first child of 1, does not have children
  12051. * [4] second child of 1, does not have children
  12052. * [5] third child of 1, does not have children
  12053. *
  12054. * - The algorithm repeats until all target array indices have been processed.
  12055. */
  12056. dest = ret /* tree node writing location, moves upwards */
  12057. destLimit = ret + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*32
  12058. jobDest = ret /* next free writing location in target array */
  12059. str = ret + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*32
  12060. /* Add the starting job, the root node (index 0) of the source tree */
  12061. v1 = jobDest
  12062. jobDest += 32
  12063. (*TXML_Content)(unsafe.Pointer(v1)).Fnumchildren = uint32(0)
  12064. for {
  12065. if !(dest < destLimit) {
  12066. break
  12067. }
  12068. /* Retrieve source tree array index from job storage */
  12069. src_node = libc.Int32FromUint32((*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren)
  12070. /* Convert item */
  12071. (*TXML_Content)(unsafe.Pointer(dest)).Ftype1 = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Ftype1
  12072. (*TXML_Content)(unsafe.Pointer(dest)).Fquant = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Fquant
  12073. if (*TXML_Content)(unsafe.Pointer(dest)).Ftype1 == int32(_XML_CTYPE_NAME) {
  12074. (*TXML_Content)(unsafe.Pointer(dest)).Fname = str
  12075. src = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Fname
  12076. for {
  12077. v4 = str
  12078. str++
  12079. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(src))
  12080. if !(*(*TXML_Char)(unsafe.Pointer(src)) != 0) {
  12081. break
  12082. }
  12083. src++
  12084. goto _3
  12085. _3:
  12086. }
  12087. (*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren = uint32(0)
  12088. (*TXML_Content)(unsafe.Pointer(dest)).Fchildren = libc.UintptrFromInt32(0)
  12089. } else {
  12090. (*TXML_Content)(unsafe.Pointer(dest)).Fname = libc.UintptrFromInt32(0)
  12091. (*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren = libc.Uint32FromInt32((*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Fchildcnt)
  12092. (*TXML_Content)(unsafe.Pointer(dest)).Fchildren = jobDest
  12093. /* Append scaffold indices of children to array */
  12094. i = uint32(0)
  12095. cn = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Ffirstchild
  12096. for {
  12097. if !(i < (*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren) {
  12098. break
  12099. }
  12100. v6 = jobDest
  12101. jobDest += 32
  12102. (*TXML_Content)(unsafe.Pointer(v6)).Fnumchildren = libc.Uint32FromInt32(cn)
  12103. goto _5
  12104. _5:
  12105. ;
  12106. i++
  12107. cn = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(cn)*32))).Fnextsib
  12108. }
  12109. }
  12110. goto _2
  12111. _2:
  12112. ;
  12113. dest += 32
  12114. }
  12115. return ret
  12116. }
  12117. func _getElementType(tls *libc.TLS, parser TXML_Parser, enc uintptr, ptr uintptr, end uintptr) (r uintptr) {
  12118. var dtd, name, ret uintptr
  12119. _, _, _ = dtd, name, ret
  12120. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  12121. name = _poolStoreString(tls, dtd+160, enc, ptr, end)
  12122. if !(name != 0) {
  12123. return libc.UintptrFromInt32(0)
  12124. }
  12125. ret = _lookup(tls, parser, dtd+40, name, uint64(40))
  12126. if !(ret != 0) {
  12127. return libc.UintptrFromInt32(0)
  12128. }
  12129. if (*TELEMENT_TYPE)(unsafe.Pointer(ret)).Fname != name {
  12130. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  12131. } else {
  12132. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  12133. if !(_setElementTypePrefix(tls, parser, ret) != 0) {
  12134. return libc.UintptrFromInt32(0)
  12135. }
  12136. }
  12137. return ret
  12138. }
  12139. func _copyString(tls *libc.TLS, s uintptr, memsuite uintptr) (r uintptr) {
  12140. var charsRequired Tsize_t
  12141. var result uintptr
  12142. _, _ = charsRequired, result
  12143. charsRequired = uint64(0)
  12144. /* First determine how long the string is */
  12145. for int32(*(*TXML_Char)(unsafe.Pointer(s + uintptr(charsRequired)))) != 0 {
  12146. charsRequired++
  12147. }
  12148. /* Include the terminator */
  12149. charsRequired++
  12150. /* Now allocate space for the copy */
  12151. result = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Fmalloc_fcn})))(tls, charsRequired*uint64(1))
  12152. if result == libc.UintptrFromInt32(0) {
  12153. return libc.UintptrFromInt32(0)
  12154. }
  12155. /* Copy the original into place */
  12156. libc.X__builtin___memcpy_chk(tls, result, s, charsRequired*uint64(1), ^t__predefined_size_t(0))
  12157. return result
  12158. }
  12159. func _accountingGetCurrentAmplification(tls *libc.TLS, rootParser TXML_Parser) (r float32) {
  12160. var amplificationFactor, v1 float32
  12161. var countBytesOutput TXmlBigCount
  12162. _, _, _ = amplificationFactor, countBytesOutput, v1
  12163. countBytesOutput = (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect + (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesIndirect
  12164. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect != 0 {
  12165. v1 = float32(countBytesOutput) / float32((*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect)
  12166. } else {
  12167. v1 = libc.Float32FromFloat32(1)
  12168. }
  12169. amplificationFactor = v1
  12170. return amplificationFactor
  12171. }
  12172. func _accountingReportStats(tls *libc.TLS, originParser TXML_Parser, epilog uintptr) {
  12173. bp := tls.Alloc(48)
  12174. defer tls.Free(48)
  12175. var amplificationFactor float32
  12176. var rootParser TXML_Parser
  12177. _, _ = amplificationFactor, rootParser
  12178. rootParser = _getRootParserOf(tls, originParser, libc.UintptrFromInt32(0))
  12179. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FdebugLevel < int32(1) {
  12180. return
  12181. }
  12182. amplificationFactor = _accountingGetCurrentAmplification(tls, rootParser)
  12183. libc.Xfprintf(tls, libc.X__stderrp, __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))
  12184. }
  12185. func _accountingOnAbort(tls *libc.TLS, originParser TXML_Parser) {
  12186. _accountingReportStats(tls, originParser, __ccgo_ts+1748)
  12187. }
  12188. func _accountingReportDiff(tls *libc.TLS, rootParser TXML_Parser, levelsAwayFromRootParser uint32, before uintptr, after uintptr, bytesMore Tptrdiff_t, source_line int32, account _XML_Account) {
  12189. bp := tls.Alloc(64)
  12190. defer tls.Free(64)
  12191. var contextLength uint32
  12192. var ellipsisLength Tsize_t
  12193. var walker, v1 uintptr
  12194. var _ /* ellipis at bp+0 */ [5]int8
  12195. _, _, _, _ = contextLength, ellipsisLength, walker, v1
  12196. if account == int32(_XML_ACCOUNT_DIRECT) {
  12197. v1 = __ccgo_ts + 1759
  12198. } else {
  12199. v1 = __ccgo_ts + 1763
  12200. }
  12201. libc.Xfprintf(tls, libc.X__stderrp, __ccgo_ts+1767, libc.VaList(bp+16, bytesMore, v1, levelsAwayFromRootParser, source_line, int32(10), __ccgo_ts+1808))
  12202. *(*[5]int8)(unsafe.Pointer(bp)) = [5]int8{'[', '.', '.', ']'}
  12203. ellipsisLength = libc.Uint64FromInt64(5) - libc.Uint64FromInt32(1)
  12204. contextLength = uint32(10)
  12205. /* Note: Performance is of no concern here */
  12206. walker = before
  12207. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FdebugLevel >= int32(3) || int64(after)-int64(before) <= libc.Int64FromUint64(uint64(contextLength)+ellipsisLength+uint64(contextLength)) {
  12208. for {
  12209. if !(walker < after) {
  12210. break
  12211. }
  12212. libc.Xfprintf(tls, libc.X__stderrp, __ccgo_ts+1809, libc.VaList(bp+16, XunsignedCharToPrintable(tls, libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(walker))))))
  12213. goto _2
  12214. _2:
  12215. ;
  12216. walker++
  12217. }
  12218. } else {
  12219. for {
  12220. if !(walker < before+uintptr(contextLength)) {
  12221. break
  12222. }
  12223. libc.Xfprintf(tls, libc.X__stderrp, __ccgo_ts+1809, libc.VaList(bp+16, XunsignedCharToPrintable(tls, libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(walker))))))
  12224. goto _3
  12225. _3:
  12226. ;
  12227. walker++
  12228. }
  12229. libc.Xfprintf(tls, libc.X__stderrp, bp, 0)
  12230. walker = after - uintptr(contextLength)
  12231. for {
  12232. if !(walker < after) {
  12233. break
  12234. }
  12235. libc.Xfprintf(tls, libc.X__stderrp, __ccgo_ts+1809, libc.VaList(bp+16, XunsignedCharToPrintable(tls, libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(walker))))))
  12236. goto _4
  12237. _4:
  12238. ;
  12239. walker++
  12240. }
  12241. }
  12242. libc.Xfprintf(tls, libc.X__stderrp, __ccgo_ts+1812, 0)
  12243. }
  12244. func _accountingDiffTolerated(tls *libc.TLS, originParser TXML_Parser, tok int32, before uintptr, after uintptr, source_line int32, account _XML_Account) (r TXML_Bool) {
  12245. bp := tls.Alloc(16)
  12246. defer tls.Free(16)
  12247. var additionTarget, v1 uintptr
  12248. var amplificationFactor float32
  12249. var bytesMore Tptrdiff_t
  12250. var countBytesOutput TXmlBigCount
  12251. var isDirect int32
  12252. var rootParser TXML_Parser
  12253. var tolerated TXML_Bool
  12254. var _ /* levelsAwayFromRootParser at bp+0 */ uint32
  12255. _, _, _, _, _, _, _, _ = additionTarget, amplificationFactor, bytesMore, countBytesOutput, isDirect, rootParser, tolerated, v1
  12256. /* Note: We need to check the token type *first* to be sure that
  12257. * we can even access variable <after>, safely.
  12258. * E.g. for XML_TOK_NONE <after> may hold an invalid pointer. */
  12259. switch tok {
  12260. case m_XML_TOK_INVALID:
  12261. fallthrough
  12262. case -int32(1):
  12263. fallthrough
  12264. case -int32(2):
  12265. fallthrough
  12266. case -int32(4):
  12267. return libc.Uint8FromInt32(1)
  12268. }
  12269. if account == int32(_XML_ACCOUNT_NONE) {
  12270. return libc.Uint8FromInt32(1)
  12271. }
  12272. rootParser = _getRootParserOf(tls, originParser, bp)
  12273. isDirect = libc.BoolInt32(account == int32(_XML_ACCOUNT_DIRECT) && originParser == rootParser)
  12274. bytesMore = int64(after) - int64(before)
  12275. if isDirect != 0 {
  12276. v1 = rootParser + 928
  12277. } else {
  12278. v1 = rootParser + 928 + 8
  12279. }
  12280. additionTarget = v1
  12281. /* Detect and avoid integer overflow */
  12282. if *(*TXmlBigCount)(unsafe.Pointer(additionTarget)) > libc.Uint64FromInt32(-libc.Int32FromInt32(1))-libc.Uint64FromInt64(bytesMore) {
  12283. return libc.Uint8FromInt32(0)
  12284. }
  12285. *(*TXmlBigCount)(unsafe.Pointer(additionTarget)) += libc.Uint64FromInt64(bytesMore)
  12286. countBytesOutput = (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect + (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesIndirect
  12287. amplificationFactor = _accountingGetCurrentAmplification(tls, rootParser)
  12288. tolerated = libc.BoolUint8(countBytesOutput < (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FactivationThresholdBytes || amplificationFactor <= (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FmaximumAmplificationFactor)
  12289. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FdebugLevel >= int32(2) {
  12290. _accountingReportStats(tls, rootParser, __ccgo_ts+1808)
  12291. _accountingReportDiff(tls, rootParser, *(*uint32)(unsafe.Pointer(bp)), before, after, bytesMore, source_line, account)
  12292. }
  12293. return tolerated
  12294. }
  12295. func XtestingAccountingGetCountBytesDirect(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  12296. if !(parser != 0) {
  12297. return uint64(0)
  12298. }
  12299. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FcountBytesDirect
  12300. }
  12301. func XtestingAccountingGetCountBytesIndirect(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  12302. if !(parser != 0) {
  12303. return uint64(0)
  12304. }
  12305. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FcountBytesIndirect
  12306. }
  12307. func _entityTrackingReportStats(tls *libc.TLS, rootParser TXML_Parser, entity uintptr, action uintptr, sourceLine int32) {
  12308. bp := tls.Alloc(96)
  12309. defer tls.Free(96)
  12310. var entityName, v1 uintptr
  12311. _, _ = entityName, v1
  12312. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FdebugLevel < int32(1) {
  12313. return
  12314. }
  12315. entityName = (*TENTITY)(unsafe.Pointer(entity)).Fname
  12316. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  12317. v1 = __ccgo_ts + 1815
  12318. } else {
  12319. v1 = __ccgo_ts + 1817
  12320. }
  12321. libc.Xfprintf(tls, libc.X__stderrp, __ccgo_ts+1819, libc.VaList(bp+8, rootParser, (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcountEverOpened, (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcurrentDepth, (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FmaximumDepthSeen, ((*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcurrentDepth-uint32(1))*uint32(2), __ccgo_ts+1808, v1, entityName, action, (*TENTITY)(unsafe.Pointer(entity)).FtextLen, sourceLine))
  12322. }
  12323. func _entityTrackingOnOpen(tls *libc.TLS, originParser TXML_Parser, entity uintptr, sourceLine int32) {
  12324. var rootParser TXML_Parser
  12325. _ = rootParser
  12326. rootParser = _getRootParserOf(tls, originParser, libc.UintptrFromInt32(0))
  12327. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcountEverOpened++
  12328. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcurrentDepth++
  12329. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcurrentDepth > (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FmaximumDepthSeen {
  12330. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FmaximumDepthSeen++
  12331. }
  12332. _entityTrackingReportStats(tls, rootParser, entity, __ccgo_ts+1904, sourceLine)
  12333. }
  12334. func _entityTrackingOnClose(tls *libc.TLS, originParser TXML_Parser, entity uintptr, sourceLine int32) {
  12335. var rootParser TXML_Parser
  12336. _ = rootParser
  12337. rootParser = _getRootParserOf(tls, originParser, libc.UintptrFromInt32(0))
  12338. _entityTrackingReportStats(tls, rootParser, entity, __ccgo_ts+1910, sourceLine)
  12339. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcurrentDepth--
  12340. }
  12341. func _getRootParserOf(tls *libc.TLS, parser TXML_Parser, outLevelDiff uintptr) (r TXML_Parser) {
  12342. var rootParser TXML_Parser
  12343. var stepsTakenUpwards uint32
  12344. _, _ = rootParser, stepsTakenUpwards
  12345. rootParser = parser
  12346. stepsTakenUpwards = uint32(0)
  12347. for (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_parentParser != 0 {
  12348. rootParser = (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_parentParser
  12349. stepsTakenUpwards++
  12350. }
  12351. if outLevelDiff != libc.UintptrFromInt32(0) {
  12352. *(*uint32)(unsafe.Pointer(outLevelDiff)) = stepsTakenUpwards
  12353. }
  12354. return rootParser
  12355. }
  12356. func XunsignedCharToPrintable(tls *libc.TLS, c uint8) (r uintptr) {
  12357. switch libc.Int32FromUint8(c) {
  12358. case 0:
  12359. return __ccgo_ts + 1916
  12360. case int32(1):
  12361. return __ccgo_ts + 1919
  12362. case int32(2):
  12363. return __ccgo_ts + 1923
  12364. case int32(3):
  12365. return __ccgo_ts + 1927
  12366. case int32(4):
  12367. return __ccgo_ts + 1931
  12368. case int32(5):
  12369. return __ccgo_ts + 1935
  12370. case int32(6):
  12371. return __ccgo_ts + 1939
  12372. case int32(7):
  12373. return __ccgo_ts + 1943
  12374. case int32(8):
  12375. return __ccgo_ts + 1947
  12376. case int32(9):
  12377. return __ccgo_ts + 1951
  12378. case int32(10):
  12379. return __ccgo_ts + 1954
  12380. case int32(11):
  12381. return __ccgo_ts + 1957
  12382. case int32(12):
  12383. return __ccgo_ts + 1961
  12384. case int32(13):
  12385. return __ccgo_ts + 1965
  12386. case int32(14):
  12387. return __ccgo_ts + 1968
  12388. case int32(15):
  12389. return __ccgo_ts + 1972
  12390. case int32(16):
  12391. return __ccgo_ts + 1976
  12392. case int32(17):
  12393. return __ccgo_ts + 1981
  12394. case int32(18):
  12395. return __ccgo_ts + 1986
  12396. case int32(19):
  12397. return __ccgo_ts + 1991
  12398. case int32(20):
  12399. return __ccgo_ts + 1996
  12400. case int32(21):
  12401. return __ccgo_ts + 2001
  12402. case int32(22):
  12403. return __ccgo_ts + 2006
  12404. case int32(23):
  12405. return __ccgo_ts + 2011
  12406. case int32(24):
  12407. return __ccgo_ts + 2016
  12408. case int32(25):
  12409. return __ccgo_ts + 2021
  12410. case int32(26):
  12411. return __ccgo_ts + 2026
  12412. case int32(27):
  12413. return __ccgo_ts + 2031
  12414. case int32(28):
  12415. return __ccgo_ts + 2036
  12416. case int32(29):
  12417. return __ccgo_ts + 2041
  12418. case int32(30):
  12419. return __ccgo_ts + 2046
  12420. case int32(31):
  12421. return __ccgo_ts + 2051
  12422. case int32(32):
  12423. return __ccgo_ts + 2056
  12424. case int32(33):
  12425. return __ccgo_ts + 2058
  12426. case int32(34):
  12427. return __ccgo_ts + 2060
  12428. case int32(35):
  12429. return __ccgo_ts + 2063
  12430. case int32(36):
  12431. return __ccgo_ts + 2065
  12432. case int32(37):
  12433. return __ccgo_ts + 1815
  12434. case int32(38):
  12435. return __ccgo_ts + 1817
  12436. case int32(39):
  12437. return __ccgo_ts + 2067
  12438. case int32(40):
  12439. return __ccgo_ts + 2069
  12440. case int32(41):
  12441. return __ccgo_ts + 2071
  12442. case int32(42):
  12443. return __ccgo_ts + 2073
  12444. case int32(43):
  12445. return __ccgo_ts + 2075
  12446. case int32(44):
  12447. return __ccgo_ts + 2077
  12448. case int32(45):
  12449. return __ccgo_ts + 2079
  12450. case int32(46):
  12451. return __ccgo_ts + 2081
  12452. case int32(47):
  12453. return __ccgo_ts + 2083
  12454. case int32(48):
  12455. return __ccgo_ts + 2085
  12456. case int32(49):
  12457. return __ccgo_ts + 2087
  12458. case int32(50):
  12459. return __ccgo_ts + 2089
  12460. case int32(51):
  12461. return __ccgo_ts + 2091
  12462. case int32(52):
  12463. return __ccgo_ts + 2093
  12464. case int32(53):
  12465. return __ccgo_ts + 2095
  12466. case int32(54):
  12467. return __ccgo_ts + 2097
  12468. case int32(55):
  12469. return __ccgo_ts + 2099
  12470. case int32(56):
  12471. return __ccgo_ts + 2101
  12472. case int32(57):
  12473. return __ccgo_ts + 2103
  12474. case int32(58):
  12475. return __ccgo_ts + 2105
  12476. case int32(59):
  12477. return __ccgo_ts + 2107
  12478. case int32(60):
  12479. return __ccgo_ts + 2109
  12480. case int32(61):
  12481. return __ccgo_ts + 2111
  12482. case int32(62):
  12483. return __ccgo_ts + 2113
  12484. case int32(63):
  12485. return __ccgo_ts + 2115
  12486. case int32(64):
  12487. return __ccgo_ts + 2117
  12488. case int32(65):
  12489. return __ccgo_ts + 2119
  12490. case int32(66):
  12491. return __ccgo_ts + 2121
  12492. case int32(67):
  12493. return __ccgo_ts + 2123
  12494. case int32(68):
  12495. return __ccgo_ts + 2125
  12496. case int32(69):
  12497. return __ccgo_ts + 2127
  12498. case int32(70):
  12499. return __ccgo_ts + 2129
  12500. case int32(71):
  12501. return __ccgo_ts + 2131
  12502. case int32(72):
  12503. return __ccgo_ts + 2133
  12504. case int32(73):
  12505. return __ccgo_ts + 2135
  12506. case int32(74):
  12507. return __ccgo_ts + 2137
  12508. case int32(75):
  12509. return __ccgo_ts + 2139
  12510. case int32(76):
  12511. return __ccgo_ts + 2141
  12512. case int32(77):
  12513. return __ccgo_ts + 2143
  12514. case int32(78):
  12515. return __ccgo_ts + 2145
  12516. case int32(79):
  12517. return __ccgo_ts + 2147
  12518. case int32(80):
  12519. return __ccgo_ts + 2149
  12520. case int32(81):
  12521. return __ccgo_ts + 2151
  12522. case int32(82):
  12523. return __ccgo_ts + 2153
  12524. case int32(83):
  12525. return __ccgo_ts + 2155
  12526. case int32(84):
  12527. return __ccgo_ts + 2157
  12528. case int32(85):
  12529. return __ccgo_ts + 2159
  12530. case int32(86):
  12531. return __ccgo_ts + 2161
  12532. case int32(87):
  12533. return __ccgo_ts + 2163
  12534. case int32(88):
  12535. return __ccgo_ts + 2165
  12536. case int32(89):
  12537. return __ccgo_ts + 2167
  12538. case int32(90):
  12539. return __ccgo_ts + 2169
  12540. case int32(91):
  12541. return __ccgo_ts + 2171
  12542. case int32(92):
  12543. return __ccgo_ts + 2173
  12544. case int32(93):
  12545. return __ccgo_ts + 2176
  12546. case int32(94):
  12547. return __ccgo_ts + 2178
  12548. case int32(95):
  12549. return __ccgo_ts + 2180
  12550. case int32(96):
  12551. return __ccgo_ts + 2182
  12552. case int32(97):
  12553. return __ccgo_ts + 2184
  12554. case int32(98):
  12555. return __ccgo_ts + 2186
  12556. case int32(99):
  12557. return __ccgo_ts + 2188
  12558. case int32(100):
  12559. return __ccgo_ts + 2190
  12560. case int32(101):
  12561. return __ccgo_ts + 2192
  12562. case int32(102):
  12563. return __ccgo_ts + 2194
  12564. case int32(103):
  12565. return __ccgo_ts + 2196
  12566. case int32(104):
  12567. return __ccgo_ts + 2198
  12568. case int32(105):
  12569. return __ccgo_ts + 2200
  12570. case int32(106):
  12571. return __ccgo_ts + 2202
  12572. case int32(107):
  12573. return __ccgo_ts + 2204
  12574. case int32(108):
  12575. return __ccgo_ts + 2206
  12576. case int32(109):
  12577. return __ccgo_ts + 2208
  12578. case int32(110):
  12579. return __ccgo_ts + 2210
  12580. case int32(111):
  12581. return __ccgo_ts + 2212
  12582. case int32(112):
  12583. return __ccgo_ts + 2214
  12584. case int32(113):
  12585. return __ccgo_ts + 2216
  12586. case int32(114):
  12587. return __ccgo_ts + 2218
  12588. case int32(115):
  12589. return __ccgo_ts + 2220
  12590. case int32(116):
  12591. return __ccgo_ts + 2222
  12592. case int32(117):
  12593. return __ccgo_ts + 2224
  12594. case int32(118):
  12595. return __ccgo_ts + 2226
  12596. case int32(119):
  12597. return __ccgo_ts + 2228
  12598. case int32(120):
  12599. return __ccgo_ts + 2230
  12600. case int32(121):
  12601. return __ccgo_ts + 2232
  12602. case int32(122):
  12603. return __ccgo_ts + 2234
  12604. case int32(123):
  12605. return __ccgo_ts + 2236
  12606. case int32(124):
  12607. return __ccgo_ts + 2238
  12608. case int32(125):
  12609. return __ccgo_ts + 2240
  12610. case int32(126):
  12611. return __ccgo_ts + 2242
  12612. case int32(127):
  12613. return __ccgo_ts + 2244
  12614. case int32(128):
  12615. return __ccgo_ts + 2249
  12616. case int32(129):
  12617. return __ccgo_ts + 2254
  12618. case int32(130):
  12619. return __ccgo_ts + 2259
  12620. case int32(131):
  12621. return __ccgo_ts + 2264
  12622. case int32(132):
  12623. return __ccgo_ts + 2269
  12624. case int32(133):
  12625. return __ccgo_ts + 2274
  12626. case int32(134):
  12627. return __ccgo_ts + 2279
  12628. case int32(135):
  12629. return __ccgo_ts + 2284
  12630. case int32(136):
  12631. return __ccgo_ts + 2289
  12632. case int32(137):
  12633. return __ccgo_ts + 2294
  12634. case int32(138):
  12635. return __ccgo_ts + 2299
  12636. case int32(139):
  12637. return __ccgo_ts + 2304
  12638. case int32(140):
  12639. return __ccgo_ts + 2309
  12640. case int32(141):
  12641. return __ccgo_ts + 2314
  12642. case int32(142):
  12643. return __ccgo_ts + 2319
  12644. case int32(143):
  12645. return __ccgo_ts + 2324
  12646. case int32(144):
  12647. return __ccgo_ts + 2329
  12648. case int32(145):
  12649. return __ccgo_ts + 2334
  12650. case int32(146):
  12651. return __ccgo_ts + 2339
  12652. case int32(147):
  12653. return __ccgo_ts + 2344
  12654. case int32(148):
  12655. return __ccgo_ts + 2349
  12656. case int32(149):
  12657. return __ccgo_ts + 2354
  12658. case int32(150):
  12659. return __ccgo_ts + 2359
  12660. case int32(151):
  12661. return __ccgo_ts + 2364
  12662. case int32(152):
  12663. return __ccgo_ts + 2369
  12664. case int32(153):
  12665. return __ccgo_ts + 2374
  12666. case int32(154):
  12667. return __ccgo_ts + 2379
  12668. case int32(155):
  12669. return __ccgo_ts + 2384
  12670. case int32(156):
  12671. return __ccgo_ts + 2389
  12672. case int32(157):
  12673. return __ccgo_ts + 2394
  12674. case int32(158):
  12675. return __ccgo_ts + 2399
  12676. case int32(159):
  12677. return __ccgo_ts + 2404
  12678. case int32(160):
  12679. return __ccgo_ts + 2409
  12680. case int32(161):
  12681. return __ccgo_ts + 2414
  12682. case int32(162):
  12683. return __ccgo_ts + 2419
  12684. case int32(163):
  12685. return __ccgo_ts + 2424
  12686. case int32(164):
  12687. return __ccgo_ts + 2429
  12688. case int32(165):
  12689. return __ccgo_ts + 2434
  12690. case int32(166):
  12691. return __ccgo_ts + 2439
  12692. case int32(167):
  12693. return __ccgo_ts + 2444
  12694. case int32(168):
  12695. return __ccgo_ts + 2449
  12696. case int32(169):
  12697. return __ccgo_ts + 2454
  12698. case int32(170):
  12699. return __ccgo_ts + 2459
  12700. case int32(171):
  12701. return __ccgo_ts + 2464
  12702. case int32(172):
  12703. return __ccgo_ts + 2469
  12704. case int32(173):
  12705. return __ccgo_ts + 2474
  12706. case int32(174):
  12707. return __ccgo_ts + 2479
  12708. case int32(175):
  12709. return __ccgo_ts + 2484
  12710. case int32(176):
  12711. return __ccgo_ts + 2489
  12712. case int32(177):
  12713. return __ccgo_ts + 2494
  12714. case int32(178):
  12715. return __ccgo_ts + 2499
  12716. case int32(179):
  12717. return __ccgo_ts + 2504
  12718. case int32(180):
  12719. return __ccgo_ts + 2509
  12720. case int32(181):
  12721. return __ccgo_ts + 2514
  12722. case int32(182):
  12723. return __ccgo_ts + 2519
  12724. case int32(183):
  12725. return __ccgo_ts + 2524
  12726. case int32(184):
  12727. return __ccgo_ts + 2529
  12728. case int32(185):
  12729. return __ccgo_ts + 2534
  12730. case int32(186):
  12731. return __ccgo_ts + 2539
  12732. case int32(187):
  12733. return __ccgo_ts + 2544
  12734. case int32(188):
  12735. return __ccgo_ts + 2549
  12736. case int32(189):
  12737. return __ccgo_ts + 2554
  12738. case int32(190):
  12739. return __ccgo_ts + 2559
  12740. case int32(191):
  12741. return __ccgo_ts + 2564
  12742. case int32(192):
  12743. return __ccgo_ts + 2569
  12744. case int32(193):
  12745. return __ccgo_ts + 2574
  12746. case int32(194):
  12747. return __ccgo_ts + 2579
  12748. case int32(195):
  12749. return __ccgo_ts + 2584
  12750. case int32(196):
  12751. return __ccgo_ts + 2589
  12752. case int32(197):
  12753. return __ccgo_ts + 2594
  12754. case int32(198):
  12755. return __ccgo_ts + 2599
  12756. case int32(199):
  12757. return __ccgo_ts + 2604
  12758. case int32(200):
  12759. return __ccgo_ts + 2609
  12760. case int32(201):
  12761. return __ccgo_ts + 2614
  12762. case int32(202):
  12763. return __ccgo_ts + 2619
  12764. case int32(203):
  12765. return __ccgo_ts + 2624
  12766. case int32(204):
  12767. return __ccgo_ts + 2629
  12768. case int32(205):
  12769. return __ccgo_ts + 2634
  12770. case int32(206):
  12771. return __ccgo_ts + 2639
  12772. case int32(207):
  12773. return __ccgo_ts + 2644
  12774. case int32(208):
  12775. return __ccgo_ts + 2649
  12776. case int32(209):
  12777. return __ccgo_ts + 2654
  12778. case int32(210):
  12779. return __ccgo_ts + 2659
  12780. case int32(211):
  12781. return __ccgo_ts + 2664
  12782. case int32(212):
  12783. return __ccgo_ts + 2669
  12784. case int32(213):
  12785. return __ccgo_ts + 2674
  12786. case int32(214):
  12787. return __ccgo_ts + 2679
  12788. case int32(215):
  12789. return __ccgo_ts + 2684
  12790. case int32(216):
  12791. return __ccgo_ts + 2689
  12792. case int32(217):
  12793. return __ccgo_ts + 2694
  12794. case int32(218):
  12795. return __ccgo_ts + 2699
  12796. case int32(219):
  12797. return __ccgo_ts + 2704
  12798. case int32(220):
  12799. return __ccgo_ts + 2709
  12800. case int32(221):
  12801. return __ccgo_ts + 2714
  12802. case int32(222):
  12803. return __ccgo_ts + 2719
  12804. case int32(223):
  12805. return __ccgo_ts + 2724
  12806. case int32(224):
  12807. return __ccgo_ts + 2729
  12808. case int32(225):
  12809. return __ccgo_ts + 2734
  12810. case int32(226):
  12811. return __ccgo_ts + 2739
  12812. case int32(227):
  12813. return __ccgo_ts + 2744
  12814. case int32(228):
  12815. return __ccgo_ts + 2749
  12816. case int32(229):
  12817. return __ccgo_ts + 2754
  12818. case int32(230):
  12819. return __ccgo_ts + 2759
  12820. case int32(231):
  12821. return __ccgo_ts + 2764
  12822. case int32(232):
  12823. return __ccgo_ts + 2769
  12824. case int32(233):
  12825. return __ccgo_ts + 2774
  12826. case int32(234):
  12827. return __ccgo_ts + 2779
  12828. case int32(235):
  12829. return __ccgo_ts + 2784
  12830. case int32(236):
  12831. return __ccgo_ts + 2789
  12832. case int32(237):
  12833. return __ccgo_ts + 2794
  12834. case int32(238):
  12835. return __ccgo_ts + 2799
  12836. case int32(239):
  12837. return __ccgo_ts + 2804
  12838. case int32(240):
  12839. return __ccgo_ts + 2809
  12840. case int32(241):
  12841. return __ccgo_ts + 2814
  12842. case int32(242):
  12843. return __ccgo_ts + 2819
  12844. case int32(243):
  12845. return __ccgo_ts + 2824
  12846. case int32(244):
  12847. return __ccgo_ts + 2829
  12848. case int32(245):
  12849. return __ccgo_ts + 2834
  12850. case int32(246):
  12851. return __ccgo_ts + 2839
  12852. case int32(247):
  12853. return __ccgo_ts + 2844
  12854. case int32(248):
  12855. return __ccgo_ts + 2849
  12856. case int32(249):
  12857. return __ccgo_ts + 2854
  12858. case int32(250):
  12859. return __ccgo_ts + 2859
  12860. case int32(251):
  12861. return __ccgo_ts + 2864
  12862. case int32(252):
  12863. return __ccgo_ts + 2869
  12864. case int32(253):
  12865. return __ccgo_ts + 2874
  12866. case int32(254):
  12867. return __ccgo_ts + 2879
  12868. case int32(255):
  12869. return __ccgo_ts + 2884
  12870. default:
  12871. /* never gets here */
  12872. return __ccgo_ts + 2889
  12873. }
  12874. /* never gets here */
  12875. return r
  12876. }
  12877. func _getDebugLevel(tls *libc.TLS, variableName uintptr, defaultDebugLevel uint64) (r uint64) {
  12878. bp := tls.Alloc(16)
  12879. defer tls.Free(16)
  12880. var debugLevel uint64
  12881. var value, valueOrNull uintptr
  12882. var _ /* afterValue at bp+0 */ uintptr
  12883. _, _, _ = debugLevel, value, valueOrNull
  12884. valueOrNull = libc.Xgetenv(tls, variableName)
  12885. if valueOrNull == libc.UintptrFromInt32(0) {
  12886. return defaultDebugLevel
  12887. }
  12888. value = valueOrNull
  12889. *(*int32)(unsafe.Pointer(libc.X__error(tls))) = 0
  12890. *(*uintptr)(unsafe.Pointer(bp)) = value
  12891. debugLevel = libc.Xstrtoul(tls, value, bp, int32(10))
  12892. if *(*int32)(unsafe.Pointer(libc.X__error(tls))) != 0 || int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) != int32('\000') {
  12893. *(*int32)(unsafe.Pointer(libc.X__error(tls))) = 0
  12894. return defaultDebugLevel
  12895. }
  12896. return debugLevel
  12897. }
  12898. const m_ASCII_01 = 0x30
  12899. const m_ASCII_11 = 0x31
  12900. const m_ASCII_21 = 0x32
  12901. const m_ASCII_31 = 0x33
  12902. const m_ASCII_81 = 0x38
  12903. const m_ASCII_91 = 0x39
  12904. const m_ASCII_B1 = 66
  12905. const m_ASCII_COLON1 = 0x3A
  12906. const m_ASCII_COMMA1 = 0x2C
  12907. const m_ASCII_EQUALS1 = 0x3D
  12908. const m_ASCII_EXCL1 = 0x21
  12909. const m_ASCII_FF1 = 0x0C
  12910. const m_ASCII_G1 = 71
  12911. const m_ASCII_HASH1 = 0x23
  12912. const m_ASCII_LPAREN1 = 0x28
  12913. const m_ASCII_P1 = 80
  12914. const m_ASCII_PERIOD1 = 0x2E
  12915. const m_ASCII_PIPE1 = 0x7C
  12916. const m_ASCII_Q1 = 81
  12917. const m_ASCII_RPAREN1 = 0x29
  12918. const m_ASCII_SLASH1 = 0x2F
  12919. const m_ASCII_U1 = 85
  12920. const m_ASCII_a1 = 0x61
  12921. const m_ASCII_c1 = 0x63
  12922. const m_ASCII_e1 = 0x65
  12923. const m_ASCII_g1 = 0x67
  12924. const m_ASCII_h1 = 0x68
  12925. const m_ASCII_l1 = 0x6C
  12926. const m_ASCII_m1 = 0x6D
  12927. const m_ASCII_n1 = 0x6E
  12928. const m_ASCII_o1 = 0x6F
  12929. const m_ASCII_p1 = 0x70
  12930. const m_ASCII_r1 = 0x72
  12931. const m_ASCII_s1 = 0x73
  12932. const m_ASCII_t1 = 0x74
  12933. const m_ASCII_w1 = 0x77
  12934. const m_ASCII_x1 = 0x78
  12935. const m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT1 = "100.0f"
  12936. /*
  12937. __ __ _
  12938. ___\ \/ /_ __ __ _| |_
  12939. / _ \\ /| '_ \ / _` | __|
  12940. | __// \| |_) | (_| | |_
  12941. \___/_/\_\ .__/ \__,_|\__|
  12942. |_| XML parser
  12943. Copyright (c) 1999-2000 Thai Open Source Software Center Ltd
  12944. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  12945. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  12946. Copyright (c) 2007 Karl Waclawek <karl@waclawek.net>
  12947. Copyright (c) 2017 Sebastian Pipping <sebastian@pipping.org>
  12948. Licensed under the MIT license:
  12949. Permission is hereby granted, free of charge, to any person obtaining
  12950. a copy of this software and associated documentation files (the
  12951. "Software"), to deal in the Software without restriction, including
  12952. without limitation the rights to use, copy, modify, merge, publish,
  12953. distribute, sublicense, and/or sell copies of the Software, and to permit
  12954. persons to whom the Software is furnished to do so, subject to the
  12955. following conditions:
  12956. The above copyright notice and this permission notice shall be included
  12957. in all copies or substantial portions of the Software.
  12958. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  12959. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  12960. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  12961. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  12962. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  12963. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  12964. USE OR OTHER DEALINGS IN THE SOFTWARE.
  12965. */
  12966. /* Doesn't check:
  12967. that ,| are not mixed in a model group
  12968. content of literals
  12969. */
  12970. var _KW_ANY = [4]int8{
  12971. 0: int8(m_ASCII_A),
  12972. 1: int8(m_ASCII_N),
  12973. 2: int8(m_ASCII_Y),
  12974. }
  12975. var _KW_ATTLIST = [8]int8{
  12976. 0: int8(m_ASCII_A),
  12977. 1: int8(m_ASCII_T),
  12978. 2: int8(m_ASCII_T),
  12979. 3: int8(m_ASCII_L),
  12980. 4: int8(m_ASCII_I),
  12981. 5: int8(m_ASCII_S),
  12982. 6: int8(m_ASCII_T),
  12983. }
  12984. var _KW_CDATA = [6]int8{
  12985. 0: int8(m_ASCII_C),
  12986. 1: int8(m_ASCII_D),
  12987. 2: int8(m_ASCII_A),
  12988. 3: int8(m_ASCII_T),
  12989. 4: int8(m_ASCII_A),
  12990. }
  12991. var _KW_DOCTYPE = [8]int8{
  12992. 0: int8(m_ASCII_D),
  12993. 1: int8(m_ASCII_O),
  12994. 2: int8(m_ASCII_C),
  12995. 3: int8(m_ASCII_T),
  12996. 4: int8(m_ASCII_Y),
  12997. 5: int8(m_ASCII_P1),
  12998. 6: int8(m_ASCII_E),
  12999. }
  13000. var _KW_ELEMENT = [8]int8{
  13001. 0: int8(m_ASCII_E),
  13002. 1: int8(m_ASCII_L),
  13003. 2: int8(m_ASCII_E),
  13004. 3: int8(m_ASCII_M),
  13005. 4: int8(m_ASCII_E),
  13006. 5: int8(m_ASCII_N),
  13007. 6: int8(m_ASCII_T),
  13008. }
  13009. var _KW_EMPTY = [6]int8{
  13010. 0: int8(m_ASCII_E),
  13011. 1: int8(m_ASCII_M),
  13012. 2: int8(m_ASCII_P1),
  13013. 3: int8(m_ASCII_T),
  13014. 4: int8(m_ASCII_Y),
  13015. }
  13016. var _KW_ENTITIES = [9]int8{
  13017. 0: int8(m_ASCII_E),
  13018. 1: int8(m_ASCII_N),
  13019. 2: int8(m_ASCII_T),
  13020. 3: int8(m_ASCII_I),
  13021. 4: int8(m_ASCII_T),
  13022. 5: int8(m_ASCII_I),
  13023. 6: int8(m_ASCII_E),
  13024. 7: int8(m_ASCII_S),
  13025. }
  13026. var _KW_ENTITY = [7]int8{
  13027. 0: int8(m_ASCII_E),
  13028. 1: int8(m_ASCII_N),
  13029. 2: int8(m_ASCII_T),
  13030. 3: int8(m_ASCII_I),
  13031. 4: int8(m_ASCII_T),
  13032. 5: int8(m_ASCII_Y),
  13033. }
  13034. var _KW_FIXED = [6]int8{
  13035. 0: int8(m_ASCII_F),
  13036. 1: int8(m_ASCII_I),
  13037. 2: int8(m_ASCII_X),
  13038. 3: int8(m_ASCII_E),
  13039. 4: int8(m_ASCII_D),
  13040. }
  13041. var _KW_ID = [3]int8{
  13042. 0: int8(m_ASCII_I),
  13043. 1: int8(m_ASCII_D),
  13044. }
  13045. var _KW_IDREF = [6]int8{
  13046. 0: int8(m_ASCII_I),
  13047. 1: int8(m_ASCII_D),
  13048. 2: int8(m_ASCII_R),
  13049. 3: int8(m_ASCII_E),
  13050. 4: int8(m_ASCII_F),
  13051. }
  13052. var _KW_IDREFS = [7]int8{
  13053. 0: int8(m_ASCII_I),
  13054. 1: int8(m_ASCII_D),
  13055. 2: int8(m_ASCII_R),
  13056. 3: int8(m_ASCII_E),
  13057. 4: int8(m_ASCII_F),
  13058. 5: int8(m_ASCII_S),
  13059. }
  13060. var _KW_IGNORE = [7]int8{
  13061. 0: int8(m_ASCII_I),
  13062. 1: int8(m_ASCII_G1),
  13063. 2: int8(m_ASCII_N),
  13064. 3: int8(m_ASCII_O),
  13065. 4: int8(m_ASCII_R),
  13066. 5: int8(m_ASCII_E),
  13067. }
  13068. var _KW_IMPLIED = [8]int8{
  13069. 0: int8(m_ASCII_I),
  13070. 1: int8(m_ASCII_M),
  13071. 2: int8(m_ASCII_P1),
  13072. 3: int8(m_ASCII_L),
  13073. 4: int8(m_ASCII_I),
  13074. 5: int8(m_ASCII_E),
  13075. 6: int8(m_ASCII_D),
  13076. }
  13077. var _KW_INCLUDE = [8]int8{
  13078. 0: int8(m_ASCII_I),
  13079. 1: int8(m_ASCII_N),
  13080. 2: int8(m_ASCII_C),
  13081. 3: int8(m_ASCII_L),
  13082. 4: int8(m_ASCII_U1),
  13083. 5: int8(m_ASCII_D),
  13084. 6: int8(m_ASCII_E),
  13085. }
  13086. var _KW_NDATA = [6]int8{
  13087. 0: int8(m_ASCII_N),
  13088. 1: int8(m_ASCII_D),
  13089. 2: int8(m_ASCII_A),
  13090. 3: int8(m_ASCII_T),
  13091. 4: int8(m_ASCII_A),
  13092. }
  13093. var _KW_NMTOKEN = [8]int8{
  13094. 0: int8(m_ASCII_N),
  13095. 1: int8(m_ASCII_M),
  13096. 2: int8(m_ASCII_T),
  13097. 3: int8(m_ASCII_O),
  13098. 4: int8(m_ASCII_K),
  13099. 5: int8(m_ASCII_E),
  13100. 6: int8(m_ASCII_N),
  13101. }
  13102. var _KW_NMTOKENS = [9]int8{
  13103. 0: int8(m_ASCII_N),
  13104. 1: int8(m_ASCII_M),
  13105. 2: int8(m_ASCII_T),
  13106. 3: int8(m_ASCII_O),
  13107. 4: int8(m_ASCII_K),
  13108. 5: int8(m_ASCII_E),
  13109. 6: int8(m_ASCII_N),
  13110. 7: int8(m_ASCII_S),
  13111. }
  13112. var _KW_NOTATION = [9]int8{
  13113. 0: int8(m_ASCII_N),
  13114. 1: int8(m_ASCII_O),
  13115. 2: int8(m_ASCII_T),
  13116. 3: int8(m_ASCII_A),
  13117. 4: int8(m_ASCII_T),
  13118. 5: int8(m_ASCII_I),
  13119. 6: int8(m_ASCII_O),
  13120. 7: int8(m_ASCII_N),
  13121. }
  13122. var _KW_PCDATA = [7]int8{
  13123. 0: int8(m_ASCII_P1),
  13124. 1: int8(m_ASCII_C),
  13125. 2: int8(m_ASCII_D),
  13126. 3: int8(m_ASCII_A),
  13127. 4: int8(m_ASCII_T),
  13128. 5: int8(m_ASCII_A),
  13129. }
  13130. var _KW_PUBLIC = [7]int8{
  13131. 0: int8(m_ASCII_P1),
  13132. 1: int8(m_ASCII_U1),
  13133. 2: int8(m_ASCII_B1),
  13134. 3: int8(m_ASCII_L),
  13135. 4: int8(m_ASCII_I),
  13136. 5: int8(m_ASCII_C),
  13137. }
  13138. var _KW_REQUIRED = [9]int8{
  13139. 0: int8(m_ASCII_R),
  13140. 1: int8(m_ASCII_E),
  13141. 2: int8(m_ASCII_Q1),
  13142. 3: int8(m_ASCII_U1),
  13143. 4: int8(m_ASCII_I),
  13144. 5: int8(m_ASCII_R),
  13145. 6: int8(m_ASCII_E),
  13146. 7: int8(m_ASCII_D),
  13147. }
  13148. var _KW_SYSTEM = [7]int8{
  13149. 0: int8(m_ASCII_S),
  13150. 1: int8(m_ASCII_Y),
  13151. 2: int8(m_ASCII_S),
  13152. 3: int8(m_ASCII_T),
  13153. 4: int8(m_ASCII_E),
  13154. 5: int8(m_ASCII_M),
  13155. }
  13156. func _prolog0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13157. switch tok {
  13158. case int32(m_XML_TOK_PROLOG_S):
  13159. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  13160. return int32(_XML_ROLE_NONE)
  13161. case int32(m_XML_TOK_XML_DECL):
  13162. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  13163. return int32(_XML_ROLE_XML_DECL)
  13164. case int32(m_XML_TOK_PI):
  13165. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  13166. return int32(_XML_ROLE_PI)
  13167. case int32(m_XML_TOK_COMMENT):
  13168. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  13169. return int32(_XML_ROLE_COMMENT)
  13170. case int32(m_XML_TOK_BOM):
  13171. return int32(_XML_ROLE_NONE)
  13172. case int32(m_XML_TOK_DECL_OPEN):
  13173. 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) {
  13174. break
  13175. }
  13176. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype0)
  13177. return int32(_XML_ROLE_DOCTYPE_NONE)
  13178. case int32(m_XML_TOK_INSTANCE_START):
  13179. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  13180. return int32(_XML_ROLE_INSTANCE_START)
  13181. }
  13182. return _common(tls, state, tok)
  13183. }
  13184. func _prolog1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13185. switch tok {
  13186. case int32(m_XML_TOK_PROLOG_S):
  13187. return int32(_XML_ROLE_NONE)
  13188. case int32(m_XML_TOK_PI):
  13189. return int32(_XML_ROLE_PI)
  13190. case int32(m_XML_TOK_COMMENT):
  13191. return int32(_XML_ROLE_COMMENT)
  13192. case int32(m_XML_TOK_BOM):
  13193. /* This case can never arise. To reach this role function, the
  13194. * parse must have passed through prolog0 and therefore have had
  13195. * some form of input, even if only a space. At that point, a
  13196. * byte order mark is no longer a valid character (though
  13197. * technically it should be interpreted as a non-breaking space),
  13198. * so will be rejected by the tokenizing stages.
  13199. */
  13200. return int32(_XML_ROLE_NONE) /* LCOV_EXCL_LINE */
  13201. case int32(m_XML_TOK_DECL_OPEN):
  13202. 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) {
  13203. break
  13204. }
  13205. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype0)
  13206. return int32(_XML_ROLE_DOCTYPE_NONE)
  13207. case int32(m_XML_TOK_INSTANCE_START):
  13208. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  13209. return int32(_XML_ROLE_INSTANCE_START)
  13210. }
  13211. return _common(tls, state, tok)
  13212. }
  13213. func _prolog2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13214. _ = ptr
  13215. _ = end
  13216. _ = enc
  13217. switch tok {
  13218. case int32(m_XML_TOK_PROLOG_S):
  13219. return int32(_XML_ROLE_NONE)
  13220. case int32(m_XML_TOK_PI):
  13221. return int32(_XML_ROLE_PI)
  13222. case int32(m_XML_TOK_COMMENT):
  13223. return int32(_XML_ROLE_COMMENT)
  13224. case int32(m_XML_TOK_INSTANCE_START):
  13225. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  13226. return int32(_XML_ROLE_INSTANCE_START)
  13227. }
  13228. return _common(tls, state, tok)
  13229. }
  13230. func _doctype0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13231. _ = ptr
  13232. _ = end
  13233. _ = enc
  13234. switch tok {
  13235. case int32(m_XML_TOK_PROLOG_S):
  13236. return int32(_XML_ROLE_DOCTYPE_NONE)
  13237. case int32(m_XML_TOK_NAME):
  13238. fallthrough
  13239. case int32(m_XML_TOK_PREFIXED_NAME):
  13240. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype1)
  13241. return int32(_XML_ROLE_DOCTYPE_NAME)
  13242. }
  13243. return _common(tls, state, tok)
  13244. }
  13245. func _doctype1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13246. switch tok {
  13247. case int32(m_XML_TOK_PROLOG_S):
  13248. return int32(_XML_ROLE_DOCTYPE_NONE)
  13249. case int32(m_XML_TOK_OPEN_BRACKET):
  13250. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_internalSubset)
  13251. return int32(_XML_ROLE_DOCTYPE_INTERNAL_SUBSET)
  13252. case int32(m_XML_TOK_DECL_CLOSE):
  13253. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog2)
  13254. return int32(_XML_ROLE_DOCTYPE_CLOSE)
  13255. case int32(m_XML_TOK_NAME):
  13256. 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 {
  13257. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype3)
  13258. return int32(_XML_ROLE_DOCTYPE_NONE)
  13259. }
  13260. 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 {
  13261. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype2)
  13262. return int32(_XML_ROLE_DOCTYPE_NONE)
  13263. }
  13264. break
  13265. }
  13266. return _common(tls, state, tok)
  13267. }
  13268. func _doctype2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13269. _ = ptr
  13270. _ = end
  13271. _ = enc
  13272. switch tok {
  13273. case int32(m_XML_TOK_PROLOG_S):
  13274. return int32(_XML_ROLE_DOCTYPE_NONE)
  13275. case int32(m_XML_TOK_LITERAL):
  13276. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype3)
  13277. return int32(_XML_ROLE_DOCTYPE_PUBLIC_ID)
  13278. }
  13279. return _common(tls, state, tok)
  13280. }
  13281. func _doctype3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13282. _ = ptr
  13283. _ = end
  13284. _ = enc
  13285. switch tok {
  13286. case int32(m_XML_TOK_PROLOG_S):
  13287. return int32(_XML_ROLE_DOCTYPE_NONE)
  13288. case int32(m_XML_TOK_LITERAL):
  13289. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype4)
  13290. return int32(_XML_ROLE_DOCTYPE_SYSTEM_ID)
  13291. }
  13292. return _common(tls, state, tok)
  13293. }
  13294. func _doctype4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13295. _ = ptr
  13296. _ = end
  13297. _ = enc
  13298. switch tok {
  13299. case int32(m_XML_TOK_PROLOG_S):
  13300. return int32(_XML_ROLE_DOCTYPE_NONE)
  13301. case int32(m_XML_TOK_OPEN_BRACKET):
  13302. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_internalSubset)
  13303. return int32(_XML_ROLE_DOCTYPE_INTERNAL_SUBSET)
  13304. case int32(m_XML_TOK_DECL_CLOSE):
  13305. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog2)
  13306. return int32(_XML_ROLE_DOCTYPE_CLOSE)
  13307. }
  13308. return _common(tls, state, tok)
  13309. }
  13310. func _doctype5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13311. _ = ptr
  13312. _ = end
  13313. _ = enc
  13314. switch tok {
  13315. case int32(m_XML_TOK_PROLOG_S):
  13316. return int32(_XML_ROLE_DOCTYPE_NONE)
  13317. case int32(m_XML_TOK_DECL_CLOSE):
  13318. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog2)
  13319. return int32(_XML_ROLE_DOCTYPE_CLOSE)
  13320. }
  13321. return _common(tls, state, tok)
  13322. }
  13323. func _internalSubset(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13324. switch tok {
  13325. case int32(m_XML_TOK_PROLOG_S):
  13326. return int32(_XML_ROLE_NONE)
  13327. case int32(m_XML_TOK_DECL_OPEN):
  13328. 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 {
  13329. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity0)
  13330. return int32(_XML_ROLE_ENTITY_NONE)
  13331. }
  13332. 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 {
  13333. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist0)
  13334. return int32(_XML_ROLE_ATTLIST_NONE)
  13335. }
  13336. 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 {
  13337. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element0)
  13338. return int32(_XML_ROLE_ELEMENT_NONE)
  13339. }
  13340. 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 {
  13341. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation0)
  13342. return int32(_XML_ROLE_NOTATION_NONE)
  13343. }
  13344. case int32(m_XML_TOK_PI):
  13345. return int32(_XML_ROLE_PI)
  13346. case int32(m_XML_TOK_COMMENT):
  13347. return int32(_XML_ROLE_COMMENT)
  13348. case int32(m_XML_TOK_PARAM_ENTITY_REF):
  13349. return int32(_XML_ROLE_PARAM_ENTITY_REF)
  13350. case int32(m_XML_TOK_CLOSE_BRACKET):
  13351. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype5)
  13352. return int32(_XML_ROLE_DOCTYPE_NONE)
  13353. case -int32(4):
  13354. return int32(_XML_ROLE_NONE)
  13355. }
  13356. return _common(tls, state, tok)
  13357. }
  13358. func _externalSubset0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13359. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset1)
  13360. if tok == int32(m_XML_TOK_XML_DECL) {
  13361. return int32(_XML_ROLE_TEXT_DECL)
  13362. }
  13363. return _externalSubset1(tls, state, tok, ptr, end, enc)
  13364. }
  13365. func _externalSubset1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13366. switch tok {
  13367. case int32(m_XML_TOK_COND_SECT_OPEN):
  13368. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_condSect0)
  13369. return int32(_XML_ROLE_NONE)
  13370. case int32(m_XML_TOK_COND_SECT_CLOSE):
  13371. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel == uint32(0) {
  13372. break
  13373. }
  13374. *(*uint32)(unsafe.Pointer(state + 16)) -= uint32(1)
  13375. return int32(_XML_ROLE_NONE)
  13376. case int32(m_XML_TOK_PROLOG_S):
  13377. return int32(_XML_ROLE_NONE)
  13378. case int32(m_XML_TOK_CLOSE_BRACKET):
  13379. case -int32(4):
  13380. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel != 0 {
  13381. break
  13382. }
  13383. return int32(_XML_ROLE_NONE)
  13384. default:
  13385. return _internalSubset(tls, state, tok, ptr, end, enc)
  13386. }
  13387. return _common(tls, state, tok)
  13388. }
  13389. func _entity0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13390. _ = ptr
  13391. _ = end
  13392. _ = enc
  13393. switch tok {
  13394. case int32(m_XML_TOK_PROLOG_S):
  13395. return int32(_XML_ROLE_ENTITY_NONE)
  13396. case int32(m_XML_TOK_PERCENT):
  13397. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity1)
  13398. return int32(_XML_ROLE_ENTITY_NONE)
  13399. case int32(m_XML_TOK_NAME):
  13400. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity2)
  13401. return int32(_XML_ROLE_GENERAL_ENTITY_NAME)
  13402. }
  13403. return _common(tls, state, tok)
  13404. }
  13405. func _entity1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13406. _ = ptr
  13407. _ = end
  13408. _ = enc
  13409. switch tok {
  13410. case int32(m_XML_TOK_PROLOG_S):
  13411. return int32(_XML_ROLE_ENTITY_NONE)
  13412. case int32(m_XML_TOK_NAME):
  13413. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity7)
  13414. return int32(_XML_ROLE_PARAM_ENTITY_NAME)
  13415. }
  13416. return _common(tls, state, tok)
  13417. }
  13418. func _entity2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13419. switch tok {
  13420. case int32(m_XML_TOK_PROLOG_S):
  13421. return int32(_XML_ROLE_ENTITY_NONE)
  13422. case int32(m_XML_TOK_NAME):
  13423. 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 {
  13424. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity4)
  13425. return int32(_XML_ROLE_ENTITY_NONE)
  13426. }
  13427. 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 {
  13428. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity3)
  13429. return int32(_XML_ROLE_ENTITY_NONE)
  13430. }
  13431. case int32(m_XML_TOK_LITERAL):
  13432. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  13433. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ENTITY_NONE)
  13434. return int32(_XML_ROLE_ENTITY_VALUE)
  13435. }
  13436. return _common(tls, state, tok)
  13437. }
  13438. func _entity3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13439. _ = ptr
  13440. _ = end
  13441. _ = enc
  13442. switch tok {
  13443. case int32(m_XML_TOK_PROLOG_S):
  13444. return int32(_XML_ROLE_ENTITY_NONE)
  13445. case int32(m_XML_TOK_LITERAL):
  13446. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity4)
  13447. return int32(_XML_ROLE_ENTITY_PUBLIC_ID)
  13448. }
  13449. return _common(tls, state, tok)
  13450. }
  13451. func _entity4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13452. _ = ptr
  13453. _ = end
  13454. _ = enc
  13455. switch tok {
  13456. case int32(m_XML_TOK_PROLOG_S):
  13457. return int32(_XML_ROLE_ENTITY_NONE)
  13458. case int32(m_XML_TOK_LITERAL):
  13459. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity5)
  13460. return int32(_XML_ROLE_ENTITY_SYSTEM_ID)
  13461. }
  13462. return _common(tls, state, tok)
  13463. }
  13464. func _entity5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13465. var v1 uintptr
  13466. _ = v1
  13467. switch tok {
  13468. case int32(m_XML_TOK_PROLOG_S):
  13469. return int32(_XML_ROLE_ENTITY_NONE)
  13470. case int32(m_XML_TOK_DECL_CLOSE):
  13471. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  13472. v1 = __ccgo_fp(_internalSubset)
  13473. } else {
  13474. v1 = __ccgo_fp(_externalSubset1)
  13475. }
  13476. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  13477. return int32(_XML_ROLE_ENTITY_COMPLETE)
  13478. case int32(m_XML_TOK_NAME):
  13479. 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 {
  13480. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity6)
  13481. return int32(_XML_ROLE_ENTITY_NONE)
  13482. }
  13483. break
  13484. }
  13485. return _common(tls, state, tok)
  13486. }
  13487. func _entity6(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13488. _ = ptr
  13489. _ = end
  13490. _ = enc
  13491. switch tok {
  13492. case int32(m_XML_TOK_PROLOG_S):
  13493. return int32(_XML_ROLE_ENTITY_NONE)
  13494. case int32(m_XML_TOK_NAME):
  13495. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  13496. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ENTITY_NONE)
  13497. return int32(_XML_ROLE_ENTITY_NOTATION_NAME)
  13498. }
  13499. return _common(tls, state, tok)
  13500. }
  13501. func _entity7(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13502. switch tok {
  13503. case int32(m_XML_TOK_PROLOG_S):
  13504. return int32(_XML_ROLE_ENTITY_NONE)
  13505. case int32(m_XML_TOK_NAME):
  13506. 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 {
  13507. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity9)
  13508. return int32(_XML_ROLE_ENTITY_NONE)
  13509. }
  13510. 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 {
  13511. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity8)
  13512. return int32(_XML_ROLE_ENTITY_NONE)
  13513. }
  13514. case int32(m_XML_TOK_LITERAL):
  13515. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  13516. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ENTITY_NONE)
  13517. return int32(_XML_ROLE_ENTITY_VALUE)
  13518. }
  13519. return _common(tls, state, tok)
  13520. }
  13521. func _entity8(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13522. _ = ptr
  13523. _ = end
  13524. _ = enc
  13525. switch tok {
  13526. case int32(m_XML_TOK_PROLOG_S):
  13527. return int32(_XML_ROLE_ENTITY_NONE)
  13528. case int32(m_XML_TOK_LITERAL):
  13529. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity9)
  13530. return int32(_XML_ROLE_ENTITY_PUBLIC_ID)
  13531. }
  13532. return _common(tls, state, tok)
  13533. }
  13534. func _entity9(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13535. _ = ptr
  13536. _ = end
  13537. _ = enc
  13538. switch tok {
  13539. case int32(m_XML_TOK_PROLOG_S):
  13540. return int32(_XML_ROLE_ENTITY_NONE)
  13541. case int32(m_XML_TOK_LITERAL):
  13542. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity10)
  13543. return int32(_XML_ROLE_ENTITY_SYSTEM_ID)
  13544. }
  13545. return _common(tls, state, tok)
  13546. }
  13547. func _entity10(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13548. var v1 uintptr
  13549. _ = v1
  13550. _ = ptr
  13551. _ = end
  13552. _ = enc
  13553. switch tok {
  13554. case int32(m_XML_TOK_PROLOG_S):
  13555. return int32(_XML_ROLE_ENTITY_NONE)
  13556. case int32(m_XML_TOK_DECL_CLOSE):
  13557. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  13558. v1 = __ccgo_fp(_internalSubset)
  13559. } else {
  13560. v1 = __ccgo_fp(_externalSubset1)
  13561. }
  13562. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  13563. return int32(_XML_ROLE_ENTITY_COMPLETE)
  13564. }
  13565. return _common(tls, state, tok)
  13566. }
  13567. func _notation0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13568. _ = ptr
  13569. _ = end
  13570. _ = enc
  13571. switch tok {
  13572. case int32(m_XML_TOK_PROLOG_S):
  13573. return int32(_XML_ROLE_NOTATION_NONE)
  13574. case int32(m_XML_TOK_NAME):
  13575. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation1)
  13576. return int32(_XML_ROLE_NOTATION_NAME)
  13577. }
  13578. return _common(tls, state, tok)
  13579. }
  13580. func _notation1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13581. switch tok {
  13582. case int32(m_XML_TOK_PROLOG_S):
  13583. return int32(_XML_ROLE_NOTATION_NONE)
  13584. case int32(m_XML_TOK_NAME):
  13585. 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 {
  13586. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation3)
  13587. return int32(_XML_ROLE_NOTATION_NONE)
  13588. }
  13589. 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 {
  13590. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation2)
  13591. return int32(_XML_ROLE_NOTATION_NONE)
  13592. }
  13593. break
  13594. }
  13595. return _common(tls, state, tok)
  13596. }
  13597. func _notation2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13598. _ = ptr
  13599. _ = end
  13600. _ = enc
  13601. switch tok {
  13602. case int32(m_XML_TOK_PROLOG_S):
  13603. return int32(_XML_ROLE_NOTATION_NONE)
  13604. case int32(m_XML_TOK_LITERAL):
  13605. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation4)
  13606. return int32(_XML_ROLE_NOTATION_PUBLIC_ID)
  13607. }
  13608. return _common(tls, state, tok)
  13609. }
  13610. func _notation3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13611. _ = ptr
  13612. _ = end
  13613. _ = enc
  13614. switch tok {
  13615. case int32(m_XML_TOK_PROLOG_S):
  13616. return int32(_XML_ROLE_NOTATION_NONE)
  13617. case int32(m_XML_TOK_LITERAL):
  13618. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  13619. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_NOTATION_NONE)
  13620. return int32(_XML_ROLE_NOTATION_SYSTEM_ID)
  13621. }
  13622. return _common(tls, state, tok)
  13623. }
  13624. func _notation4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13625. var v1 uintptr
  13626. _ = v1
  13627. _ = ptr
  13628. _ = end
  13629. _ = enc
  13630. switch tok {
  13631. case int32(m_XML_TOK_PROLOG_S):
  13632. return int32(_XML_ROLE_NOTATION_NONE)
  13633. case int32(m_XML_TOK_LITERAL):
  13634. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  13635. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_NOTATION_NONE)
  13636. return int32(_XML_ROLE_NOTATION_SYSTEM_ID)
  13637. case int32(m_XML_TOK_DECL_CLOSE):
  13638. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  13639. v1 = __ccgo_fp(_internalSubset)
  13640. } else {
  13641. v1 = __ccgo_fp(_externalSubset1)
  13642. }
  13643. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  13644. return int32(_XML_ROLE_NOTATION_NO_SYSTEM_ID)
  13645. }
  13646. return _common(tls, state, tok)
  13647. }
  13648. func _attlist0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13649. _ = ptr
  13650. _ = end
  13651. _ = enc
  13652. switch tok {
  13653. case int32(m_XML_TOK_PROLOG_S):
  13654. return int32(_XML_ROLE_ATTLIST_NONE)
  13655. case int32(m_XML_TOK_NAME):
  13656. fallthrough
  13657. case int32(m_XML_TOK_PREFIXED_NAME):
  13658. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  13659. return int32(_XML_ROLE_ATTLIST_ELEMENT_NAME)
  13660. }
  13661. return _common(tls, state, tok)
  13662. }
  13663. func _attlist1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13664. var v1 uintptr
  13665. _ = v1
  13666. _ = ptr
  13667. _ = end
  13668. _ = enc
  13669. switch tok {
  13670. case int32(m_XML_TOK_PROLOG_S):
  13671. return int32(_XML_ROLE_ATTLIST_NONE)
  13672. case int32(m_XML_TOK_DECL_CLOSE):
  13673. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  13674. v1 = __ccgo_fp(_internalSubset)
  13675. } else {
  13676. v1 = __ccgo_fp(_externalSubset1)
  13677. }
  13678. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  13679. return int32(_XML_ROLE_ATTLIST_NONE)
  13680. case int32(m_XML_TOK_NAME):
  13681. fallthrough
  13682. case int32(m_XML_TOK_PREFIXED_NAME):
  13683. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist2)
  13684. return int32(_XML_ROLE_ATTRIBUTE_NAME)
  13685. }
  13686. return _common(tls, state, tok)
  13687. }
  13688. func _attlist2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13689. var i int32
  13690. _ = i
  13691. switch tok {
  13692. case int32(m_XML_TOK_PROLOG_S):
  13693. return int32(_XML_ROLE_ATTLIST_NONE)
  13694. case int32(m_XML_TOK_NAME):
  13695. i = 0
  13696. for {
  13697. if !(i < libc.Int32FromUint64(libc.Uint64FromInt64(64)/libc.Uint64FromInt64(8))) {
  13698. break
  13699. }
  13700. 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 {
  13701. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist8)
  13702. return int32(_XML_ROLE_ATTRIBUTE_TYPE_CDATA) + i
  13703. }
  13704. goto _1
  13705. _1:
  13706. ;
  13707. i++
  13708. }
  13709. 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 {
  13710. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist5)
  13711. return int32(_XML_ROLE_ATTLIST_NONE)
  13712. }
  13713. case int32(m_XML_TOK_OPEN_PAREN):
  13714. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist3)
  13715. return int32(_XML_ROLE_ATTLIST_NONE)
  13716. }
  13717. return _common(tls, state, tok)
  13718. }
  13719. var _types = [8]uintptr{
  13720. 0: uintptr(unsafe.Pointer(&_KW_CDATA)),
  13721. 1: uintptr(unsafe.Pointer(&_KW_ID)),
  13722. 2: uintptr(unsafe.Pointer(&_KW_IDREF)),
  13723. 3: uintptr(unsafe.Pointer(&_KW_IDREFS)),
  13724. 4: uintptr(unsafe.Pointer(&_KW_ENTITY)),
  13725. 5: uintptr(unsafe.Pointer(&_KW_ENTITIES)),
  13726. 6: uintptr(unsafe.Pointer(&_KW_NMTOKEN)),
  13727. 7: uintptr(unsafe.Pointer(&_KW_NMTOKENS)),
  13728. }
  13729. func _attlist3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13730. _ = ptr
  13731. _ = end
  13732. _ = enc
  13733. switch tok {
  13734. case int32(m_XML_TOK_PROLOG_S):
  13735. return int32(_XML_ROLE_ATTLIST_NONE)
  13736. case int32(m_XML_TOK_NMTOKEN):
  13737. fallthrough
  13738. case int32(m_XML_TOK_NAME):
  13739. fallthrough
  13740. case int32(m_XML_TOK_PREFIXED_NAME):
  13741. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist4)
  13742. return int32(_XML_ROLE_ATTRIBUTE_ENUM_VALUE)
  13743. }
  13744. return _common(tls, state, tok)
  13745. }
  13746. func _attlist4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13747. _ = ptr
  13748. _ = end
  13749. _ = enc
  13750. switch tok {
  13751. case int32(m_XML_TOK_PROLOG_S):
  13752. return int32(_XML_ROLE_ATTLIST_NONE)
  13753. case int32(m_XML_TOK_CLOSE_PAREN):
  13754. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist8)
  13755. return int32(_XML_ROLE_ATTLIST_NONE)
  13756. case int32(m_XML_TOK_OR):
  13757. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist3)
  13758. return int32(_XML_ROLE_ATTLIST_NONE)
  13759. }
  13760. return _common(tls, state, tok)
  13761. }
  13762. func _attlist5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13763. _ = ptr
  13764. _ = end
  13765. _ = enc
  13766. switch tok {
  13767. case int32(m_XML_TOK_PROLOG_S):
  13768. return int32(_XML_ROLE_ATTLIST_NONE)
  13769. case int32(m_XML_TOK_OPEN_PAREN):
  13770. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist6)
  13771. return int32(_XML_ROLE_ATTLIST_NONE)
  13772. }
  13773. return _common(tls, state, tok)
  13774. }
  13775. func _attlist6(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13776. _ = ptr
  13777. _ = end
  13778. _ = enc
  13779. switch tok {
  13780. case int32(m_XML_TOK_PROLOG_S):
  13781. return int32(_XML_ROLE_ATTLIST_NONE)
  13782. case int32(m_XML_TOK_NAME):
  13783. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist7)
  13784. return int32(_XML_ROLE_ATTRIBUTE_NOTATION_VALUE)
  13785. }
  13786. return _common(tls, state, tok)
  13787. }
  13788. func _attlist7(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13789. _ = ptr
  13790. _ = end
  13791. _ = enc
  13792. switch tok {
  13793. case int32(m_XML_TOK_PROLOG_S):
  13794. return int32(_XML_ROLE_ATTLIST_NONE)
  13795. case int32(m_XML_TOK_CLOSE_PAREN):
  13796. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist8)
  13797. return int32(_XML_ROLE_ATTLIST_NONE)
  13798. case int32(m_XML_TOK_OR):
  13799. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist6)
  13800. return int32(_XML_ROLE_ATTLIST_NONE)
  13801. }
  13802. return _common(tls, state, tok)
  13803. }
  13804. // C documentation
  13805. //
  13806. // /* default value */
  13807. func _attlist8(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13808. switch tok {
  13809. case int32(m_XML_TOK_PROLOG_S):
  13810. return int32(_XML_ROLE_ATTLIST_NONE)
  13811. case int32(m_XML_TOK_POUND_NAME):
  13812. 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 {
  13813. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  13814. return int32(_XML_ROLE_IMPLIED_ATTRIBUTE_VALUE)
  13815. }
  13816. 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 {
  13817. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  13818. return int32(_XML_ROLE_REQUIRED_ATTRIBUTE_VALUE)
  13819. }
  13820. 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 {
  13821. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist9)
  13822. return int32(_XML_ROLE_ATTLIST_NONE)
  13823. }
  13824. case int32(m_XML_TOK_LITERAL):
  13825. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  13826. return int32(_XML_ROLE_DEFAULT_ATTRIBUTE_VALUE)
  13827. }
  13828. return _common(tls, state, tok)
  13829. }
  13830. func _attlist9(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13831. _ = ptr
  13832. _ = end
  13833. _ = enc
  13834. switch tok {
  13835. case int32(m_XML_TOK_PROLOG_S):
  13836. return int32(_XML_ROLE_ATTLIST_NONE)
  13837. case int32(m_XML_TOK_LITERAL):
  13838. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  13839. return int32(_XML_ROLE_FIXED_ATTRIBUTE_VALUE)
  13840. }
  13841. return _common(tls, state, tok)
  13842. }
  13843. func _element0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13844. _ = ptr
  13845. _ = end
  13846. _ = enc
  13847. switch tok {
  13848. case int32(m_XML_TOK_PROLOG_S):
  13849. return int32(_XML_ROLE_ELEMENT_NONE)
  13850. case int32(m_XML_TOK_NAME):
  13851. fallthrough
  13852. case int32(m_XML_TOK_PREFIXED_NAME):
  13853. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element1)
  13854. return int32(_XML_ROLE_ELEMENT_NAME)
  13855. }
  13856. return _common(tls, state, tok)
  13857. }
  13858. func _element1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13859. switch tok {
  13860. case int32(m_XML_TOK_PROLOG_S):
  13861. return int32(_XML_ROLE_ELEMENT_NONE)
  13862. case int32(m_XML_TOK_NAME):
  13863. 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 {
  13864. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  13865. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  13866. return int32(_XML_ROLE_CONTENT_EMPTY)
  13867. }
  13868. 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 {
  13869. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  13870. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  13871. return int32(_XML_ROLE_CONTENT_ANY)
  13872. }
  13873. case int32(m_XML_TOK_OPEN_PAREN):
  13874. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element2)
  13875. (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel = uint32(1)
  13876. return int32(_XML_ROLE_GROUP_OPEN)
  13877. }
  13878. return _common(tls, state, tok)
  13879. }
  13880. func _element2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13881. switch tok {
  13882. case int32(m_XML_TOK_PROLOG_S):
  13883. return int32(_XML_ROLE_ELEMENT_NONE)
  13884. case int32(m_XML_TOK_POUND_NAME):
  13885. 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 {
  13886. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element3)
  13887. return int32(_XML_ROLE_CONTENT_PCDATA)
  13888. }
  13889. case int32(m_XML_TOK_OPEN_PAREN):
  13890. (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel = uint32(2)
  13891. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element6)
  13892. return int32(_XML_ROLE_GROUP_OPEN)
  13893. case int32(m_XML_TOK_NAME):
  13894. fallthrough
  13895. case int32(m_XML_TOK_PREFIXED_NAME):
  13896. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  13897. return int32(_XML_ROLE_CONTENT_ELEMENT)
  13898. case int32(m_XML_TOK_NAME_QUESTION):
  13899. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  13900. return int32(_XML_ROLE_CONTENT_ELEMENT_OPT)
  13901. case int32(m_XML_TOK_NAME_ASTERISK):
  13902. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  13903. return int32(_XML_ROLE_CONTENT_ELEMENT_REP)
  13904. case int32(m_XML_TOK_NAME_PLUS):
  13905. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  13906. return int32(_XML_ROLE_CONTENT_ELEMENT_PLUS)
  13907. }
  13908. return _common(tls, state, tok)
  13909. }
  13910. func _element3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13911. _ = ptr
  13912. _ = end
  13913. _ = enc
  13914. switch tok {
  13915. case int32(m_XML_TOK_PROLOG_S):
  13916. return int32(_XML_ROLE_ELEMENT_NONE)
  13917. case int32(m_XML_TOK_CLOSE_PAREN):
  13918. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  13919. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  13920. return int32(_XML_ROLE_GROUP_CLOSE)
  13921. case int32(m_XML_TOK_CLOSE_PAREN_ASTERISK):
  13922. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  13923. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  13924. return int32(_XML_ROLE_GROUP_CLOSE_REP)
  13925. case int32(m_XML_TOK_OR):
  13926. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element4)
  13927. return int32(_XML_ROLE_ELEMENT_NONE)
  13928. }
  13929. return _common(tls, state, tok)
  13930. }
  13931. func _element4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13932. _ = ptr
  13933. _ = end
  13934. _ = enc
  13935. switch tok {
  13936. case int32(m_XML_TOK_PROLOG_S):
  13937. return int32(_XML_ROLE_ELEMENT_NONE)
  13938. case int32(m_XML_TOK_NAME):
  13939. fallthrough
  13940. case int32(m_XML_TOK_PREFIXED_NAME):
  13941. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element5)
  13942. return int32(_XML_ROLE_CONTENT_ELEMENT)
  13943. }
  13944. return _common(tls, state, tok)
  13945. }
  13946. func _element5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13947. _ = ptr
  13948. _ = end
  13949. _ = enc
  13950. switch tok {
  13951. case int32(m_XML_TOK_PROLOG_S):
  13952. return int32(_XML_ROLE_ELEMENT_NONE)
  13953. case int32(m_XML_TOK_CLOSE_PAREN_ASTERISK):
  13954. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  13955. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  13956. return int32(_XML_ROLE_GROUP_CLOSE_REP)
  13957. case int32(m_XML_TOK_OR):
  13958. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element4)
  13959. return int32(_XML_ROLE_ELEMENT_NONE)
  13960. }
  13961. return _common(tls, state, tok)
  13962. }
  13963. func _element6(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13964. _ = ptr
  13965. _ = end
  13966. _ = enc
  13967. switch tok {
  13968. case int32(m_XML_TOK_PROLOG_S):
  13969. return int32(_XML_ROLE_ELEMENT_NONE)
  13970. case int32(m_XML_TOK_OPEN_PAREN):
  13971. *(*uint32)(unsafe.Pointer(state + 8)) += uint32(1)
  13972. return int32(_XML_ROLE_GROUP_OPEN)
  13973. case int32(m_XML_TOK_NAME):
  13974. fallthrough
  13975. case int32(m_XML_TOK_PREFIXED_NAME):
  13976. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  13977. return int32(_XML_ROLE_CONTENT_ELEMENT)
  13978. case int32(m_XML_TOK_NAME_QUESTION):
  13979. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  13980. return int32(_XML_ROLE_CONTENT_ELEMENT_OPT)
  13981. case int32(m_XML_TOK_NAME_ASTERISK):
  13982. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  13983. return int32(_XML_ROLE_CONTENT_ELEMENT_REP)
  13984. case int32(m_XML_TOK_NAME_PLUS):
  13985. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  13986. return int32(_XML_ROLE_CONTENT_ELEMENT_PLUS)
  13987. }
  13988. return _common(tls, state, tok)
  13989. }
  13990. func _element7(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  13991. _ = ptr
  13992. _ = end
  13993. _ = enc
  13994. switch tok {
  13995. case int32(m_XML_TOK_PROLOG_S):
  13996. return int32(_XML_ROLE_ELEMENT_NONE)
  13997. case int32(m_XML_TOK_CLOSE_PAREN):
  13998. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  13999. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  14000. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  14001. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  14002. }
  14003. return int32(_XML_ROLE_GROUP_CLOSE)
  14004. case int32(m_XML_TOK_CLOSE_PAREN_ASTERISK):
  14005. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  14006. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  14007. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  14008. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  14009. }
  14010. return int32(_XML_ROLE_GROUP_CLOSE_REP)
  14011. case int32(m_XML_TOK_CLOSE_PAREN_QUESTION):
  14012. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  14013. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  14014. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  14015. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  14016. }
  14017. return int32(_XML_ROLE_GROUP_CLOSE_OPT)
  14018. case int32(m_XML_TOK_CLOSE_PAREN_PLUS):
  14019. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  14020. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  14021. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  14022. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  14023. }
  14024. return int32(_XML_ROLE_GROUP_CLOSE_PLUS)
  14025. case int32(m_XML_TOK_COMMA):
  14026. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element6)
  14027. return int32(_XML_ROLE_GROUP_SEQUENCE)
  14028. case int32(m_XML_TOK_OR):
  14029. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element6)
  14030. return int32(_XML_ROLE_GROUP_CHOICE)
  14031. }
  14032. return _common(tls, state, tok)
  14033. }
  14034. func _condSect0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  14035. switch tok {
  14036. case int32(m_XML_TOK_PROLOG_S):
  14037. return int32(_XML_ROLE_NONE)
  14038. case int32(m_XML_TOK_NAME):
  14039. 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 {
  14040. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_condSect1)
  14041. return int32(_XML_ROLE_NONE)
  14042. }
  14043. 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 {
  14044. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_condSect2)
  14045. return int32(_XML_ROLE_NONE)
  14046. }
  14047. break
  14048. }
  14049. return _common(tls, state, tok)
  14050. }
  14051. func _condSect1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  14052. _ = ptr
  14053. _ = end
  14054. _ = enc
  14055. switch tok {
  14056. case int32(m_XML_TOK_PROLOG_S):
  14057. return int32(_XML_ROLE_NONE)
  14058. case int32(m_XML_TOK_OPEN_BRACKET):
  14059. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset1)
  14060. *(*uint32)(unsafe.Pointer(state + 16)) += uint32(1)
  14061. return int32(_XML_ROLE_NONE)
  14062. }
  14063. return _common(tls, state, tok)
  14064. }
  14065. func _condSect2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  14066. _ = ptr
  14067. _ = end
  14068. _ = enc
  14069. switch tok {
  14070. case int32(m_XML_TOK_PROLOG_S):
  14071. return int32(_XML_ROLE_NONE)
  14072. case int32(m_XML_TOK_OPEN_BRACKET):
  14073. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset1)
  14074. return int32(_XML_ROLE_IGNORE_SECT)
  14075. }
  14076. return _common(tls, state, tok)
  14077. }
  14078. func _declClose(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  14079. var v1 uintptr
  14080. _ = v1
  14081. _ = ptr
  14082. _ = end
  14083. _ = enc
  14084. switch tok {
  14085. case int32(m_XML_TOK_PROLOG_S):
  14086. return (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none
  14087. case int32(m_XML_TOK_DECL_CLOSE):
  14088. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  14089. v1 = __ccgo_fp(_internalSubset)
  14090. } else {
  14091. v1 = __ccgo_fp(_externalSubset1)
  14092. }
  14093. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  14094. return (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none
  14095. }
  14096. return _common(tls, state, tok)
  14097. }
  14098. // C documentation
  14099. //
  14100. // /* This function will only be invoked if the internal logic of the
  14101. // * parser has broken down. It is used in two cases:
  14102. // *
  14103. // * 1: When the XML prolog has been finished. At this point the
  14104. // * processor (the parser level above these role handlers) should
  14105. // * switch from prologProcessor to contentProcessor and reinitialise
  14106. // * the handler function.
  14107. // *
  14108. // * 2: When an error has been detected (via common() below). At this
  14109. // * point again the processor should be switched to errorProcessor,
  14110. // * which will never call a handler.
  14111. // *
  14112. // * The result of this is that error() can only be called if the
  14113. // * processor switch failed to happen, which is an internal error and
  14114. // * therefore we shouldn't be able to provoke it simply by using the
  14115. // * library. It is a necessary backstop, however, so we merely exclude
  14116. // * it from the coverage statistics.
  14117. // *
  14118. // * LCOV_EXCL_START
  14119. // */
  14120. func _error(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  14121. _ = state
  14122. _ = tok
  14123. _ = ptr
  14124. _ = end
  14125. _ = enc
  14126. return int32(_XML_ROLE_NONE)
  14127. }
  14128. /* LCOV_EXCL_STOP */
  14129. func _common(tls *libc.TLS, state uintptr, tok int32) (r int32) {
  14130. if !((*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0) && tok == int32(m_XML_TOK_PARAM_ENTITY_REF) {
  14131. return int32(_XML_ROLE_INNER_PARAM_ENTITY_REF)
  14132. }
  14133. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  14134. return int32(_XML_ROLE_ERROR)
  14135. }
  14136. func XXmlPrologStateInit(tls *libc.TLS, state uintptr) {
  14137. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog0)
  14138. (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity = int32(1)
  14139. (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel = uint32(0)
  14140. (*TPROLOG_STATE)(unsafe.Pointer(state)).FinEntityValue = 0
  14141. }
  14142. func XXmlPrologStateInitExternalEntity(tls *libc.TLS, state uintptr) {
  14143. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset0)
  14144. (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity = 0
  14145. (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel = uint32(0)
  14146. }
  14147. const m_ASCII_02 = 48
  14148. const m_ASCII_12 = 49
  14149. const m_ASCII_22 = 50
  14150. const m_ASCII_32 = 51
  14151. const m_ASCII_41 = 52
  14152. const m_ASCII_51 = 53
  14153. const m_ASCII_61 = 54
  14154. const m_ASCII_71 = 55
  14155. const m_ASCII_82 = 56
  14156. const m_ASCII_92 = 57
  14157. const m_ASCII_AMP1 = 38
  14158. const m_ASCII_APOS1 = 39
  14159. const m_ASCII_COLON2 = 58
  14160. const m_ASCII_EQUALS2 = 61
  14161. const m_ASCII_EXCL2 = 33
  14162. const m_ASCII_G2 = 0x47
  14163. const m_ASCII_GT1 = 62
  14164. const m_ASCII_K1 = 0x4B
  14165. const m_ASCII_LSQB1 = 91
  14166. const m_ASCII_LT1 = 60
  14167. const m_ASCII_MINUS1 = 45
  14168. const m_ASCII_N1 = 0x4E
  14169. const m_ASCII_P2 = 0x50
  14170. const m_ASCII_PERIOD2 = 46
  14171. const m_ASCII_Q2 = 0x51
  14172. const m_ASCII_QUOT1 = 34
  14173. const m_ASCII_R1 = 0x52
  14174. const m_ASCII_RSQB1 = 93
  14175. const m_ASCII_SEMI1 = 59
  14176. const m_ASCII_SPACE1 = 32
  14177. const m_ASCII_TAB1 = 9
  14178. const m_ASCII_UNDERSCORE1 = 95
  14179. const m_ASCII_Y1 = 0x59
  14180. const m_ASCII_Z1 = 90
  14181. const m_ASCII_a2 = 97
  14182. const m_ASCII_b1 = 98
  14183. const m_ASCII_c2 = 99
  14184. const m_ASCII_d1 = 100
  14185. const m_ASCII_e2 = 101
  14186. const m_ASCII_f1 = 102
  14187. const m_ASCII_g2 = 103
  14188. const m_ASCII_i1 = 105
  14189. const m_ASCII_l2 = 108
  14190. const m_ASCII_m2 = 109
  14191. const m_ASCII_n2 = 110
  14192. const m_ASCII_o2 = 111
  14193. const m_ASCII_p2 = 112
  14194. const m_ASCII_q1 = 113
  14195. const m_ASCII_r2 = 114
  14196. const m_ASCII_s2 = 115
  14197. const m_ASCII_t2 = 116
  14198. const m_ASCII_u1 = 117
  14199. const m_ASCII_v1 = 118
  14200. const m_ASCII_x2 = 120
  14201. const m_ASCII_y1 = 121
  14202. const m_ASCII_z1 = 122
  14203. const m_ENCODING_MAX = 128
  14204. const m___bool_true_false_are_defined = 1
  14205. const m_bool = "_Bool"
  14206. const m_false = 0
  14207. const m_true = 1
  14208. const m_utf8_isName4 = "isNever"
  14209. const m_utf8_isNmstrt4 = "isNever"
  14210. var _namingBitmap = [320]uint32{
  14211. 8: uint32(0xFFFFFFFF),
  14212. 9: uint32(0xFFFFFFFF),
  14213. 10: uint32(0xFFFFFFFF),
  14214. 11: uint32(0xFFFFFFFF),
  14215. 12: uint32(0xFFFFFFFF),
  14216. 13: uint32(0xFFFFFFFF),
  14217. 14: uint32(0xFFFFFFFF),
  14218. 15: uint32(0xFFFFFFFF),
  14219. 17: uint32(0x04000000),
  14220. 18: uint32(0x87FFFFFE),
  14221. 19: uint32(0x07FFFFFE),
  14222. 22: uint32(0xFF7FFFFF),
  14223. 23: uint32(0xFF7FFFFF),
  14224. 24: uint32(0xFFFFFFFF),
  14225. 25: uint32(0x7FF3FFFF),
  14226. 26: uint32(0xFFFFFDFE),
  14227. 27: uint32(0x7FFFFFFF),
  14228. 28: uint32(0xFFFFFFFF),
  14229. 29: uint32(0xFFFFFFFF),
  14230. 30: uint32(0xFFFFE00F),
  14231. 31: uint32(0xFC31FFFF),
  14232. 32: uint32(0x00FFFFFF),
  14233. 34: uint32(0xFFFF0000),
  14234. 35: uint32(0xFFFFFFFF),
  14235. 36: uint32(0xFFFFFFFF),
  14236. 37: uint32(0xF80001FF),
  14237. 38: uint32(0x00000003),
  14238. 44: uint32(0xFFFFD740),
  14239. 45: uint32(0xFFFFFFFB),
  14240. 46: uint32(0x547F7FFF),
  14241. 47: uint32(0x000FFFFD),
  14242. 48: uint32(0xFFFFDFFE),
  14243. 49: uint32(0xFFFFFFFF),
  14244. 50: uint32(0xDFFEFFFF),
  14245. 51: uint32(0xFFFFFFFF),
  14246. 52: uint32(0xFFFF0003),
  14247. 53: uint32(0xFFFFFFFF),
  14248. 54: uint32(0xFFFF199F),
  14249. 55: uint32(0x033FCFFF),
  14250. 57: uint32(0xFFFE0000),
  14251. 58: uint32(0x027FFFFF),
  14252. 59: uint32(0xFFFFFFFE),
  14253. 60: uint32(0x0000007F),
  14254. 62: uint32(0xFFFF0000),
  14255. 63: uint32(0x000707FF),
  14256. 65: uint32(0x07FFFFFE),
  14257. 66: uint32(0x000007FE),
  14258. 67: uint32(0xFFFE0000),
  14259. 68: uint32(0xFFFFFFFF),
  14260. 69: uint32(0x7CFFFFFF),
  14261. 70: uint32(0x002F7FFF),
  14262. 71: uint32(0x00000060),
  14263. 72: uint32(0xFFFFFFE0),
  14264. 73: uint32(0x23FFFFFF),
  14265. 74: uint32(0xFF000000),
  14266. 75: uint32(0x00000003),
  14267. 76: uint32(0xFFF99FE0),
  14268. 77: uint32(0x03C5FDFF),
  14269. 78: uint32(0xB0000000),
  14270. 79: uint32(0x00030003),
  14271. 80: uint32(0xFFF987E0),
  14272. 81: uint32(0x036DFDFF),
  14273. 82: uint32(0x5E000000),
  14274. 83: uint32(0x001C0000),
  14275. 84: uint32(0xFFFBAFE0),
  14276. 85: uint32(0x23EDFDFF),
  14277. 87: uint32(0x00000001),
  14278. 88: uint32(0xFFF99FE0),
  14279. 89: uint32(0x23CDFDFF),
  14280. 90: uint32(0xB0000000),
  14281. 91: uint32(0x00000003),
  14282. 92: uint32(0xD63DC7E0),
  14283. 93: uint32(0x03BFC718),
  14284. 96: uint32(0xFFFDDFE0),
  14285. 97: uint32(0x03EFFDFF),
  14286. 99: uint32(0x00000003),
  14287. 100: uint32(0xFFFDDFE0),
  14288. 101: uint32(0x03EFFDFF),
  14289. 102: uint32(0x40000000),
  14290. 103: uint32(0x00000003),
  14291. 104: uint32(0xFFFDDFE0),
  14292. 105: uint32(0x03FFFDFF),
  14293. 107: uint32(0x00000003),
  14294. 112: uint32(0xFFFFFFFE),
  14295. 113: uint32(0x000D7FFF),
  14296. 114: uint32(0x0000003F),
  14297. 116: uint32(0xFEF02596),
  14298. 117: uint32(0x200D6CAE),
  14299. 118: uint32(0x0000001F),
  14300. 122: uint32(0xFFFFFEFF),
  14301. 123: uint32(0x000003FF),
  14302. 133: uint32(0xFFFFFFFF),
  14303. 134: uint32(0xFFFF003F),
  14304. 135: uint32(0x007FFFFF),
  14305. 136: uint32(0x0007DAED),
  14306. 137: uint32(0x50000000),
  14307. 138: uint32(0x82315001),
  14308. 139: uint32(0x002C62AB),
  14309. 140: uint32(0x40000000),
  14310. 141: uint32(0xF580C900),
  14311. 142: uint32(0x00000007),
  14312. 143: uint32(0x02010800),
  14313. 144: uint32(0xFFFFFFFF),
  14314. 145: uint32(0xFFFFFFFF),
  14315. 146: uint32(0xFFFFFFFF),
  14316. 147: uint32(0xFFFFFFFF),
  14317. 148: uint32(0x0FFFFFFF),
  14318. 149: uint32(0xFFFFFFFF),
  14319. 150: uint32(0xFFFFFFFF),
  14320. 151: uint32(0x03FFFFFF),
  14321. 152: uint32(0x3F3FFFFF),
  14322. 153: uint32(0xFFFFFFFF),
  14323. 154: uint32(0xAAFF3F3F),
  14324. 155: uint32(0x3FFFFFFF),
  14325. 156: uint32(0xFFFFFFFF),
  14326. 157: uint32(0x5FDFFFFF),
  14327. 158: uint32(0x0FCF1FDC),
  14328. 159: uint32(0x1FDC1FFF),
  14329. 161: uint32(0x00004C40),
  14330. 164: uint32(0x00000007),
  14331. 168: uint32(0x00000080),
  14332. 169: uint32(0x000003FE),
  14333. 170: uint32(0xFFFFFFFE),
  14334. 171: uint32(0xFFFFFFFF),
  14335. 172: uint32(0x001FFFFF),
  14336. 173: uint32(0xFFFFFFFE),
  14337. 174: uint32(0xFFFFFFFF),
  14338. 175: uint32(0x07FFFFFF),
  14339. 176: uint32(0xFFFFFFE0),
  14340. 177: uint32(0x00001FFF),
  14341. 184: uint32(0xFFFFFFFF),
  14342. 185: uint32(0xFFFFFFFF),
  14343. 186: uint32(0xFFFFFFFF),
  14344. 187: uint32(0xFFFFFFFF),
  14345. 188: uint32(0xFFFFFFFF),
  14346. 189: uint32(0x0000003F),
  14347. 192: uint32(0xFFFFFFFF),
  14348. 193: uint32(0xFFFFFFFF),
  14349. 194: uint32(0xFFFFFFFF),
  14350. 195: uint32(0xFFFFFFFF),
  14351. 196: uint32(0xFFFFFFFF),
  14352. 197: uint32(0x0000000F),
  14353. 201: uint32(0x07FF6000),
  14354. 202: uint32(0x87FFFFFE),
  14355. 203: uint32(0x07FFFFFE),
  14356. 205: uint32(0x00800000),
  14357. 206: uint32(0xFF7FFFFF),
  14358. 207: uint32(0xFF7FFFFF),
  14359. 208: uint32(0x00FFFFFF),
  14360. 210: uint32(0xFFFF0000),
  14361. 211: uint32(0xFFFFFFFF),
  14362. 212: uint32(0xFFFFFFFF),
  14363. 213: uint32(0xF80001FF),
  14364. 214: uint32(0x00030003),
  14365. 216: uint32(0xFFFFFFFF),
  14366. 217: uint32(0xFFFFFFFF),
  14367. 218: uint32(0x0000003F),
  14368. 219: uint32(0x00000003),
  14369. 220: uint32(0xFFFFD7C0),
  14370. 221: uint32(0xFFFFFFFB),
  14371. 222: uint32(0x547F7FFF),
  14372. 223: uint32(0x000FFFFD),
  14373. 224: uint32(0xFFFFDFFE),
  14374. 225: uint32(0xFFFFFFFF),
  14375. 226: uint32(0xDFFEFFFF),
  14376. 227: uint32(0xFFFFFFFF),
  14377. 228: uint32(0xFFFF007B),
  14378. 229: uint32(0xFFFFFFFF),
  14379. 230: uint32(0xFFFF199F),
  14380. 231: uint32(0x033FCFFF),
  14381. 233: uint32(0xFFFE0000),
  14382. 234: uint32(0x027FFFFF),
  14383. 235: uint32(0xFFFFFFFE),
  14384. 236: uint32(0xFFFE007F),
  14385. 237: uint32(0xBBFFFFFB),
  14386. 238: uint32(0xFFFF0016),
  14387. 239: uint32(0x000707FF),
  14388. 241: uint32(0x07FFFFFE),
  14389. 242: uint32(0x0007FFFF),
  14390. 243: uint32(0xFFFF03FF),
  14391. 244: uint32(0xFFFFFFFF),
  14392. 245: uint32(0x7CFFFFFF),
  14393. 246: uint32(0xFFEF7FFF),
  14394. 247: uint32(0x03FF3DFF),
  14395. 248: uint32(0xFFFFFFEE),
  14396. 249: uint32(0xF3FFFFFF),
  14397. 250: uint32(0xFF1E3FFF),
  14398. 251: uint32(0x0000FFCF),
  14399. 252: uint32(0xFFF99FEE),
  14400. 253: uint32(0xD3C5FDFF),
  14401. 254: uint32(0xB080399F),
  14402. 255: uint32(0x0003FFCF),
  14403. 256: uint32(0xFFF987E4),
  14404. 257: uint32(0xD36DFDFF),
  14405. 258: uint32(0x5E003987),
  14406. 259: uint32(0x001FFFC0),
  14407. 260: uint32(0xFFFBAFEE),
  14408. 261: uint32(0xF3EDFDFF),
  14409. 262: uint32(0x00003BBF),
  14410. 263: uint32(0x0000FFC1),
  14411. 264: uint32(0xFFF99FEE),
  14412. 265: uint32(0xF3CDFDFF),
  14413. 266: uint32(0xB0C0398F),
  14414. 267: uint32(0x0000FFC3),
  14415. 268: uint32(0xD63DC7EC),
  14416. 269: uint32(0xC3BFC718),
  14417. 270: uint32(0x00803DC7),
  14418. 271: uint32(0x0000FF80),
  14419. 272: uint32(0xFFFDDFEE),
  14420. 273: uint32(0xC3EFFDFF),
  14421. 274: uint32(0x00603DDF),
  14422. 275: uint32(0x0000FFC3),
  14423. 276: uint32(0xFFFDDFEC),
  14424. 277: uint32(0xC3EFFDFF),
  14425. 278: uint32(0x40603DDF),
  14426. 279: uint32(0x0000FFC3),
  14427. 280: uint32(0xFFFDDFEC),
  14428. 281: uint32(0xC3FFFDFF),
  14429. 282: uint32(0x00803DCF),
  14430. 283: uint32(0x0000FFC3),
  14431. 288: uint32(0xFFFFFFFE),
  14432. 289: uint32(0x07FF7FFF),
  14433. 290: uint32(0x03FF7FFF),
  14434. 292: uint32(0xFEF02596),
  14435. 293: uint32(0x3BFF6CAE),
  14436. 294: uint32(0x03FF3F5F),
  14437. 296: uint32(0x03000000),
  14438. 297: uint32(0xC2A003FF),
  14439. 298: uint32(0xFFFFFEFF),
  14440. 299: uint32(0xFFFE03FF),
  14441. 300: uint32(0xFEBF0FDF),
  14442. 301: uint32(0x02FE3FFF),
  14443. 310: uint32(0x1FFF0000),
  14444. 311: uint32(0x00000002),
  14445. 312: uint32(0x000000A0),
  14446. 313: uint32(0x003EFFFE),
  14447. 314: uint32(0xFFFFFFFE),
  14448. 315: uint32(0xFFFFFFFF),
  14449. 316: uint32(0x661FFFFF),
  14450. 317: uint32(0xFFFFFFFE),
  14451. 318: uint32(0xFFFFFFFF),
  14452. 319: uint32(0x77FFFFFF),
  14453. }
  14454. var _nmstrtPages = [256]uint8{
  14455. 0: uint8(0x02),
  14456. 1: uint8(0x03),
  14457. 2: uint8(0x04),
  14458. 3: uint8(0x05),
  14459. 4: uint8(0x06),
  14460. 5: uint8(0x07),
  14461. 6: uint8(0x08),
  14462. 9: uint8(0x09),
  14463. 10: uint8(0x0A),
  14464. 11: uint8(0x0B),
  14465. 12: uint8(0x0C),
  14466. 13: uint8(0x0D),
  14467. 14: uint8(0x0E),
  14468. 15: uint8(0x0F),
  14469. 16: uint8(0x10),
  14470. 17: uint8(0x11),
  14471. 30: uint8(0x12),
  14472. 31: uint8(0x13),
  14473. 33: uint8(0x14),
  14474. 48: uint8(0x15),
  14475. 49: uint8(0x16),
  14476. 78: uint8(0x01),
  14477. 79: uint8(0x01),
  14478. 80: uint8(0x01),
  14479. 81: uint8(0x01),
  14480. 82: uint8(0x01),
  14481. 83: uint8(0x01),
  14482. 84: uint8(0x01),
  14483. 85: uint8(0x01),
  14484. 86: uint8(0x01),
  14485. 87: uint8(0x01),
  14486. 88: uint8(0x01),
  14487. 89: uint8(0x01),
  14488. 90: uint8(0x01),
  14489. 91: uint8(0x01),
  14490. 92: uint8(0x01),
  14491. 93: uint8(0x01),
  14492. 94: uint8(0x01),
  14493. 95: uint8(0x01),
  14494. 96: uint8(0x01),
  14495. 97: uint8(0x01),
  14496. 98: uint8(0x01),
  14497. 99: uint8(0x01),
  14498. 100: uint8(0x01),
  14499. 101: uint8(0x01),
  14500. 102: uint8(0x01),
  14501. 103: uint8(0x01),
  14502. 104: uint8(0x01),
  14503. 105: uint8(0x01),
  14504. 106: uint8(0x01),
  14505. 107: uint8(0x01),
  14506. 108: uint8(0x01),
  14507. 109: uint8(0x01),
  14508. 110: uint8(0x01),
  14509. 111: uint8(0x01),
  14510. 112: uint8(0x01),
  14511. 113: uint8(0x01),
  14512. 114: uint8(0x01),
  14513. 115: uint8(0x01),
  14514. 116: uint8(0x01),
  14515. 117: uint8(0x01),
  14516. 118: uint8(0x01),
  14517. 119: uint8(0x01),
  14518. 120: uint8(0x01),
  14519. 121: uint8(0x01),
  14520. 122: uint8(0x01),
  14521. 123: uint8(0x01),
  14522. 124: uint8(0x01),
  14523. 125: uint8(0x01),
  14524. 126: uint8(0x01),
  14525. 127: uint8(0x01),
  14526. 128: uint8(0x01),
  14527. 129: uint8(0x01),
  14528. 130: uint8(0x01),
  14529. 131: uint8(0x01),
  14530. 132: uint8(0x01),
  14531. 133: uint8(0x01),
  14532. 134: uint8(0x01),
  14533. 135: uint8(0x01),
  14534. 136: uint8(0x01),
  14535. 137: uint8(0x01),
  14536. 138: uint8(0x01),
  14537. 139: uint8(0x01),
  14538. 140: uint8(0x01),
  14539. 141: uint8(0x01),
  14540. 142: uint8(0x01),
  14541. 143: uint8(0x01),
  14542. 144: uint8(0x01),
  14543. 145: uint8(0x01),
  14544. 146: uint8(0x01),
  14545. 147: uint8(0x01),
  14546. 148: uint8(0x01),
  14547. 149: uint8(0x01),
  14548. 150: uint8(0x01),
  14549. 151: uint8(0x01),
  14550. 152: uint8(0x01),
  14551. 153: uint8(0x01),
  14552. 154: uint8(0x01),
  14553. 155: uint8(0x01),
  14554. 156: uint8(0x01),
  14555. 157: uint8(0x01),
  14556. 158: uint8(0x01),
  14557. 159: uint8(0x17),
  14558. 172: uint8(0x01),
  14559. 173: uint8(0x01),
  14560. 174: uint8(0x01),
  14561. 175: uint8(0x01),
  14562. 176: uint8(0x01),
  14563. 177: uint8(0x01),
  14564. 178: uint8(0x01),
  14565. 179: uint8(0x01),
  14566. 180: uint8(0x01),
  14567. 181: uint8(0x01),
  14568. 182: uint8(0x01),
  14569. 183: uint8(0x01),
  14570. 184: uint8(0x01),
  14571. 185: uint8(0x01),
  14572. 186: uint8(0x01),
  14573. 187: uint8(0x01),
  14574. 188: uint8(0x01),
  14575. 189: uint8(0x01),
  14576. 190: uint8(0x01),
  14577. 191: uint8(0x01),
  14578. 192: uint8(0x01),
  14579. 193: uint8(0x01),
  14580. 194: uint8(0x01),
  14581. 195: uint8(0x01),
  14582. 196: uint8(0x01),
  14583. 197: uint8(0x01),
  14584. 198: uint8(0x01),
  14585. 199: uint8(0x01),
  14586. 200: uint8(0x01),
  14587. 201: uint8(0x01),
  14588. 202: uint8(0x01),
  14589. 203: uint8(0x01),
  14590. 204: uint8(0x01),
  14591. 205: uint8(0x01),
  14592. 206: uint8(0x01),
  14593. 207: uint8(0x01),
  14594. 208: uint8(0x01),
  14595. 209: uint8(0x01),
  14596. 210: uint8(0x01),
  14597. 211: uint8(0x01),
  14598. 212: uint8(0x01),
  14599. 213: uint8(0x01),
  14600. 214: uint8(0x01),
  14601. 215: uint8(0x18),
  14602. }
  14603. var _namePages = [256]uint8{
  14604. 0: uint8(0x19),
  14605. 1: uint8(0x03),
  14606. 2: uint8(0x1A),
  14607. 3: uint8(0x1B),
  14608. 4: uint8(0x1C),
  14609. 5: uint8(0x1D),
  14610. 6: uint8(0x1E),
  14611. 9: uint8(0x1F),
  14612. 10: uint8(0x20),
  14613. 11: uint8(0x21),
  14614. 12: uint8(0x22),
  14615. 13: uint8(0x23),
  14616. 14: uint8(0x24),
  14617. 15: uint8(0x25),
  14618. 16: uint8(0x10),
  14619. 17: uint8(0x11),
  14620. 30: uint8(0x12),
  14621. 31: uint8(0x13),
  14622. 32: uint8(0x26),
  14623. 33: uint8(0x14),
  14624. 48: uint8(0x27),
  14625. 49: uint8(0x16),
  14626. 78: uint8(0x01),
  14627. 79: uint8(0x01),
  14628. 80: uint8(0x01),
  14629. 81: uint8(0x01),
  14630. 82: uint8(0x01),
  14631. 83: uint8(0x01),
  14632. 84: uint8(0x01),
  14633. 85: uint8(0x01),
  14634. 86: uint8(0x01),
  14635. 87: uint8(0x01),
  14636. 88: uint8(0x01),
  14637. 89: uint8(0x01),
  14638. 90: uint8(0x01),
  14639. 91: uint8(0x01),
  14640. 92: uint8(0x01),
  14641. 93: uint8(0x01),
  14642. 94: uint8(0x01),
  14643. 95: uint8(0x01),
  14644. 96: uint8(0x01),
  14645. 97: uint8(0x01),
  14646. 98: uint8(0x01),
  14647. 99: uint8(0x01),
  14648. 100: uint8(0x01),
  14649. 101: uint8(0x01),
  14650. 102: uint8(0x01),
  14651. 103: uint8(0x01),
  14652. 104: uint8(0x01),
  14653. 105: uint8(0x01),
  14654. 106: uint8(0x01),
  14655. 107: uint8(0x01),
  14656. 108: uint8(0x01),
  14657. 109: uint8(0x01),
  14658. 110: uint8(0x01),
  14659. 111: uint8(0x01),
  14660. 112: uint8(0x01),
  14661. 113: uint8(0x01),
  14662. 114: uint8(0x01),
  14663. 115: uint8(0x01),
  14664. 116: uint8(0x01),
  14665. 117: uint8(0x01),
  14666. 118: uint8(0x01),
  14667. 119: uint8(0x01),
  14668. 120: uint8(0x01),
  14669. 121: uint8(0x01),
  14670. 122: uint8(0x01),
  14671. 123: uint8(0x01),
  14672. 124: uint8(0x01),
  14673. 125: uint8(0x01),
  14674. 126: uint8(0x01),
  14675. 127: uint8(0x01),
  14676. 128: uint8(0x01),
  14677. 129: uint8(0x01),
  14678. 130: uint8(0x01),
  14679. 131: uint8(0x01),
  14680. 132: uint8(0x01),
  14681. 133: uint8(0x01),
  14682. 134: uint8(0x01),
  14683. 135: uint8(0x01),
  14684. 136: uint8(0x01),
  14685. 137: uint8(0x01),
  14686. 138: uint8(0x01),
  14687. 139: uint8(0x01),
  14688. 140: uint8(0x01),
  14689. 141: uint8(0x01),
  14690. 142: uint8(0x01),
  14691. 143: uint8(0x01),
  14692. 144: uint8(0x01),
  14693. 145: uint8(0x01),
  14694. 146: uint8(0x01),
  14695. 147: uint8(0x01),
  14696. 148: uint8(0x01),
  14697. 149: uint8(0x01),
  14698. 150: uint8(0x01),
  14699. 151: uint8(0x01),
  14700. 152: uint8(0x01),
  14701. 153: uint8(0x01),
  14702. 154: uint8(0x01),
  14703. 155: uint8(0x01),
  14704. 156: uint8(0x01),
  14705. 157: uint8(0x01),
  14706. 158: uint8(0x01),
  14707. 159: uint8(0x17),
  14708. 172: uint8(0x01),
  14709. 173: uint8(0x01),
  14710. 174: uint8(0x01),
  14711. 175: uint8(0x01),
  14712. 176: uint8(0x01),
  14713. 177: uint8(0x01),
  14714. 178: uint8(0x01),
  14715. 179: uint8(0x01),
  14716. 180: uint8(0x01),
  14717. 181: uint8(0x01),
  14718. 182: uint8(0x01),
  14719. 183: uint8(0x01),
  14720. 184: uint8(0x01),
  14721. 185: uint8(0x01),
  14722. 186: uint8(0x01),
  14723. 187: uint8(0x01),
  14724. 188: uint8(0x01),
  14725. 189: uint8(0x01),
  14726. 190: uint8(0x01),
  14727. 191: uint8(0x01),
  14728. 192: uint8(0x01),
  14729. 193: uint8(0x01),
  14730. 194: uint8(0x01),
  14731. 195: uint8(0x01),
  14732. 196: uint8(0x01),
  14733. 197: uint8(0x01),
  14734. 198: uint8(0x01),
  14735. 199: uint8(0x01),
  14736. 200: uint8(0x01),
  14737. 201: uint8(0x01),
  14738. 202: uint8(0x01),
  14739. 203: uint8(0x01),
  14740. 204: uint8(0x01),
  14741. 205: uint8(0x01),
  14742. 206: uint8(0x01),
  14743. 207: uint8(0x01),
  14744. 208: uint8(0x01),
  14745. 209: uint8(0x01),
  14746. 210: uint8(0x01),
  14747. 211: uint8(0x01),
  14748. 212: uint8(0x01),
  14749. 213: uint8(0x01),
  14750. 214: uint8(0x01),
  14751. 215: uint8(0x18),
  14752. }
  14753. /* A 2 byte UTF-8 representation splits the characters 11 bits between
  14754. the bottom 5 and 6 bits of the bytes. We need 8 bits to index into
  14755. pages, 3 bits to add to that index and 5 bits to generate the mask.
  14756. */
  14757. /* A 3 byte UTF-8 representation splits the characters 16 bits between
  14758. the bottom 4, 6 and 6 bits of the bytes. We need 8 bits to index
  14759. into pages, 3 bits to add to that index and 5 bits to generate the
  14760. mask.
  14761. */
  14762. /* Detection of invalid UTF-8 sequences is based on Table 3.1B
  14763. of Unicode 3.2: http://www.unicode.org/unicode/reports/tr28/
  14764. with the additional restriction of not allowing the Unicode
  14765. code points 0xFFFF and 0xFFFE (sequences EF,BF,BF and EF,BF,BE).
  14766. Implementation details:
  14767. (A & 0x80) == 0 means A < 0x80
  14768. and
  14769. (A & 0xC0) == 0xC0 means A > 0xBF
  14770. */
  14771. func _isNever(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  14772. _ = enc
  14773. _ = p
  14774. return 0
  14775. }
  14776. func _utf8_isName2(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  14777. _ = enc
  14778. 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))))
  14779. }
  14780. func _utf8_isName3(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  14781. _ = enc
  14782. 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))))
  14783. }
  14784. func _utf8_isNmstrt2(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  14785. _ = enc
  14786. 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))))
  14787. }
  14788. func _utf8_isNmstrt3(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  14789. _ = enc
  14790. 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))))
  14791. }
  14792. func _utf8_isInvalid2(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  14793. _ = enc
  14794. 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))
  14795. }
  14796. func _utf8_isInvalid3(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  14797. var v1, v3, v4 int32
  14798. var v2, v5, v6 bool
  14799. _, _, _, _, _, _ = v1, v2, v3, v4, v5, v6
  14800. _ = enc
  14801. if v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2)))&int32(0x80) == 0; !v2 {
  14802. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xEF) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) == int32(0xBF) {
  14803. v1 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2))) > int32(0xBD))
  14804. } else {
  14805. v1 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2)))&int32(0xC0) == int32(0xC0))
  14806. }
  14807. }
  14808. if v6 = v2 || v1 != 0; !v6 {
  14809. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xE0) {
  14810. v3 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) < int32(0xA0) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  14811. } else {
  14812. if v5 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0x80) == 0; !v5 {
  14813. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xED) {
  14814. v4 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) > int32(0x9F))
  14815. } else {
  14816. v4 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  14817. }
  14818. }
  14819. v3 = libc.BoolInt32(v5 || v4 != 0)
  14820. }
  14821. }
  14822. return libc.BoolInt32(v6 || v3 != 0)
  14823. }
  14824. func _utf8_isInvalid4(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  14825. var v1, v2 int32
  14826. var v3, v4 bool
  14827. _, _, _, _ = v1, v2, v3, v4
  14828. _ = enc
  14829. 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 {
  14830. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xF0) {
  14831. v1 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) < int32(0x90) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  14832. } else {
  14833. if v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0x80) == 0; !v3 {
  14834. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xF4) {
  14835. v2 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) > int32(0x8F))
  14836. } else {
  14837. v2 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  14838. }
  14839. }
  14840. v1 = libc.BoolInt32(v3 || v2 != 0)
  14841. }
  14842. }
  14843. return libc.BoolInt32(v4 || v1 != 0)
  14844. }
  14845. type Tnormal_encoding = struct {
  14846. Fenc TENCODING
  14847. Ftype1 [256]uint8
  14848. FisName2 uintptr
  14849. FisName3 uintptr
  14850. FisName4 uintptr
  14851. FisNmstrt2 uintptr
  14852. FisNmstrt3 uintptr
  14853. FisNmstrt4 uintptr
  14854. FisInvalid2 uintptr
  14855. FisInvalid3 uintptr
  14856. FisInvalid4 uintptr
  14857. }
  14858. const _BT_NONXML = 0
  14859. const _BT_MALFORM = 1
  14860. const _BT_LT = 2
  14861. const _BT_AMP = 3
  14862. const _BT_RSQB = 4
  14863. const _BT_LEAD2 = 5
  14864. const _BT_LEAD3 = 6
  14865. const _BT_LEAD4 = 7
  14866. const _BT_TRAIL = 8
  14867. const _BT_CR = 9
  14868. const _BT_LF = 10
  14869. const _BT_GT = 11
  14870. const _BT_QUOT = 12
  14871. const _BT_APOS = 13
  14872. const _BT_EQUALS = 14
  14873. const _BT_QUEST = 15
  14874. const _BT_EXCL = 16
  14875. const _BT_SOL = 17
  14876. const _BT_SEMI = 18
  14877. const _BT_NUM = 19
  14878. const _BT_LSQB = 20
  14879. const _BT_S = 21
  14880. const _BT_NMSTRT = 22
  14881. const _BT_COLON = 23
  14882. const _BT_HEX = 24
  14883. const _BT_DIGIT = 25
  14884. const _BT_NAME = 26
  14885. const _BT_MINUS = 27
  14886. const _BT_OTHER = 28
  14887. const _BT_NONASCII = 29
  14888. const _BT_PERCNT = 30
  14889. const _BT_LPAR = 31
  14890. const _BT_RPAR = 32
  14891. const _BT_AST = 33
  14892. const _BT_PLUS = 34
  14893. const _BT_COMMA = 35
  14894. const _BT_VERBAR = 36
  14895. /*===---- stddef.h - Basic type definitions --------------------------------===
  14896. *
  14897. * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  14898. * See https://llvm.org/LICENSE.txt for license information.
  14899. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  14900. *
  14901. *===-----------------------------------------------------------------------===
  14902. */
  14903. /*
  14904. * This header is designed to be included multiple times. If any of the __need_
  14905. * macros are defined, then only that subset of interfaces are provided. This
  14906. * can be useful for POSIX headers that need to not expose all of stddef.h, but
  14907. * need to use some of its interfaces. Otherwise this header provides all of
  14908. * the expected interfaces.
  14909. *
  14910. * When clang modules are enabled, this header is a textual header to support
  14911. * the multiple include behavior. As such, it doesn't directly declare anything
  14912. * so that it doesn't add duplicate declarations to all of its includers'
  14913. * modules.
  14914. */
  14915. /* ISO9899:2011 7.20 (C11 Annex K): Define rsize_t if __STDC_WANT_LIB_EXT1__ is
  14916. * enabled. */
  14917. /* wint_t is provided by <wchar.h> and not <stddef.h>. It's here
  14918. * for compatibility, but must be explicitly requested. Therefore
  14919. * __need_wint_t is intentionally not defined here. */
  14920. /*===---- __stddef_header_macro.h ------------------------------------------===
  14921. *
  14922. * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  14923. * See https://llvm.org/LICENSE.txt for license information.
  14924. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  14925. *
  14926. *===-----------------------------------------------------------------------===
  14927. */
  14928. /*===---- __stddef_ptrdiff_t.h - Definition of ptrdiff_t -------------------===
  14929. *
  14930. * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  14931. * See https://llvm.org/LICENSE.txt for license information.
  14932. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  14933. *
  14934. *===-----------------------------------------------------------------------===
  14935. */
  14936. /*
  14937. * When -fbuiltin-headers-in-system-modules is set this is a non-modular header
  14938. * and needs to behave as if it was textual.
  14939. */
  14940. /*===---- __stddef_size_t.h - Definition of size_t -------------------------===
  14941. *
  14942. * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  14943. * See https://llvm.org/LICENSE.txt for license information.
  14944. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  14945. *
  14946. *===-----------------------------------------------------------------------===
  14947. */
  14948. /*
  14949. * When -fbuiltin-headers-in-system-modules is set this is a non-modular header
  14950. * and needs to behave as if it was textual.
  14951. */
  14952. /*===---- __stddef_rsize_t.h - Definition of rsize_t -----------------------===
  14953. *
  14954. * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  14955. * See https://llvm.org/LICENSE.txt for license information.
  14956. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  14957. *
  14958. *===-----------------------------------------------------------------------===
  14959. */
  14960. /*
  14961. * When -fbuiltin-headers-in-system-modules is set this is a non-modular header
  14962. * and needs to behave as if it was textual.
  14963. */
  14964. /*===---- __stddef_wchar.h - Definition of wchar_t -------------------------===
  14965. *
  14966. * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  14967. * See https://llvm.org/LICENSE.txt for license information.
  14968. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  14969. *
  14970. *===-----------------------------------------------------------------------===
  14971. */
  14972. /*
  14973. * When -fbuiltin-headers-in-system-modules is set this is a non-modular header
  14974. * and needs to behave as if it was textual.
  14975. */
  14976. /*===---- __stddef_max_align_t.h - Definition of max_align_t ---------------===
  14977. *
  14978. * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  14979. * See https://llvm.org/LICENSE.txt for license information.
  14980. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  14981. *
  14982. *===-----------------------------------------------------------------------===
  14983. */
  14984. /*===---- __stddef_offsetof.h - Definition of offsetof ---------------------===
  14985. *
  14986. * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  14987. * See https://llvm.org/LICENSE.txt for license information.
  14988. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  14989. *
  14990. *===-----------------------------------------------------------------------===
  14991. */
  14992. /*
  14993. * When -fbuiltin-headers-in-system-modules is set this is a non-modular header
  14994. * and needs to behave as if it was textual.
  14995. */
  14996. /* Some C libraries expect to see a wint_t here. Others (notably MinGW) will use
  14997. __WINT_TYPE__ directly; accommodate both by requiring __need_wint_t */
  14998. /*
  14999. __ __ _
  15000. ___\ \/ /_ __ __ _| |_
  15001. / _ \\ /| '_ \ / _` | __|
  15002. | __// \| |_) | (_| | |_
  15003. \___/_/\_\ .__/ \__,_|\__|
  15004. |_| XML parser
  15005. Copyright (c) 1999-2000 Thai Open Source Software Center Ltd
  15006. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  15007. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  15008. Copyright (c) 2007 Karl Waclawek <karl@waclawek.net>
  15009. Copyright (c) 2017 Sebastian Pipping <sebastian@pipping.org>
  15010. Licensed under the MIT license:
  15011. Permission is hereby granted, free of charge, to any person obtaining
  15012. a copy of this software and associated documentation files (the
  15013. "Software"), to deal in the Software without restriction, including
  15014. without limitation the rights to use, copy, modify, merge, publish,
  15015. distribute, sublicense, and/or sell copies of the Software, and to permit
  15016. persons to whom the Software is furnished to do so, subject to the
  15017. following conditions:
  15018. The above copyright notice and this permission notice shall be included
  15019. in all copies or substantial portions of the Software.
  15020. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  15021. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  15022. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  15023. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  15024. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  15025. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  15026. USE OR OTHER DEALINGS IN THE SOFTWARE.
  15027. */
  15028. /* minimum bytes per character */
  15029. /* c is an ASCII character */
  15030. /* This file is included (from xmltok.c, 1-3 times depending on XML_MIN_SIZE)!
  15031. __ __ _
  15032. ___\ \/ /_ __ __ _| |_
  15033. / _ \\ /| '_ \ / _` | __|
  15034. | __// \| |_) | (_| | |_
  15035. \___/_/\_\ .__/ \__,_|\__|
  15036. |_| XML parser
  15037. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  15038. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  15039. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  15040. Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
  15041. Copyright (c) 2016-2022 Sebastian Pipping <sebastian@pipping.org>
  15042. Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
  15043. Copyright (c) 2018 Benjamin Peterson <benjamin@python.org>
  15044. Copyright (c) 2018 Anton Maklakov <antmak.pub@gmail.com>
  15045. Copyright (c) 2019 David Loffredo <loffredo@steptools.com>
  15046. Copyright (c) 2020 Boris Kolpackov <boris@codesynthesis.com>
  15047. Copyright (c) 2022 Martin Ettl <ettl.martin78@googlemail.com>
  15048. Licensed under the MIT license:
  15049. Permission is hereby granted, free of charge, to any person obtaining
  15050. a copy of this software and associated documentation files (the
  15051. "Software"), to deal in the Software without restriction, including
  15052. without limitation the rights to use, copy, modify, merge, publish,
  15053. distribute, sublicense, and/or sell copies of the Software, and to permit
  15054. persons to whom the Software is furnished to do so, subject to the
  15055. following conditions:
  15056. The above copyright notice and this permission notice shall be included
  15057. in all copies or substantial portions of the Software.
  15058. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  15059. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  15060. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  15061. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  15062. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  15063. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  15064. USE OR OTHER DEALINGS IN THE SOFTWARE.
  15065. */
  15066. /* ptr points to character following "<!-" */
  15067. func _normal_scanComment(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15068. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15069. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_MINUS1)) {
  15070. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15071. return m_XML_TOK_INVALID
  15072. }
  15073. ptr += uintptr(1)
  15074. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15075. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15076. case int32(_BT_LEAD2):
  15077. if int64(end)-int64(ptr) < int64(2) {
  15078. return -int32(2)
  15079. }
  15080. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  15081. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15082. return m_XML_TOK_INVALID
  15083. }
  15084. ptr += uintptr(2)
  15085. case int32(_BT_LEAD3):
  15086. if int64(end)-int64(ptr) < int64(3) {
  15087. return -int32(2)
  15088. }
  15089. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  15090. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15091. return m_XML_TOK_INVALID
  15092. }
  15093. ptr += uintptr(3)
  15094. case int32(_BT_LEAD4):
  15095. if int64(end)-int64(ptr) < int64(4) {
  15096. return -int32(2)
  15097. }
  15098. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  15099. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15100. return m_XML_TOK_INVALID
  15101. }
  15102. ptr += uintptr(4)
  15103. case int32(_BT_NONXML):
  15104. fallthrough
  15105. case int32(_BT_MALFORM):
  15106. fallthrough
  15107. case int32(_BT_TRAIL):
  15108. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15109. return m_XML_TOK_INVALID
  15110. case int32(_BT_MINUS):
  15111. ptr += uintptr(1)
  15112. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15113. return -int32(1)
  15114. }
  15115. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_MINUS1) {
  15116. ptr += uintptr(1)
  15117. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15118. return -int32(1)
  15119. }
  15120. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  15121. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15122. return m_XML_TOK_INVALID
  15123. }
  15124. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15125. return int32(m_XML_TOK_COMMENT)
  15126. }
  15127. default:
  15128. ptr += uintptr(1)
  15129. break
  15130. }
  15131. }
  15132. }
  15133. return -int32(1)
  15134. }
  15135. /* ptr points to character following "<!" */
  15136. func _normal_scanDecl(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15137. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15138. return -int32(1)
  15139. }
  15140. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15141. case int32(_BT_MINUS):
  15142. return _normal_scanComment(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15143. case int32(_BT_LSQB):
  15144. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15145. return int32(m_XML_TOK_COND_SECT_OPEN)
  15146. case int32(_BT_NMSTRT):
  15147. fallthrough
  15148. case int32(_BT_HEX):
  15149. ptr += uintptr(1)
  15150. default:
  15151. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15152. return m_XML_TOK_INVALID
  15153. }
  15154. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15155. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15156. case int32(_BT_PERCNT):
  15157. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))) {
  15158. return -int32(1)
  15159. }
  15160. /* don't allow <!ENTITY% foo "whatever"> */
  15161. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))))))) {
  15162. case int32(_BT_S):
  15163. fallthrough
  15164. case int32(_BT_CR):
  15165. fallthrough
  15166. case int32(_BT_LF):
  15167. fallthrough
  15168. case int32(_BT_PERCNT):
  15169. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15170. return m_XML_TOK_INVALID
  15171. }
  15172. /* fall through */
  15173. fallthrough
  15174. case int32(_BT_S):
  15175. fallthrough
  15176. case int32(_BT_CR):
  15177. fallthrough
  15178. case int32(_BT_LF):
  15179. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15180. return int32(m_XML_TOK_DECL_OPEN)
  15181. case int32(_BT_NMSTRT):
  15182. fallthrough
  15183. case int32(_BT_HEX):
  15184. ptr += uintptr(1)
  15185. default:
  15186. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15187. return m_XML_TOK_INVALID
  15188. }
  15189. }
  15190. return -int32(1)
  15191. }
  15192. func _normal_checkPiTarget(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, tokPtr uintptr) (r int32) {
  15193. var upper int32
  15194. _ = upper
  15195. upper = 0
  15196. _ = enc
  15197. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_PI)
  15198. if int64(end)-int64(ptr) != int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(3)) {
  15199. return int32(1)
  15200. }
  15201. switch int32(*(*int8)(unsafe.Pointer(ptr))) {
  15202. case int32(m_ASCII_x2):
  15203. case int32(m_ASCII_X):
  15204. upper = int32(1)
  15205. default:
  15206. return int32(1)
  15207. }
  15208. ptr += uintptr(1)
  15209. switch int32(*(*int8)(unsafe.Pointer(ptr))) {
  15210. case int32(m_ASCII_m2):
  15211. case int32(m_ASCII_M):
  15212. upper = int32(1)
  15213. default:
  15214. return int32(1)
  15215. }
  15216. ptr += uintptr(1)
  15217. switch int32(*(*int8)(unsafe.Pointer(ptr))) {
  15218. case int32(m_ASCII_l2):
  15219. case int32(m_ASCII_L):
  15220. upper = int32(1)
  15221. default:
  15222. return int32(1)
  15223. }
  15224. if upper != 0 {
  15225. return 0
  15226. }
  15227. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_XML_DECL)
  15228. return int32(1)
  15229. }
  15230. /* ptr points to character following "<?" */
  15231. func _normal_scanPi(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15232. bp := tls.Alloc(16)
  15233. defer tls.Free(16)
  15234. var target uintptr
  15235. var _ /* tok at bp+0 */ int32
  15236. _ = target
  15237. target = ptr
  15238. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15239. return -int32(1)
  15240. }
  15241. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15242. case int32(_BT_NONASCII):
  15243. if !(libc.Int32FromInt32(0) != 0) {
  15244. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15245. return m_XML_TOK_INVALID
  15246. } /* fall through */
  15247. fallthrough
  15248. case int32(_BT_NMSTRT):
  15249. fallthrough
  15250. case int32(_BT_HEX):
  15251. ptr += uintptr(1)
  15252. case int32(_BT_LEAD2):
  15253. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  15254. return -int32(2)
  15255. }
  15256. 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) {
  15257. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15258. return m_XML_TOK_INVALID
  15259. }
  15260. ptr += uintptr(2)
  15261. case int32(_BT_LEAD3):
  15262. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  15263. return -int32(2)
  15264. }
  15265. 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) {
  15266. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15267. return m_XML_TOK_INVALID
  15268. }
  15269. ptr += uintptr(3)
  15270. case int32(_BT_LEAD4):
  15271. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  15272. return -int32(2)
  15273. }
  15274. 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) {
  15275. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15276. return m_XML_TOK_INVALID
  15277. }
  15278. ptr += uintptr(4)
  15279. default:
  15280. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15281. return m_XML_TOK_INVALID
  15282. }
  15283. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15284. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15285. case int32(_BT_NONASCII):
  15286. if !(libc.Int32FromInt32(0) != 0) {
  15287. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15288. return m_XML_TOK_INVALID
  15289. } /* fall through */
  15290. fallthrough
  15291. case int32(_BT_NMSTRT):
  15292. fallthrough
  15293. case int32(_BT_HEX):
  15294. fallthrough
  15295. case int32(_BT_DIGIT):
  15296. fallthrough
  15297. case int32(_BT_NAME):
  15298. fallthrough
  15299. case int32(_BT_MINUS):
  15300. ptr += uintptr(1)
  15301. case int32(_BT_LEAD2):
  15302. if int64(end)-int64(ptr) < int64(2) {
  15303. return -int32(2)
  15304. }
  15305. 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) {
  15306. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15307. return m_XML_TOK_INVALID
  15308. }
  15309. ptr += uintptr(2)
  15310. case int32(_BT_LEAD3):
  15311. if int64(end)-int64(ptr) < int64(3) {
  15312. return -int32(2)
  15313. }
  15314. 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) {
  15315. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15316. return m_XML_TOK_INVALID
  15317. }
  15318. ptr += uintptr(3)
  15319. case int32(_BT_LEAD4):
  15320. if int64(end)-int64(ptr) < int64(4) {
  15321. return -int32(2)
  15322. }
  15323. 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) {
  15324. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15325. return m_XML_TOK_INVALID
  15326. }
  15327. ptr += uintptr(4)
  15328. case int32(_BT_S):
  15329. fallthrough
  15330. case int32(_BT_CR):
  15331. fallthrough
  15332. case int32(_BT_LF):
  15333. if !(_normal_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  15334. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15335. return m_XML_TOK_INVALID
  15336. }
  15337. ptr += uintptr(1)
  15338. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15339. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15340. case int32(_BT_LEAD2):
  15341. if int64(end)-int64(ptr) < int64(2) {
  15342. return -int32(2)
  15343. }
  15344. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  15345. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15346. return m_XML_TOK_INVALID
  15347. }
  15348. ptr += uintptr(2)
  15349. case int32(_BT_LEAD3):
  15350. if int64(end)-int64(ptr) < int64(3) {
  15351. return -int32(2)
  15352. }
  15353. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  15354. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15355. return m_XML_TOK_INVALID
  15356. }
  15357. ptr += uintptr(3)
  15358. case int32(_BT_LEAD4):
  15359. if int64(end)-int64(ptr) < int64(4) {
  15360. return -int32(2)
  15361. }
  15362. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  15363. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15364. return m_XML_TOK_INVALID
  15365. }
  15366. ptr += uintptr(4)
  15367. case int32(_BT_NONXML):
  15368. fallthrough
  15369. case int32(_BT_MALFORM):
  15370. fallthrough
  15371. case int32(_BT_TRAIL):
  15372. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15373. return m_XML_TOK_INVALID
  15374. case int32(_BT_QUEST):
  15375. ptr += uintptr(1)
  15376. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15377. return -int32(1)
  15378. }
  15379. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  15380. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15381. return *(*int32)(unsafe.Pointer(bp))
  15382. }
  15383. default:
  15384. ptr += uintptr(1)
  15385. break
  15386. }
  15387. }
  15388. return -int32(1)
  15389. case int32(_BT_QUEST):
  15390. if !(_normal_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  15391. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15392. return m_XML_TOK_INVALID
  15393. }
  15394. ptr += uintptr(1)
  15395. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15396. return -int32(1)
  15397. }
  15398. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  15399. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15400. return *(*int32)(unsafe.Pointer(bp))
  15401. }
  15402. /* fall through */
  15403. fallthrough
  15404. default:
  15405. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15406. return m_XML_TOK_INVALID
  15407. }
  15408. }
  15409. return -int32(1)
  15410. }
  15411. func _normal_scanCdataSection(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15412. var i int32
  15413. _ = i
  15414. _ = enc
  15415. /* CDATA[ */
  15416. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(6)*libc.Int32FromInt32(1))) {
  15417. return -int32(1)
  15418. }
  15419. i = 0
  15420. for {
  15421. if !(i < int32(6)) {
  15422. break
  15423. }
  15424. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == int32(_CDATA_LSQB[i])) {
  15425. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15426. return m_XML_TOK_INVALID
  15427. }
  15428. goto _1
  15429. _1:
  15430. ;
  15431. i++
  15432. ptr += uintptr(1)
  15433. }
  15434. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15435. return int32(m_XML_TOK_CDATA_SECT_OPEN)
  15436. }
  15437. var _CDATA_LSQB = [6]int8{
  15438. 0: int8(m_ASCII_C),
  15439. 1: int8(m_ASCII_D),
  15440. 2: int8(m_ASCII_A),
  15441. 3: int8(m_ASCII_T),
  15442. 4: int8(m_ASCII_A),
  15443. 5: int8(m_ASCII_LSQB1),
  15444. }
  15445. func _normal_cdataSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15446. var n Tsize_t
  15447. _ = n
  15448. if ptr >= end {
  15449. return -int32(4)
  15450. }
  15451. if int32(1) > int32(1) {
  15452. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  15453. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  15454. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  15455. if n == uint64(0) {
  15456. return -int32(1)
  15457. }
  15458. end = ptr + uintptr(n)
  15459. }
  15460. }
  15461. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15462. case int32(_BT_RSQB):
  15463. ptr += uintptr(1)
  15464. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15465. return -int32(1)
  15466. }
  15467. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_RSQB1)) {
  15468. break
  15469. }
  15470. ptr += uintptr(1)
  15471. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15472. return -int32(1)
  15473. }
  15474. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  15475. ptr -= uintptr(1)
  15476. break
  15477. }
  15478. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15479. return int32(m_XML_TOK_CDATA_SECT_CLOSE)
  15480. case int32(_BT_CR):
  15481. ptr += uintptr(1)
  15482. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15483. return -int32(1)
  15484. }
  15485. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) == int32(_BT_LF) {
  15486. ptr += uintptr(1)
  15487. }
  15488. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15489. return int32(m_XML_TOK_DATA_NEWLINE)
  15490. case int32(_BT_LF):
  15491. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15492. return int32(m_XML_TOK_DATA_NEWLINE)
  15493. case int32(_BT_LEAD2):
  15494. if int64(end)-int64(ptr) < int64(2) {
  15495. return -int32(2)
  15496. }
  15497. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  15498. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15499. return m_XML_TOK_INVALID
  15500. }
  15501. ptr += uintptr(2)
  15502. case int32(_BT_LEAD3):
  15503. if int64(end)-int64(ptr) < int64(3) {
  15504. return -int32(2)
  15505. }
  15506. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  15507. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15508. return m_XML_TOK_INVALID
  15509. }
  15510. ptr += uintptr(3)
  15511. case int32(_BT_LEAD4):
  15512. if int64(end)-int64(ptr) < int64(4) {
  15513. return -int32(2)
  15514. }
  15515. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  15516. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15517. return m_XML_TOK_INVALID
  15518. }
  15519. ptr += uintptr(4)
  15520. case int32(_BT_NONXML):
  15521. fallthrough
  15522. case int32(_BT_MALFORM):
  15523. fallthrough
  15524. case int32(_BT_TRAIL):
  15525. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15526. return m_XML_TOK_INVALID
  15527. default:
  15528. ptr += uintptr(1)
  15529. break
  15530. }
  15531. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15532. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15533. case int32(_BT_LEAD2):
  15534. if int64(end)-int64(ptr) < int64(2) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  15535. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15536. return int32(m_XML_TOK_DATA_CHARS)
  15537. }
  15538. ptr += uintptr(2)
  15539. case int32(_BT_LEAD3):
  15540. if int64(end)-int64(ptr) < int64(3) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  15541. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15542. return int32(m_XML_TOK_DATA_CHARS)
  15543. }
  15544. ptr += uintptr(3)
  15545. case int32(_BT_LEAD4):
  15546. if int64(end)-int64(ptr) < int64(4) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  15547. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15548. return int32(m_XML_TOK_DATA_CHARS)
  15549. }
  15550. ptr += uintptr(4)
  15551. case int32(_BT_NONXML):
  15552. fallthrough
  15553. case int32(_BT_MALFORM):
  15554. fallthrough
  15555. case int32(_BT_TRAIL):
  15556. fallthrough
  15557. case int32(_BT_CR):
  15558. fallthrough
  15559. case int32(_BT_LF):
  15560. fallthrough
  15561. case int32(_BT_RSQB):
  15562. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15563. return int32(m_XML_TOK_DATA_CHARS)
  15564. default:
  15565. ptr += uintptr(1)
  15566. break
  15567. }
  15568. }
  15569. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15570. return int32(m_XML_TOK_DATA_CHARS)
  15571. }
  15572. /* ptr points to character following "</" */
  15573. func _normal_scanEndTag(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15574. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15575. return -int32(1)
  15576. }
  15577. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15578. case int32(_BT_NONASCII):
  15579. if !(libc.Int32FromInt32(0) != 0) {
  15580. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15581. return m_XML_TOK_INVALID
  15582. } /* fall through */
  15583. fallthrough
  15584. case int32(_BT_NMSTRT):
  15585. fallthrough
  15586. case int32(_BT_HEX):
  15587. ptr += uintptr(1)
  15588. case int32(_BT_LEAD2):
  15589. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  15590. return -int32(2)
  15591. }
  15592. 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) {
  15593. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15594. return m_XML_TOK_INVALID
  15595. }
  15596. ptr += uintptr(2)
  15597. case int32(_BT_LEAD3):
  15598. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  15599. return -int32(2)
  15600. }
  15601. 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) {
  15602. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15603. return m_XML_TOK_INVALID
  15604. }
  15605. ptr += uintptr(3)
  15606. case int32(_BT_LEAD4):
  15607. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  15608. return -int32(2)
  15609. }
  15610. 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) {
  15611. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15612. return m_XML_TOK_INVALID
  15613. }
  15614. ptr += uintptr(4)
  15615. default:
  15616. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15617. return m_XML_TOK_INVALID
  15618. }
  15619. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15620. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15621. case int32(_BT_NONASCII):
  15622. goto _1
  15623. case int32(_BT_MINUS):
  15624. goto _2
  15625. case int32(_BT_NAME):
  15626. goto _3
  15627. case int32(_BT_DIGIT):
  15628. goto _4
  15629. case int32(_BT_HEX):
  15630. goto _5
  15631. case int32(_BT_NMSTRT):
  15632. goto _6
  15633. case int32(_BT_LEAD2):
  15634. goto _7
  15635. case int32(_BT_LEAD3):
  15636. goto _8
  15637. case int32(_BT_LEAD4):
  15638. goto _9
  15639. case int32(_BT_LF):
  15640. goto _10
  15641. case int32(_BT_CR):
  15642. goto _11
  15643. case int32(_BT_S):
  15644. goto _12
  15645. case int32(_BT_COLON):
  15646. goto _13
  15647. case int32(_BT_GT):
  15648. goto _14
  15649. default:
  15650. goto _15
  15651. }
  15652. goto _16
  15653. _1:
  15654. ;
  15655. if !(libc.Int32FromInt32(0) != 0) {
  15656. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15657. return m_XML_TOK_INVALID
  15658. } /* fall through */
  15659. _6:
  15660. ;
  15661. _5:
  15662. ;
  15663. _4:
  15664. ;
  15665. _3:
  15666. ;
  15667. _2:
  15668. ;
  15669. ptr += uintptr(1)
  15670. goto _16
  15671. _7:
  15672. ;
  15673. if int64(end)-int64(ptr) < int64(2) {
  15674. return -int32(2)
  15675. }
  15676. 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) {
  15677. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15678. return m_XML_TOK_INVALID
  15679. }
  15680. ptr += uintptr(2)
  15681. goto _16
  15682. _8:
  15683. ;
  15684. if int64(end)-int64(ptr) < int64(3) {
  15685. return -int32(2)
  15686. }
  15687. 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) {
  15688. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15689. return m_XML_TOK_INVALID
  15690. }
  15691. ptr += uintptr(3)
  15692. goto _16
  15693. _9:
  15694. ;
  15695. if int64(end)-int64(ptr) < int64(4) {
  15696. return -int32(2)
  15697. }
  15698. 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) {
  15699. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15700. return m_XML_TOK_INVALID
  15701. }
  15702. ptr += uintptr(4)
  15703. goto _16
  15704. _12:
  15705. ;
  15706. _11:
  15707. ;
  15708. _10:
  15709. ;
  15710. ptr += uintptr(1)
  15711. _19:
  15712. ;
  15713. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15714. goto _17
  15715. }
  15716. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15717. case int32(_BT_S):
  15718. fallthrough
  15719. case int32(_BT_CR):
  15720. fallthrough
  15721. case int32(_BT_LF):
  15722. case int32(_BT_GT):
  15723. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15724. return int32(m_XML_TOK_END_TAG)
  15725. default:
  15726. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15727. return m_XML_TOK_INVALID
  15728. }
  15729. goto _18
  15730. _18:
  15731. ;
  15732. ptr += uintptr(1)
  15733. goto _19
  15734. goto _17
  15735. _17:
  15736. ;
  15737. return -int32(1)
  15738. _13:
  15739. ;
  15740. /* no need to check qname syntax here,
  15741. since end-tag must match exactly */
  15742. ptr += uintptr(1)
  15743. goto _16
  15744. _14:
  15745. ;
  15746. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15747. return int32(m_XML_TOK_END_TAG)
  15748. _15:
  15749. ;
  15750. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15751. return m_XML_TOK_INVALID
  15752. _16:
  15753. }
  15754. return -int32(1)
  15755. }
  15756. /* ptr points to character following "&#X" */
  15757. func _normal_scanHexCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15758. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15759. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15760. case int32(_BT_DIGIT):
  15761. fallthrough
  15762. case int32(_BT_HEX):
  15763. default:
  15764. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15765. return m_XML_TOK_INVALID
  15766. }
  15767. ptr += uintptr(1)
  15768. for {
  15769. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15770. break
  15771. }
  15772. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15773. case int32(_BT_DIGIT):
  15774. fallthrough
  15775. case int32(_BT_HEX):
  15776. case int32(_BT_SEMI):
  15777. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15778. return int32(m_XML_TOK_CHAR_REF)
  15779. default:
  15780. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15781. return m_XML_TOK_INVALID
  15782. }
  15783. goto _1
  15784. _1:
  15785. ;
  15786. ptr += uintptr(1)
  15787. }
  15788. }
  15789. return -int32(1)
  15790. }
  15791. /* ptr points to character following "&#" */
  15792. func _normal_scanCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15793. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15794. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  15795. return _normal_scanHexCharRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15796. }
  15797. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15798. case int32(_BT_DIGIT):
  15799. default:
  15800. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15801. return m_XML_TOK_INVALID
  15802. }
  15803. ptr += uintptr(1)
  15804. for {
  15805. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15806. break
  15807. }
  15808. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15809. case int32(_BT_DIGIT):
  15810. case int32(_BT_SEMI):
  15811. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15812. return int32(m_XML_TOK_CHAR_REF)
  15813. default:
  15814. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15815. return m_XML_TOK_INVALID
  15816. }
  15817. goto _1
  15818. _1:
  15819. ;
  15820. ptr += uintptr(1)
  15821. }
  15822. }
  15823. return -int32(1)
  15824. }
  15825. /* ptr points to character following "&" */
  15826. func _normal_scanRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15827. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15828. return -int32(1)
  15829. }
  15830. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15831. case int32(_BT_NONASCII):
  15832. if !(libc.Int32FromInt32(0) != 0) {
  15833. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15834. return m_XML_TOK_INVALID
  15835. } /* fall through */
  15836. fallthrough
  15837. case int32(_BT_NMSTRT):
  15838. fallthrough
  15839. case int32(_BT_HEX):
  15840. ptr += uintptr(1)
  15841. case int32(_BT_LEAD2):
  15842. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  15843. return -int32(2)
  15844. }
  15845. 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) {
  15846. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15847. return m_XML_TOK_INVALID
  15848. }
  15849. ptr += uintptr(2)
  15850. case int32(_BT_LEAD3):
  15851. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  15852. return -int32(2)
  15853. }
  15854. 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) {
  15855. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15856. return m_XML_TOK_INVALID
  15857. }
  15858. ptr += uintptr(3)
  15859. case int32(_BT_LEAD4):
  15860. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  15861. return -int32(2)
  15862. }
  15863. 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) {
  15864. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15865. return m_XML_TOK_INVALID
  15866. }
  15867. ptr += uintptr(4)
  15868. case int32(_BT_NUM):
  15869. return _normal_scanCharRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15870. default:
  15871. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15872. return m_XML_TOK_INVALID
  15873. }
  15874. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15875. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15876. case int32(_BT_NONASCII):
  15877. if !(libc.Int32FromInt32(0) != 0) {
  15878. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15879. return m_XML_TOK_INVALID
  15880. } /* fall through */
  15881. fallthrough
  15882. case int32(_BT_NMSTRT):
  15883. fallthrough
  15884. case int32(_BT_HEX):
  15885. fallthrough
  15886. case int32(_BT_DIGIT):
  15887. fallthrough
  15888. case int32(_BT_NAME):
  15889. fallthrough
  15890. case int32(_BT_MINUS):
  15891. ptr += uintptr(1)
  15892. case int32(_BT_LEAD2):
  15893. if int64(end)-int64(ptr) < int64(2) {
  15894. return -int32(2)
  15895. }
  15896. 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) {
  15897. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15898. return m_XML_TOK_INVALID
  15899. }
  15900. ptr += uintptr(2)
  15901. case int32(_BT_LEAD3):
  15902. if int64(end)-int64(ptr) < int64(3) {
  15903. return -int32(2)
  15904. }
  15905. 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) {
  15906. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15907. return m_XML_TOK_INVALID
  15908. }
  15909. ptr += uintptr(3)
  15910. case int32(_BT_LEAD4):
  15911. if int64(end)-int64(ptr) < int64(4) {
  15912. return -int32(2)
  15913. }
  15914. 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) {
  15915. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15916. return m_XML_TOK_INVALID
  15917. }
  15918. ptr += uintptr(4)
  15919. case int32(_BT_SEMI):
  15920. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15921. return int32(m_XML_TOK_ENTITY_REF)
  15922. default:
  15923. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15924. return m_XML_TOK_INVALID
  15925. }
  15926. }
  15927. return -int32(1)
  15928. }
  15929. /* ptr points to character following first character of attribute name */
  15930. func _normal_scanAtts(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15931. bp := tls.Alloc(16)
  15932. defer tls.Free(16)
  15933. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  15934. var hadColon, open, t, t1, tok int32
  15935. _, _, _, _, _ = hadColon, open, t, t1, tok
  15936. hadColon = 0
  15937. for int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15938. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))) {
  15939. case int32(_BT_NONASCII):
  15940. goto _1
  15941. case int32(_BT_MINUS):
  15942. goto _2
  15943. case int32(_BT_NAME):
  15944. goto _3
  15945. case int32(_BT_DIGIT):
  15946. goto _4
  15947. case int32(_BT_HEX):
  15948. goto _5
  15949. case int32(_BT_NMSTRT):
  15950. goto _6
  15951. case int32(_BT_LEAD2):
  15952. goto _7
  15953. case int32(_BT_LEAD3):
  15954. goto _8
  15955. case int32(_BT_LEAD4):
  15956. goto _9
  15957. case int32(_BT_COLON):
  15958. goto _10
  15959. case int32(_BT_LF):
  15960. goto _11
  15961. case int32(_BT_CR):
  15962. goto _12
  15963. case int32(_BT_S):
  15964. goto _13
  15965. case int32(_BT_EQUALS):
  15966. goto _14
  15967. default:
  15968. goto _15
  15969. }
  15970. goto _16
  15971. _1:
  15972. ;
  15973. if !(libc.Int32FromInt32(0) != 0) {
  15974. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  15975. return m_XML_TOK_INVALID
  15976. } /* fall through */
  15977. _6:
  15978. ;
  15979. _5:
  15980. ;
  15981. _4:
  15982. ;
  15983. _3:
  15984. ;
  15985. _2:
  15986. ;
  15987. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  15988. goto _16
  15989. _7:
  15990. ;
  15991. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  15992. return -int32(2)
  15993. }
  15994. 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) {
  15995. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  15996. return m_XML_TOK_INVALID
  15997. }
  15998. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  15999. goto _16
  16000. _8:
  16001. ;
  16002. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  16003. return -int32(2)
  16004. }
  16005. 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) {
  16006. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  16007. return m_XML_TOK_INVALID
  16008. }
  16009. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  16010. goto _16
  16011. _9:
  16012. ;
  16013. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  16014. return -int32(2)
  16015. }
  16016. 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) {
  16017. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  16018. return m_XML_TOK_INVALID
  16019. }
  16020. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  16021. goto _16
  16022. _10:
  16023. ;
  16024. if hadColon != 0 {
  16025. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  16026. return m_XML_TOK_INVALID
  16027. }
  16028. hadColon = int32(1)
  16029. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  16030. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  16031. return -int32(1)
  16032. }
  16033. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))) {
  16034. case int32(_BT_NONASCII):
  16035. if !(libc.Int32FromInt32(0) != 0) {
  16036. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  16037. return m_XML_TOK_INVALID
  16038. } /* fall through */
  16039. fallthrough
  16040. case int32(_BT_NMSTRT):
  16041. fallthrough
  16042. case int32(_BT_HEX):
  16043. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  16044. case int32(_BT_LEAD2):
  16045. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  16046. return -int32(2)
  16047. }
  16048. 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) {
  16049. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  16050. return m_XML_TOK_INVALID
  16051. }
  16052. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  16053. case int32(_BT_LEAD3):
  16054. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  16055. return -int32(2)
  16056. }
  16057. 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) {
  16058. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  16059. return m_XML_TOK_INVALID
  16060. }
  16061. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  16062. case int32(_BT_LEAD4):
  16063. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  16064. return -int32(2)
  16065. }
  16066. 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) {
  16067. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  16068. return m_XML_TOK_INVALID
  16069. }
  16070. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  16071. default:
  16072. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  16073. return m_XML_TOK_INVALID
  16074. }
  16075. goto _16
  16076. _13:
  16077. ;
  16078. _12:
  16079. ;
  16080. _11:
  16081. ;
  16082. _19:
  16083. ;
  16084. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  16085. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  16086. return -int32(1)
  16087. }
  16088. t = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  16089. if t == int32(_BT_EQUALS) {
  16090. goto _17
  16091. }
  16092. switch t {
  16093. case int32(_BT_S):
  16094. fallthrough
  16095. case int32(_BT_LF):
  16096. fallthrough
  16097. case int32(_BT_CR):
  16098. default:
  16099. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  16100. return m_XML_TOK_INVALID
  16101. }
  16102. goto _18
  16103. _18:
  16104. ;
  16105. goto _19
  16106. goto _17
  16107. _17:
  16108. ;
  16109. /* fall through */
  16110. _14:
  16111. ;
  16112. hadColon = 0
  16113. for {
  16114. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  16115. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  16116. return -int32(1)
  16117. }
  16118. open = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  16119. if open == int32(_BT_QUOT) || open == int32(_BT_APOS) {
  16120. break
  16121. }
  16122. switch open {
  16123. case int32(_BT_S):
  16124. fallthrough
  16125. case int32(_BT_LF):
  16126. fallthrough
  16127. case int32(_BT_CR):
  16128. default:
  16129. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  16130. return m_XML_TOK_INVALID
  16131. }
  16132. goto _20
  16133. _20:
  16134. }
  16135. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  16136. /* in attribute value */
  16137. for {
  16138. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  16139. return -int32(1)
  16140. }
  16141. t1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  16142. if t1 == open {
  16143. break
  16144. }
  16145. switch t1 {
  16146. case int32(_BT_LEAD2):
  16147. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  16148. return -int32(2)
  16149. }
  16150. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  16151. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  16152. return m_XML_TOK_INVALID
  16153. }
  16154. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  16155. case int32(_BT_LEAD3):
  16156. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  16157. return -int32(2)
  16158. }
  16159. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  16160. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  16161. return m_XML_TOK_INVALID
  16162. }
  16163. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  16164. case int32(_BT_LEAD4):
  16165. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  16166. return -int32(2)
  16167. }
  16168. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  16169. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  16170. return m_XML_TOK_INVALID
  16171. }
  16172. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  16173. case int32(_BT_NONXML):
  16174. fallthrough
  16175. case int32(_BT_MALFORM):
  16176. fallthrough
  16177. case int32(_BT_TRAIL):
  16178. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  16179. return m_XML_TOK_INVALID
  16180. case int32(_BT_AMP):
  16181. tok = _normal_scanRef(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr(1), end, bp)
  16182. if tok <= 0 {
  16183. if tok == m_XML_TOK_INVALID {
  16184. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  16185. }
  16186. return tok
  16187. }
  16188. case int32(_BT_LT):
  16189. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  16190. return m_XML_TOK_INVALID
  16191. default:
  16192. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  16193. break
  16194. }
  16195. goto _21
  16196. _21:
  16197. }
  16198. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  16199. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  16200. return -int32(1)
  16201. }
  16202. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))) {
  16203. case int32(_BT_S):
  16204. fallthrough
  16205. case int32(_BT_CR):
  16206. fallthrough
  16207. case int32(_BT_LF):
  16208. case int32(_BT_SOL):
  16209. goto sol
  16210. case int32(_BT_GT):
  16211. goto gt
  16212. default:
  16213. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  16214. return m_XML_TOK_INVALID
  16215. }
  16216. /* ptr points to closing quote */
  16217. _24:
  16218. ;
  16219. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  16220. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  16221. return -int32(1)
  16222. }
  16223. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))) {
  16224. case int32(_BT_NONASCII):
  16225. goto _25
  16226. case int32(_BT_HEX):
  16227. goto _26
  16228. case int32(_BT_NMSTRT):
  16229. goto _27
  16230. case int32(_BT_LEAD2):
  16231. goto _28
  16232. case int32(_BT_LEAD3):
  16233. goto _29
  16234. case int32(_BT_LEAD4):
  16235. goto _30
  16236. case int32(_BT_LF):
  16237. goto _31
  16238. case int32(_BT_CR):
  16239. goto _32
  16240. case int32(_BT_S):
  16241. goto _33
  16242. case int32(_BT_GT):
  16243. goto _34
  16244. case int32(_BT_SOL):
  16245. goto _35
  16246. default:
  16247. goto _36
  16248. }
  16249. goto _37
  16250. _25:
  16251. ;
  16252. if !(libc.Int32FromInt32(0) != 0) {
  16253. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  16254. return m_XML_TOK_INVALID
  16255. } /* fall through */
  16256. _27:
  16257. ;
  16258. _26:
  16259. ;
  16260. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  16261. goto _37
  16262. _28:
  16263. ;
  16264. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  16265. return -int32(2)
  16266. }
  16267. 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) {
  16268. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  16269. return m_XML_TOK_INVALID
  16270. }
  16271. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  16272. goto _37
  16273. _29:
  16274. ;
  16275. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  16276. return -int32(2)
  16277. }
  16278. 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) {
  16279. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  16280. return m_XML_TOK_INVALID
  16281. }
  16282. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  16283. goto _37
  16284. _30:
  16285. ;
  16286. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  16287. return -int32(2)
  16288. }
  16289. 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) {
  16290. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  16291. return m_XML_TOK_INVALID
  16292. }
  16293. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  16294. goto _37
  16295. _33:
  16296. ;
  16297. _32:
  16298. ;
  16299. _31:
  16300. ;
  16301. goto _23
  16302. _34:
  16303. ;
  16304. goto gt
  16305. gt:
  16306. ;
  16307. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(1)
  16308. return int32(m_XML_TOK_START_TAG_WITH_ATTS)
  16309. _35:
  16310. ;
  16311. goto sol
  16312. sol:
  16313. ;
  16314. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  16315. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  16316. return -int32(1)
  16317. }
  16318. if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  16319. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  16320. return m_XML_TOK_INVALID
  16321. }
  16322. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(1)
  16323. return int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS)
  16324. _36:
  16325. ;
  16326. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  16327. return m_XML_TOK_INVALID
  16328. _37:
  16329. ;
  16330. goto _22
  16331. goto _23
  16332. _23:
  16333. ;
  16334. goto _24
  16335. goto _22
  16336. _22:
  16337. ;
  16338. goto _16
  16339. _15:
  16340. ;
  16341. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  16342. return m_XML_TOK_INVALID
  16343. _16:
  16344. }
  16345. return -int32(1)
  16346. }
  16347. /* ptr points to character following "<" */
  16348. func _normal_scanLt(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  16349. var hadColon int32
  16350. _ = hadColon
  16351. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  16352. return -int32(1)
  16353. }
  16354. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  16355. case int32(_BT_NONASCII):
  16356. if !(libc.Int32FromInt32(0) != 0) {
  16357. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16358. return m_XML_TOK_INVALID
  16359. } /* fall through */
  16360. fallthrough
  16361. case int32(_BT_NMSTRT):
  16362. fallthrough
  16363. case int32(_BT_HEX):
  16364. ptr += uintptr(1)
  16365. case int32(_BT_LEAD2):
  16366. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  16367. return -int32(2)
  16368. }
  16369. 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) {
  16370. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16371. return m_XML_TOK_INVALID
  16372. }
  16373. ptr += uintptr(2)
  16374. case int32(_BT_LEAD3):
  16375. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  16376. return -int32(2)
  16377. }
  16378. 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) {
  16379. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16380. return m_XML_TOK_INVALID
  16381. }
  16382. ptr += uintptr(3)
  16383. case int32(_BT_LEAD4):
  16384. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  16385. return -int32(2)
  16386. }
  16387. 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) {
  16388. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16389. return m_XML_TOK_INVALID
  16390. }
  16391. ptr += uintptr(4)
  16392. case int32(_BT_EXCL):
  16393. ptr += uintptr(1)
  16394. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  16395. return -int32(1)
  16396. }
  16397. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  16398. case int32(_BT_MINUS):
  16399. return _normal_scanComment(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  16400. case int32(_BT_LSQB):
  16401. return _normal_scanCdataSection(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  16402. }
  16403. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16404. return m_XML_TOK_INVALID
  16405. case int32(_BT_QUEST):
  16406. return _normal_scanPi(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  16407. case int32(_BT_SOL):
  16408. return _normal_scanEndTag(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  16409. default:
  16410. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16411. return m_XML_TOK_INVALID
  16412. }
  16413. hadColon = 0
  16414. /* we have a start-tag */
  16415. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  16416. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  16417. case int32(_BT_NONASCII):
  16418. goto _1
  16419. case int32(_BT_MINUS):
  16420. goto _2
  16421. case int32(_BT_NAME):
  16422. goto _3
  16423. case int32(_BT_DIGIT):
  16424. goto _4
  16425. case int32(_BT_HEX):
  16426. goto _5
  16427. case int32(_BT_NMSTRT):
  16428. goto _6
  16429. case int32(_BT_LEAD2):
  16430. goto _7
  16431. case int32(_BT_LEAD3):
  16432. goto _8
  16433. case int32(_BT_LEAD4):
  16434. goto _9
  16435. case int32(_BT_COLON):
  16436. goto _10
  16437. case int32(_BT_LF):
  16438. goto _11
  16439. case int32(_BT_CR):
  16440. goto _12
  16441. case int32(_BT_S):
  16442. goto _13
  16443. case int32(_BT_GT):
  16444. goto _14
  16445. case int32(_BT_SOL):
  16446. goto _15
  16447. default:
  16448. goto _16
  16449. }
  16450. goto _17
  16451. _1:
  16452. ;
  16453. if !(libc.Int32FromInt32(0) != 0) {
  16454. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16455. return m_XML_TOK_INVALID
  16456. } /* fall through */
  16457. _6:
  16458. ;
  16459. _5:
  16460. ;
  16461. _4:
  16462. ;
  16463. _3:
  16464. ;
  16465. _2:
  16466. ;
  16467. ptr += uintptr(1)
  16468. goto _17
  16469. _7:
  16470. ;
  16471. if int64(end)-int64(ptr) < int64(2) {
  16472. return -int32(2)
  16473. }
  16474. 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) {
  16475. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16476. return m_XML_TOK_INVALID
  16477. }
  16478. ptr += uintptr(2)
  16479. goto _17
  16480. _8:
  16481. ;
  16482. if int64(end)-int64(ptr) < int64(3) {
  16483. return -int32(2)
  16484. }
  16485. 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) {
  16486. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16487. return m_XML_TOK_INVALID
  16488. }
  16489. ptr += uintptr(3)
  16490. goto _17
  16491. _9:
  16492. ;
  16493. if int64(end)-int64(ptr) < int64(4) {
  16494. return -int32(2)
  16495. }
  16496. 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) {
  16497. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16498. return m_XML_TOK_INVALID
  16499. }
  16500. ptr += uintptr(4)
  16501. goto _17
  16502. _10:
  16503. ;
  16504. if hadColon != 0 {
  16505. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16506. return m_XML_TOK_INVALID
  16507. }
  16508. hadColon = int32(1)
  16509. ptr += uintptr(1)
  16510. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  16511. return -int32(1)
  16512. }
  16513. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  16514. case int32(_BT_NONASCII):
  16515. if !(libc.Int32FromInt32(0) != 0) {
  16516. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16517. return m_XML_TOK_INVALID
  16518. } /* fall through */
  16519. fallthrough
  16520. case int32(_BT_NMSTRT):
  16521. fallthrough
  16522. case int32(_BT_HEX):
  16523. ptr += uintptr(1)
  16524. case int32(_BT_LEAD2):
  16525. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  16526. return -int32(2)
  16527. }
  16528. 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) {
  16529. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16530. return m_XML_TOK_INVALID
  16531. }
  16532. ptr += uintptr(2)
  16533. case int32(_BT_LEAD3):
  16534. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  16535. return -int32(2)
  16536. }
  16537. 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) {
  16538. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16539. return m_XML_TOK_INVALID
  16540. }
  16541. ptr += uintptr(3)
  16542. case int32(_BT_LEAD4):
  16543. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  16544. return -int32(2)
  16545. }
  16546. 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) {
  16547. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16548. return m_XML_TOK_INVALID
  16549. }
  16550. ptr += uintptr(4)
  16551. default:
  16552. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16553. return m_XML_TOK_INVALID
  16554. }
  16555. goto _17
  16556. _13:
  16557. ;
  16558. _12:
  16559. ;
  16560. _11:
  16561. ;
  16562. ptr += uintptr(1)
  16563. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  16564. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  16565. case int32(_BT_NONASCII):
  16566. if !(libc.Int32FromInt32(0) != 0) {
  16567. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16568. return m_XML_TOK_INVALID
  16569. } /* fall through */
  16570. fallthrough
  16571. case int32(_BT_NMSTRT):
  16572. fallthrough
  16573. case int32(_BT_HEX):
  16574. ptr += uintptr(1)
  16575. case int32(_BT_LEAD2):
  16576. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  16577. return -int32(2)
  16578. }
  16579. 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) {
  16580. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16581. return m_XML_TOK_INVALID
  16582. }
  16583. ptr += uintptr(2)
  16584. case int32(_BT_LEAD3):
  16585. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  16586. return -int32(2)
  16587. }
  16588. 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) {
  16589. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16590. return m_XML_TOK_INVALID
  16591. }
  16592. ptr += uintptr(3)
  16593. case int32(_BT_LEAD4):
  16594. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  16595. return -int32(2)
  16596. }
  16597. 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) {
  16598. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16599. return m_XML_TOK_INVALID
  16600. }
  16601. ptr += uintptr(4)
  16602. case int32(_BT_GT):
  16603. goto gt
  16604. case int32(_BT_SOL):
  16605. goto sol
  16606. case int32(_BT_S):
  16607. fallthrough
  16608. case int32(_BT_CR):
  16609. fallthrough
  16610. case int32(_BT_LF):
  16611. ptr += uintptr(1)
  16612. continue
  16613. default:
  16614. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16615. return m_XML_TOK_INVALID
  16616. }
  16617. return _normal_scanAtts(tls, enc, ptr, end, nextTokPtr)
  16618. }
  16619. return -int32(1)
  16620. _14:
  16621. ;
  16622. goto gt
  16623. gt:
  16624. ;
  16625. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  16626. return int32(m_XML_TOK_START_TAG_NO_ATTS)
  16627. _15:
  16628. ;
  16629. goto sol
  16630. sol:
  16631. ;
  16632. ptr += uintptr(1)
  16633. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  16634. return -int32(1)
  16635. }
  16636. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  16637. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16638. return m_XML_TOK_INVALID
  16639. }
  16640. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  16641. return int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS)
  16642. _16:
  16643. ;
  16644. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16645. return m_XML_TOK_INVALID
  16646. _17:
  16647. }
  16648. return -int32(1)
  16649. }
  16650. func _normal_contentTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  16651. var n Tsize_t
  16652. _ = n
  16653. if ptr >= end {
  16654. return -int32(4)
  16655. }
  16656. if int32(1) > int32(1) {
  16657. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  16658. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  16659. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  16660. if n == uint64(0) {
  16661. return -int32(1)
  16662. }
  16663. end = ptr + uintptr(n)
  16664. }
  16665. }
  16666. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  16667. case int32(_BT_LT):
  16668. return _normal_scanLt(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  16669. case int32(_BT_AMP):
  16670. return _normal_scanRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  16671. case int32(_BT_CR):
  16672. ptr += uintptr(1)
  16673. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  16674. return -int32(3)
  16675. }
  16676. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) == int32(_BT_LF) {
  16677. ptr += uintptr(1)
  16678. }
  16679. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16680. return int32(m_XML_TOK_DATA_NEWLINE)
  16681. case int32(_BT_LF):
  16682. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  16683. return int32(m_XML_TOK_DATA_NEWLINE)
  16684. case int32(_BT_RSQB):
  16685. ptr += uintptr(1)
  16686. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  16687. return -int32(5)
  16688. }
  16689. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_RSQB1)) {
  16690. break
  16691. }
  16692. ptr += uintptr(1)
  16693. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  16694. return -int32(5)
  16695. }
  16696. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  16697. ptr -= uintptr(1)
  16698. break
  16699. }
  16700. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16701. return m_XML_TOK_INVALID
  16702. case int32(_BT_LEAD2):
  16703. if int64(end)-int64(ptr) < int64(2) {
  16704. return -int32(2)
  16705. }
  16706. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  16707. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16708. return m_XML_TOK_INVALID
  16709. }
  16710. ptr += uintptr(2)
  16711. case int32(_BT_LEAD3):
  16712. if int64(end)-int64(ptr) < int64(3) {
  16713. return -int32(2)
  16714. }
  16715. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  16716. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16717. return m_XML_TOK_INVALID
  16718. }
  16719. ptr += uintptr(3)
  16720. case int32(_BT_LEAD4):
  16721. if int64(end)-int64(ptr) < int64(4) {
  16722. return -int32(2)
  16723. }
  16724. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  16725. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16726. return m_XML_TOK_INVALID
  16727. }
  16728. ptr += uintptr(4)
  16729. case int32(_BT_NONXML):
  16730. fallthrough
  16731. case int32(_BT_MALFORM):
  16732. fallthrough
  16733. case int32(_BT_TRAIL):
  16734. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16735. return m_XML_TOK_INVALID
  16736. default:
  16737. ptr += uintptr(1)
  16738. break
  16739. }
  16740. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  16741. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  16742. case int32(_BT_LEAD2):
  16743. if int64(end)-int64(ptr) < int64(2) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  16744. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16745. return int32(m_XML_TOK_DATA_CHARS)
  16746. }
  16747. ptr += uintptr(2)
  16748. case int32(_BT_LEAD3):
  16749. if int64(end)-int64(ptr) < int64(3) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  16750. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16751. return int32(m_XML_TOK_DATA_CHARS)
  16752. }
  16753. ptr += uintptr(3)
  16754. case int32(_BT_LEAD4):
  16755. if int64(end)-int64(ptr) < int64(4) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  16756. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16757. return int32(m_XML_TOK_DATA_CHARS)
  16758. }
  16759. ptr += uintptr(4)
  16760. case int32(_BT_RSQB):
  16761. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(1)) {
  16762. if !(int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == libc.Int32FromInt32(m_ASCII_RSQB1)) {
  16763. ptr += uintptr(1)
  16764. break
  16765. }
  16766. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(3)*libc.Int32FromInt32(1)) {
  16767. if !(int32(*(*int8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  16768. ptr += uintptr(1)
  16769. break
  16770. }
  16771. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))
  16772. return m_XML_TOK_INVALID
  16773. }
  16774. }
  16775. /* fall through */
  16776. fallthrough
  16777. case int32(_BT_AMP):
  16778. fallthrough
  16779. case int32(_BT_LT):
  16780. fallthrough
  16781. case int32(_BT_NONXML):
  16782. fallthrough
  16783. case int32(_BT_MALFORM):
  16784. fallthrough
  16785. case int32(_BT_TRAIL):
  16786. fallthrough
  16787. case int32(_BT_CR):
  16788. fallthrough
  16789. case int32(_BT_LF):
  16790. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16791. return int32(m_XML_TOK_DATA_CHARS)
  16792. default:
  16793. ptr += uintptr(1)
  16794. break
  16795. }
  16796. }
  16797. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16798. return int32(m_XML_TOK_DATA_CHARS)
  16799. }
  16800. /* ptr points to character following "%" */
  16801. func _normal_scanPercent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  16802. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  16803. return -int32(1)
  16804. }
  16805. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  16806. case int32(_BT_NONASCII):
  16807. if !(libc.Int32FromInt32(0) != 0) {
  16808. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16809. return m_XML_TOK_INVALID
  16810. } /* fall through */
  16811. fallthrough
  16812. case int32(_BT_NMSTRT):
  16813. fallthrough
  16814. case int32(_BT_HEX):
  16815. ptr += uintptr(1)
  16816. case int32(_BT_LEAD2):
  16817. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  16818. return -int32(2)
  16819. }
  16820. 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) {
  16821. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16822. return m_XML_TOK_INVALID
  16823. }
  16824. ptr += uintptr(2)
  16825. case int32(_BT_LEAD3):
  16826. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  16827. return -int32(2)
  16828. }
  16829. 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) {
  16830. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16831. return m_XML_TOK_INVALID
  16832. }
  16833. ptr += uintptr(3)
  16834. case int32(_BT_LEAD4):
  16835. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  16836. return -int32(2)
  16837. }
  16838. 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) {
  16839. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16840. return m_XML_TOK_INVALID
  16841. }
  16842. ptr += uintptr(4)
  16843. case int32(_BT_S):
  16844. fallthrough
  16845. case int32(_BT_LF):
  16846. fallthrough
  16847. case int32(_BT_CR):
  16848. fallthrough
  16849. case int32(_BT_PERCNT):
  16850. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16851. return int32(m_XML_TOK_PERCENT)
  16852. default:
  16853. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16854. return m_XML_TOK_INVALID
  16855. }
  16856. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  16857. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  16858. case int32(_BT_NONASCII):
  16859. if !(libc.Int32FromInt32(0) != 0) {
  16860. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16861. return m_XML_TOK_INVALID
  16862. } /* fall through */
  16863. fallthrough
  16864. case int32(_BT_NMSTRT):
  16865. fallthrough
  16866. case int32(_BT_HEX):
  16867. fallthrough
  16868. case int32(_BT_DIGIT):
  16869. fallthrough
  16870. case int32(_BT_NAME):
  16871. fallthrough
  16872. case int32(_BT_MINUS):
  16873. ptr += uintptr(1)
  16874. case int32(_BT_LEAD2):
  16875. if int64(end)-int64(ptr) < int64(2) {
  16876. return -int32(2)
  16877. }
  16878. 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) {
  16879. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16880. return m_XML_TOK_INVALID
  16881. }
  16882. ptr += uintptr(2)
  16883. case int32(_BT_LEAD3):
  16884. if int64(end)-int64(ptr) < int64(3) {
  16885. return -int32(2)
  16886. }
  16887. 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) {
  16888. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16889. return m_XML_TOK_INVALID
  16890. }
  16891. ptr += uintptr(3)
  16892. case int32(_BT_LEAD4):
  16893. if int64(end)-int64(ptr) < int64(4) {
  16894. return -int32(2)
  16895. }
  16896. 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) {
  16897. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16898. return m_XML_TOK_INVALID
  16899. }
  16900. ptr += uintptr(4)
  16901. case int32(_BT_SEMI):
  16902. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  16903. return int32(m_XML_TOK_PARAM_ENTITY_REF)
  16904. default:
  16905. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16906. return m_XML_TOK_INVALID
  16907. }
  16908. }
  16909. return -int32(1)
  16910. }
  16911. func _normal_scanPoundName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  16912. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  16913. return -int32(1)
  16914. }
  16915. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  16916. case int32(_BT_NONASCII):
  16917. if !(libc.Int32FromInt32(0) != 0) {
  16918. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16919. return m_XML_TOK_INVALID
  16920. } /* fall through */
  16921. fallthrough
  16922. case int32(_BT_NMSTRT):
  16923. fallthrough
  16924. case int32(_BT_HEX):
  16925. ptr += uintptr(1)
  16926. case int32(_BT_LEAD2):
  16927. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  16928. return -int32(2)
  16929. }
  16930. 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) {
  16931. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16932. return m_XML_TOK_INVALID
  16933. }
  16934. ptr += uintptr(2)
  16935. case int32(_BT_LEAD3):
  16936. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  16937. return -int32(2)
  16938. }
  16939. 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) {
  16940. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16941. return m_XML_TOK_INVALID
  16942. }
  16943. ptr += uintptr(3)
  16944. case int32(_BT_LEAD4):
  16945. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  16946. return -int32(2)
  16947. }
  16948. 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) {
  16949. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16950. return m_XML_TOK_INVALID
  16951. }
  16952. ptr += uintptr(4)
  16953. default:
  16954. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16955. return m_XML_TOK_INVALID
  16956. }
  16957. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  16958. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  16959. case int32(_BT_NONASCII):
  16960. if !(libc.Int32FromInt32(0) != 0) {
  16961. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16962. return m_XML_TOK_INVALID
  16963. } /* fall through */
  16964. fallthrough
  16965. case int32(_BT_NMSTRT):
  16966. fallthrough
  16967. case int32(_BT_HEX):
  16968. fallthrough
  16969. case int32(_BT_DIGIT):
  16970. fallthrough
  16971. case int32(_BT_NAME):
  16972. fallthrough
  16973. case int32(_BT_MINUS):
  16974. ptr += uintptr(1)
  16975. case int32(_BT_LEAD2):
  16976. if int64(end)-int64(ptr) < int64(2) {
  16977. return -int32(2)
  16978. }
  16979. 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) {
  16980. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16981. return m_XML_TOK_INVALID
  16982. }
  16983. ptr += uintptr(2)
  16984. case int32(_BT_LEAD3):
  16985. if int64(end)-int64(ptr) < int64(3) {
  16986. return -int32(2)
  16987. }
  16988. 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) {
  16989. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16990. return m_XML_TOK_INVALID
  16991. }
  16992. ptr += uintptr(3)
  16993. case int32(_BT_LEAD4):
  16994. if int64(end)-int64(ptr) < int64(4) {
  16995. return -int32(2)
  16996. }
  16997. 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) {
  16998. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16999. return m_XML_TOK_INVALID
  17000. }
  17001. ptr += uintptr(4)
  17002. case int32(_BT_CR):
  17003. fallthrough
  17004. case int32(_BT_LF):
  17005. fallthrough
  17006. case int32(_BT_S):
  17007. fallthrough
  17008. case int32(_BT_RPAR):
  17009. fallthrough
  17010. case int32(_BT_GT):
  17011. fallthrough
  17012. case int32(_BT_PERCNT):
  17013. fallthrough
  17014. case int32(_BT_VERBAR):
  17015. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17016. return int32(m_XML_TOK_POUND_NAME)
  17017. default:
  17018. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17019. return m_XML_TOK_INVALID
  17020. }
  17021. }
  17022. return -int32(m_XML_TOK_POUND_NAME)
  17023. }
  17024. func _normal_scanLit(tls *libc.TLS, open int32, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  17025. var t int32
  17026. _ = t
  17027. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  17028. t = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  17029. switch t {
  17030. case int32(_BT_LEAD2):
  17031. if int64(end)-int64(ptr) < int64(2) {
  17032. return -int32(2)
  17033. }
  17034. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  17035. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17036. return m_XML_TOK_INVALID
  17037. }
  17038. ptr += uintptr(2)
  17039. case int32(_BT_LEAD3):
  17040. if int64(end)-int64(ptr) < int64(3) {
  17041. return -int32(2)
  17042. }
  17043. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  17044. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17045. return m_XML_TOK_INVALID
  17046. }
  17047. ptr += uintptr(3)
  17048. case int32(_BT_LEAD4):
  17049. if int64(end)-int64(ptr) < int64(4) {
  17050. return -int32(2)
  17051. }
  17052. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  17053. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17054. return m_XML_TOK_INVALID
  17055. }
  17056. ptr += uintptr(4)
  17057. case int32(_BT_NONXML):
  17058. fallthrough
  17059. case int32(_BT_MALFORM):
  17060. fallthrough
  17061. case int32(_BT_TRAIL):
  17062. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17063. return m_XML_TOK_INVALID
  17064. case int32(_BT_QUOT):
  17065. fallthrough
  17066. case int32(_BT_APOS):
  17067. ptr += uintptr(1)
  17068. if t != open {
  17069. break
  17070. }
  17071. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  17072. return -int32(m_XML_TOK_LITERAL)
  17073. }
  17074. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17075. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  17076. case int32(_BT_S):
  17077. fallthrough
  17078. case int32(_BT_CR):
  17079. fallthrough
  17080. case int32(_BT_LF):
  17081. fallthrough
  17082. case int32(_BT_GT):
  17083. fallthrough
  17084. case int32(_BT_PERCNT):
  17085. fallthrough
  17086. case int32(_BT_LSQB):
  17087. return int32(m_XML_TOK_LITERAL)
  17088. default:
  17089. return m_XML_TOK_INVALID
  17090. }
  17091. fallthrough
  17092. default:
  17093. ptr += uintptr(1)
  17094. break
  17095. }
  17096. }
  17097. return -int32(1)
  17098. }
  17099. func _normal_prologTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  17100. var n Tsize_t
  17101. var tok int32
  17102. _, _ = n, tok
  17103. if ptr >= end {
  17104. return -int32(4)
  17105. }
  17106. if int32(1) > int32(1) {
  17107. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  17108. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  17109. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  17110. if n == uint64(0) {
  17111. return -int32(1)
  17112. }
  17113. end = ptr + uintptr(n)
  17114. }
  17115. }
  17116. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  17117. case int32(_BT_QUOT):
  17118. goto _1
  17119. case int32(_BT_APOS):
  17120. goto _2
  17121. case int32(_BT_LT):
  17122. goto _3
  17123. case int32(_BT_CR):
  17124. goto _4
  17125. case int32(_BT_LF):
  17126. goto _5
  17127. case int32(_BT_S):
  17128. goto _6
  17129. case int32(_BT_PERCNT):
  17130. goto _7
  17131. case int32(_BT_COMMA):
  17132. goto _8
  17133. case int32(_BT_LSQB):
  17134. goto _9
  17135. case int32(_BT_RSQB):
  17136. goto _10
  17137. case int32(_BT_LPAR):
  17138. goto _11
  17139. case int32(_BT_RPAR):
  17140. goto _12
  17141. case int32(_BT_VERBAR):
  17142. goto _13
  17143. case int32(_BT_GT):
  17144. goto _14
  17145. case int32(_BT_NUM):
  17146. goto _15
  17147. case int32(_BT_LEAD2):
  17148. goto _16
  17149. case int32(_BT_LEAD3):
  17150. goto _17
  17151. case int32(_BT_LEAD4):
  17152. goto _18
  17153. case int32(_BT_HEX):
  17154. goto _19
  17155. case int32(_BT_NMSTRT):
  17156. goto _20
  17157. case int32(_BT_COLON):
  17158. goto _21
  17159. case int32(_BT_MINUS):
  17160. goto _22
  17161. case int32(_BT_NAME):
  17162. goto _23
  17163. case int32(_BT_DIGIT):
  17164. goto _24
  17165. case int32(_BT_NONASCII):
  17166. goto _25
  17167. default:
  17168. goto _26
  17169. }
  17170. goto _27
  17171. _1:
  17172. ;
  17173. return _normal_scanLit(tls, int32(_BT_QUOT), enc, ptr+uintptr(1), end, nextTokPtr)
  17174. _2:
  17175. ;
  17176. return _normal_scanLit(tls, int32(_BT_APOS), enc, ptr+uintptr(1), end, nextTokPtr)
  17177. _3:
  17178. ;
  17179. ptr += uintptr(1)
  17180. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  17181. return -int32(1)
  17182. }
  17183. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  17184. case int32(_BT_EXCL):
  17185. return _normal_scanDecl(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  17186. case int32(_BT_QUEST):
  17187. return _normal_scanPi(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  17188. case int32(_BT_NMSTRT):
  17189. fallthrough
  17190. case int32(_BT_HEX):
  17191. fallthrough
  17192. case int32(_BT_NONASCII):
  17193. fallthrough
  17194. case int32(_BT_LEAD2):
  17195. fallthrough
  17196. case int32(_BT_LEAD3):
  17197. fallthrough
  17198. case int32(_BT_LEAD4):
  17199. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr - uintptr(1)
  17200. return int32(m_XML_TOK_INSTANCE_START)
  17201. }
  17202. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17203. return m_XML_TOK_INVALID
  17204. _4:
  17205. ;
  17206. if ptr+uintptr(1) == end {
  17207. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = end
  17208. /* indicate that this might be part of a CR/LF pair */
  17209. return -int32(m_XML_TOK_PROLOG_S)
  17210. }
  17211. /* fall through */
  17212. _6:
  17213. ;
  17214. _5:
  17215. ;
  17216. _30:
  17217. ;
  17218. ptr += uintptr(1)
  17219. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  17220. goto _28
  17221. }
  17222. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  17223. case int32(_BT_S):
  17224. fallthrough
  17225. case int32(_BT_LF):
  17226. case int32(_BT_CR):
  17227. /* don't split CR/LF pair */
  17228. if ptr+uintptr(1) != end {
  17229. break
  17230. }
  17231. /* fall through */
  17232. fallthrough
  17233. default:
  17234. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17235. return int32(m_XML_TOK_PROLOG_S)
  17236. }
  17237. goto _29
  17238. _29:
  17239. ;
  17240. goto _30
  17241. goto _28
  17242. _28:
  17243. ;
  17244. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17245. return int32(m_XML_TOK_PROLOG_S)
  17246. _7:
  17247. ;
  17248. return _normal_scanPercent(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  17249. _8:
  17250. ;
  17251. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  17252. return int32(m_XML_TOK_COMMA)
  17253. _9:
  17254. ;
  17255. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  17256. return int32(m_XML_TOK_OPEN_BRACKET)
  17257. _10:
  17258. ;
  17259. ptr += uintptr(1)
  17260. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  17261. return -int32(m_XML_TOK_CLOSE_BRACKET)
  17262. }
  17263. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  17264. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))) {
  17265. return -int32(1)
  17266. }
  17267. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == int32(m_ASCII_GT1) {
  17268. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))
  17269. return int32(m_XML_TOK_COND_SECT_CLOSE)
  17270. }
  17271. }
  17272. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17273. return int32(m_XML_TOK_CLOSE_BRACKET)
  17274. _11:
  17275. ;
  17276. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  17277. return int32(m_XML_TOK_OPEN_PAREN)
  17278. _12:
  17279. ;
  17280. ptr += uintptr(1)
  17281. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  17282. return -int32(m_XML_TOK_CLOSE_PAREN)
  17283. }
  17284. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  17285. case int32(_BT_AST):
  17286. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  17287. return int32(m_XML_TOK_CLOSE_PAREN_ASTERISK)
  17288. case int32(_BT_QUEST):
  17289. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  17290. return int32(m_XML_TOK_CLOSE_PAREN_QUESTION)
  17291. case int32(_BT_PLUS):
  17292. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  17293. return int32(m_XML_TOK_CLOSE_PAREN_PLUS)
  17294. case int32(_BT_CR):
  17295. fallthrough
  17296. case int32(_BT_LF):
  17297. fallthrough
  17298. case int32(_BT_S):
  17299. fallthrough
  17300. case int32(_BT_GT):
  17301. fallthrough
  17302. case int32(_BT_COMMA):
  17303. fallthrough
  17304. case int32(_BT_VERBAR):
  17305. fallthrough
  17306. case int32(_BT_RPAR):
  17307. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17308. return int32(m_XML_TOK_CLOSE_PAREN)
  17309. }
  17310. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17311. return m_XML_TOK_INVALID
  17312. _13:
  17313. ;
  17314. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  17315. return int32(m_XML_TOK_OR)
  17316. _14:
  17317. ;
  17318. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  17319. return int32(m_XML_TOK_DECL_CLOSE)
  17320. _15:
  17321. ;
  17322. return _normal_scanPoundName(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  17323. _16:
  17324. ;
  17325. if int64(end)-int64(ptr) < int64(2) {
  17326. return -int32(2)
  17327. }
  17328. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  17329. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17330. return m_XML_TOK_INVALID
  17331. }
  17332. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0 {
  17333. ptr += uintptr(2)
  17334. tok = int32(m_XML_TOK_NAME)
  17335. goto _27
  17336. }
  17337. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0 {
  17338. ptr += uintptr(2)
  17339. tok = int32(m_XML_TOK_NMTOKEN)
  17340. goto _27
  17341. }
  17342. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17343. return m_XML_TOK_INVALID
  17344. _17:
  17345. ;
  17346. if int64(end)-int64(ptr) < int64(3) {
  17347. return -int32(2)
  17348. }
  17349. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  17350. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17351. return m_XML_TOK_INVALID
  17352. }
  17353. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0 {
  17354. ptr += uintptr(3)
  17355. tok = int32(m_XML_TOK_NAME)
  17356. goto _27
  17357. }
  17358. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0 {
  17359. ptr += uintptr(3)
  17360. tok = int32(m_XML_TOK_NMTOKEN)
  17361. goto _27
  17362. }
  17363. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17364. return m_XML_TOK_INVALID
  17365. _18:
  17366. ;
  17367. if int64(end)-int64(ptr) < int64(4) {
  17368. return -int32(2)
  17369. }
  17370. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  17371. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17372. return m_XML_TOK_INVALID
  17373. }
  17374. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0 {
  17375. ptr += uintptr(4)
  17376. tok = int32(m_XML_TOK_NAME)
  17377. goto _27
  17378. }
  17379. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0 {
  17380. ptr += uintptr(4)
  17381. tok = int32(m_XML_TOK_NMTOKEN)
  17382. goto _27
  17383. }
  17384. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17385. return m_XML_TOK_INVALID
  17386. _20:
  17387. ;
  17388. _19:
  17389. ;
  17390. tok = int32(m_XML_TOK_NAME)
  17391. ptr += uintptr(1)
  17392. goto _27
  17393. _24:
  17394. ;
  17395. _23:
  17396. ;
  17397. _22:
  17398. ;
  17399. _21:
  17400. ;
  17401. tok = int32(m_XML_TOK_NMTOKEN)
  17402. ptr += uintptr(1)
  17403. goto _27
  17404. _25:
  17405. ;
  17406. if 0 != 0 {
  17407. ptr += uintptr(1)
  17408. tok = int32(m_XML_TOK_NAME)
  17409. goto _27
  17410. }
  17411. if 0 != 0 {
  17412. ptr += uintptr(1)
  17413. tok = int32(m_XML_TOK_NMTOKEN)
  17414. goto _27
  17415. }
  17416. /* fall through */
  17417. _26:
  17418. ;
  17419. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17420. return m_XML_TOK_INVALID
  17421. _27:
  17422. ;
  17423. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  17424. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  17425. case int32(_BT_NONASCII):
  17426. if !(libc.Int32FromInt32(0) != 0) {
  17427. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17428. return m_XML_TOK_INVALID
  17429. } /* fall through */
  17430. fallthrough
  17431. case int32(_BT_NMSTRT):
  17432. fallthrough
  17433. case int32(_BT_HEX):
  17434. fallthrough
  17435. case int32(_BT_DIGIT):
  17436. fallthrough
  17437. case int32(_BT_NAME):
  17438. fallthrough
  17439. case int32(_BT_MINUS):
  17440. ptr += uintptr(1)
  17441. case int32(_BT_LEAD2):
  17442. if int64(end)-int64(ptr) < int64(2) {
  17443. return -int32(2)
  17444. }
  17445. 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) {
  17446. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17447. return m_XML_TOK_INVALID
  17448. }
  17449. ptr += uintptr(2)
  17450. case int32(_BT_LEAD3):
  17451. if int64(end)-int64(ptr) < int64(3) {
  17452. return -int32(2)
  17453. }
  17454. 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) {
  17455. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17456. return m_XML_TOK_INVALID
  17457. }
  17458. ptr += uintptr(3)
  17459. case int32(_BT_LEAD4):
  17460. if int64(end)-int64(ptr) < int64(4) {
  17461. return -int32(2)
  17462. }
  17463. 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) {
  17464. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17465. return m_XML_TOK_INVALID
  17466. }
  17467. ptr += uintptr(4)
  17468. case int32(_BT_GT):
  17469. fallthrough
  17470. case int32(_BT_RPAR):
  17471. fallthrough
  17472. case int32(_BT_COMMA):
  17473. fallthrough
  17474. case int32(_BT_VERBAR):
  17475. fallthrough
  17476. case int32(_BT_LSQB):
  17477. fallthrough
  17478. case int32(_BT_PERCNT):
  17479. fallthrough
  17480. case int32(_BT_S):
  17481. fallthrough
  17482. case int32(_BT_CR):
  17483. fallthrough
  17484. case int32(_BT_LF):
  17485. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17486. return tok
  17487. case int32(_BT_COLON):
  17488. ptr += uintptr(1)
  17489. switch tok {
  17490. case int32(m_XML_TOK_NAME):
  17491. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  17492. return -int32(1)
  17493. }
  17494. tok = int32(m_XML_TOK_PREFIXED_NAME)
  17495. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  17496. case int32(_BT_NONASCII):
  17497. if !(libc.Int32FromInt32(0) != 0) {
  17498. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17499. return m_XML_TOK_INVALID
  17500. } /* fall through */
  17501. fallthrough
  17502. case int32(_BT_NMSTRT):
  17503. fallthrough
  17504. case int32(_BT_HEX):
  17505. fallthrough
  17506. case int32(_BT_DIGIT):
  17507. fallthrough
  17508. case int32(_BT_NAME):
  17509. fallthrough
  17510. case int32(_BT_MINUS):
  17511. ptr += uintptr(1)
  17512. case int32(_BT_LEAD2):
  17513. if int64(end)-int64(ptr) < int64(2) {
  17514. return -int32(2)
  17515. }
  17516. 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) {
  17517. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17518. return m_XML_TOK_INVALID
  17519. }
  17520. ptr += uintptr(2)
  17521. case int32(_BT_LEAD3):
  17522. if int64(end)-int64(ptr) < int64(3) {
  17523. return -int32(2)
  17524. }
  17525. 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) {
  17526. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17527. return m_XML_TOK_INVALID
  17528. }
  17529. ptr += uintptr(3)
  17530. case int32(_BT_LEAD4):
  17531. if int64(end)-int64(ptr) < int64(4) {
  17532. return -int32(2)
  17533. }
  17534. 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) {
  17535. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17536. return m_XML_TOK_INVALID
  17537. }
  17538. ptr += uintptr(4)
  17539. default:
  17540. tok = int32(m_XML_TOK_NMTOKEN)
  17541. break
  17542. }
  17543. case int32(m_XML_TOK_PREFIXED_NAME):
  17544. tok = int32(m_XML_TOK_NMTOKEN)
  17545. break
  17546. }
  17547. case int32(_BT_PLUS):
  17548. if tok == int32(m_XML_TOK_NMTOKEN) {
  17549. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17550. return m_XML_TOK_INVALID
  17551. }
  17552. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  17553. return int32(m_XML_TOK_NAME_PLUS)
  17554. case int32(_BT_AST):
  17555. if tok == int32(m_XML_TOK_NMTOKEN) {
  17556. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17557. return m_XML_TOK_INVALID
  17558. }
  17559. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  17560. return int32(m_XML_TOK_NAME_ASTERISK)
  17561. case int32(_BT_QUEST):
  17562. if tok == int32(m_XML_TOK_NMTOKEN) {
  17563. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17564. return m_XML_TOK_INVALID
  17565. }
  17566. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  17567. return int32(m_XML_TOK_NAME_QUESTION)
  17568. default:
  17569. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17570. return m_XML_TOK_INVALID
  17571. }
  17572. }
  17573. return -tok
  17574. }
  17575. func _normal_attributeValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  17576. var start uintptr
  17577. _ = start
  17578. if ptr >= end {
  17579. return -int32(4)
  17580. } else {
  17581. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  17582. /* This line cannot be executed. The incoming data has already
  17583. * been tokenized once, so incomplete characters like this have
  17584. * already been eliminated from the input. Retaining the paranoia
  17585. * check is still valuable, however.
  17586. */
  17587. return -int32(1) /* LCOV_EXCL_LINE */
  17588. }
  17589. }
  17590. start = ptr
  17591. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  17592. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  17593. case int32(_BT_LEAD2):
  17594. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  17595. case int32(_BT_LEAD3):
  17596. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  17597. case int32(_BT_LEAD4):
  17598. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  17599. case int32(_BT_AMP):
  17600. if ptr == start {
  17601. return _normal_scanRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  17602. }
  17603. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17604. return int32(m_XML_TOK_DATA_CHARS)
  17605. case int32(_BT_LT):
  17606. /* this is for inside entity references */
  17607. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17608. return m_XML_TOK_INVALID
  17609. case int32(_BT_LF):
  17610. if ptr == start {
  17611. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  17612. return int32(m_XML_TOK_DATA_NEWLINE)
  17613. }
  17614. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17615. return int32(m_XML_TOK_DATA_CHARS)
  17616. case int32(_BT_CR):
  17617. if ptr == start {
  17618. ptr += uintptr(1)
  17619. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  17620. return -int32(3)
  17621. }
  17622. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) == int32(_BT_LF) {
  17623. ptr += uintptr(1)
  17624. }
  17625. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17626. return int32(m_XML_TOK_DATA_NEWLINE)
  17627. }
  17628. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17629. return int32(m_XML_TOK_DATA_CHARS)
  17630. case int32(_BT_S):
  17631. if ptr == start {
  17632. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  17633. return int32(m_XML_TOK_ATTRIBUTE_VALUE_S)
  17634. }
  17635. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17636. return int32(m_XML_TOK_DATA_CHARS)
  17637. default:
  17638. ptr += uintptr(1)
  17639. break
  17640. }
  17641. }
  17642. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17643. return int32(m_XML_TOK_DATA_CHARS)
  17644. }
  17645. func _normal_entityValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  17646. var start uintptr
  17647. var tok, v1 int32
  17648. _, _, _ = start, tok, v1
  17649. if ptr >= end {
  17650. return -int32(4)
  17651. } else {
  17652. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  17653. /* This line cannot be executed. The incoming data has already
  17654. * been tokenized once, so incomplete characters like this have
  17655. * already been eliminated from the input. Retaining the paranoia
  17656. * check is still valuable, however.
  17657. */
  17658. return -int32(1) /* LCOV_EXCL_LINE */
  17659. }
  17660. }
  17661. start = ptr
  17662. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  17663. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  17664. case int32(_BT_LEAD2):
  17665. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  17666. case int32(_BT_LEAD3):
  17667. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  17668. case int32(_BT_LEAD4):
  17669. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  17670. case int32(_BT_AMP):
  17671. if ptr == start {
  17672. return _normal_scanRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  17673. }
  17674. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17675. return int32(m_XML_TOK_DATA_CHARS)
  17676. case int32(_BT_PERCNT):
  17677. if ptr == start {
  17678. tok = _normal_scanPercent(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  17679. if tok == int32(m_XML_TOK_PERCENT) {
  17680. v1 = m_XML_TOK_INVALID
  17681. } else {
  17682. v1 = tok
  17683. }
  17684. return v1
  17685. }
  17686. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17687. return int32(m_XML_TOK_DATA_CHARS)
  17688. case int32(_BT_LF):
  17689. if ptr == start {
  17690. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  17691. return int32(m_XML_TOK_DATA_NEWLINE)
  17692. }
  17693. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17694. return int32(m_XML_TOK_DATA_CHARS)
  17695. case int32(_BT_CR):
  17696. if ptr == start {
  17697. ptr += uintptr(1)
  17698. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  17699. return -int32(3)
  17700. }
  17701. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) == int32(_BT_LF) {
  17702. ptr += uintptr(1)
  17703. }
  17704. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17705. return int32(m_XML_TOK_DATA_NEWLINE)
  17706. }
  17707. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17708. return int32(m_XML_TOK_DATA_CHARS)
  17709. default:
  17710. ptr += uintptr(1)
  17711. break
  17712. }
  17713. }
  17714. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17715. return int32(m_XML_TOK_DATA_CHARS)
  17716. }
  17717. func _normal_ignoreSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  17718. var level int32
  17719. var n Tsize_t
  17720. _, _ = level, n
  17721. level = 0
  17722. if int32(1) > int32(1) {
  17723. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  17724. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  17725. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  17726. end = ptr + uintptr(n)
  17727. }
  17728. }
  17729. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  17730. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  17731. case int32(_BT_LEAD2):
  17732. if int64(end)-int64(ptr) < int64(2) {
  17733. return -int32(2)
  17734. }
  17735. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  17736. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17737. return m_XML_TOK_INVALID
  17738. }
  17739. ptr += uintptr(2)
  17740. case int32(_BT_LEAD3):
  17741. if int64(end)-int64(ptr) < int64(3) {
  17742. return -int32(2)
  17743. }
  17744. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  17745. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17746. return m_XML_TOK_INVALID
  17747. }
  17748. ptr += uintptr(3)
  17749. case int32(_BT_LEAD4):
  17750. if int64(end)-int64(ptr) < int64(4) {
  17751. return -int32(2)
  17752. }
  17753. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  17754. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17755. return m_XML_TOK_INVALID
  17756. }
  17757. ptr += uintptr(4)
  17758. case int32(_BT_NONXML):
  17759. fallthrough
  17760. case int32(_BT_MALFORM):
  17761. fallthrough
  17762. case int32(_BT_TRAIL):
  17763. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17764. return m_XML_TOK_INVALID
  17765. case int32(_BT_LT):
  17766. ptr += uintptr(1)
  17767. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  17768. return -int32(1)
  17769. }
  17770. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_EXCL2) {
  17771. ptr += uintptr(1)
  17772. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  17773. return -int32(1)
  17774. }
  17775. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_LSQB1) {
  17776. level++
  17777. ptr += uintptr(1)
  17778. }
  17779. }
  17780. case int32(_BT_RSQB):
  17781. ptr += uintptr(1)
  17782. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  17783. return -int32(1)
  17784. }
  17785. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  17786. ptr += uintptr(1)
  17787. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  17788. return -int32(1)
  17789. }
  17790. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  17791. ptr += uintptr(1)
  17792. if level == 0 {
  17793. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17794. return int32(m_XML_TOK_IGNORE_SECT)
  17795. }
  17796. level--
  17797. }
  17798. }
  17799. default:
  17800. ptr += uintptr(1)
  17801. break
  17802. }
  17803. }
  17804. return -int32(1)
  17805. }
  17806. func _normal_isPublicId(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr) (r int32) {
  17807. ptr += uintptr(1)
  17808. end -= uintptr(1)
  17809. for {
  17810. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  17811. break
  17812. }
  17813. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  17814. case int32(_BT_DIGIT):
  17815. fallthrough
  17816. case int32(_BT_HEX):
  17817. fallthrough
  17818. case int32(_BT_MINUS):
  17819. fallthrough
  17820. case int32(_BT_APOS):
  17821. fallthrough
  17822. case int32(_BT_LPAR):
  17823. fallthrough
  17824. case int32(_BT_RPAR):
  17825. fallthrough
  17826. case int32(_BT_PLUS):
  17827. fallthrough
  17828. case int32(_BT_COMMA):
  17829. fallthrough
  17830. case int32(_BT_SOL):
  17831. fallthrough
  17832. case int32(_BT_EQUALS):
  17833. fallthrough
  17834. case int32(_BT_QUEST):
  17835. fallthrough
  17836. case int32(_BT_CR):
  17837. fallthrough
  17838. case int32(_BT_LF):
  17839. fallthrough
  17840. case int32(_BT_SEMI):
  17841. fallthrough
  17842. case int32(_BT_EXCL):
  17843. fallthrough
  17844. case int32(_BT_AST):
  17845. fallthrough
  17846. case int32(_BT_PERCNT):
  17847. fallthrough
  17848. case int32(_BT_NUM):
  17849. fallthrough
  17850. case int32(_BT_COLON):
  17851. case int32(_BT_S):
  17852. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_TAB1) {
  17853. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  17854. return 0
  17855. }
  17856. case int32(_BT_NAME):
  17857. fallthrough
  17858. case int32(_BT_NMSTRT):
  17859. if !(int32(*(*int8)(unsafe.Pointer(ptr))) & ^libc.Int32FromInt32(0x7f) != 0) {
  17860. break
  17861. }
  17862. /* fall through */
  17863. fallthrough
  17864. default:
  17865. switch int32(*(*int8)(unsafe.Pointer(ptr))) {
  17866. case int32(0x24): /* $ */
  17867. fallthrough
  17868. case int32(0x40): /* @ */
  17869. default:
  17870. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  17871. return 0
  17872. }
  17873. break
  17874. }
  17875. goto _1
  17876. _1:
  17877. ;
  17878. ptr += uintptr(1)
  17879. }
  17880. return int32(1)
  17881. }
  17882. /* This must only be called for a well-formed start-tag or empty
  17883. element tag. Returns the number of attributes. Pointers to the
  17884. first attsMax attributes are stored in atts.
  17885. */
  17886. func _normal_getAtts(tls *libc.TLS, enc uintptr, ptr uintptr, attsMax int32, atts uintptr) (r int32) {
  17887. var nAtts, open, state int32
  17888. _, _, _ = nAtts, open, state
  17889. state = 1
  17890. nAtts = 0
  17891. open = 0 /* defined when state == inValue;
  17892. initialization just to shut up compilers */
  17893. ptr += uintptr(1)
  17894. for {
  17895. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  17896. case int32(_BT_LEAD2):
  17897. if state == 0 {
  17898. if nAtts < attsMax {
  17899. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  17900. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  17901. }
  17902. state = 1
  17903. }
  17904. ptr += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(1))
  17905. case int32(_BT_LEAD3):
  17906. if state == 0 {
  17907. if nAtts < attsMax {
  17908. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  17909. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  17910. }
  17911. state = 1
  17912. }
  17913. ptr += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(1))
  17914. case int32(_BT_LEAD4):
  17915. if state == 0 {
  17916. if nAtts < attsMax {
  17917. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  17918. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  17919. }
  17920. state = 1
  17921. }
  17922. ptr += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(1))
  17923. case int32(_BT_NONASCII):
  17924. fallthrough
  17925. case int32(_BT_NMSTRT):
  17926. fallthrough
  17927. case int32(_BT_HEX):
  17928. if state == 0 {
  17929. if nAtts < attsMax {
  17930. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  17931. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  17932. }
  17933. state = 1
  17934. }
  17935. case int32(_BT_QUOT):
  17936. if state != 2 {
  17937. if nAtts < attsMax {
  17938. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(1)
  17939. }
  17940. state = 2
  17941. open = int32(_BT_QUOT)
  17942. } else {
  17943. if open == int32(_BT_QUOT) {
  17944. state = 0
  17945. if nAtts < attsMax {
  17946. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  17947. }
  17948. nAtts++
  17949. }
  17950. }
  17951. case int32(_BT_APOS):
  17952. if state != 2 {
  17953. if nAtts < attsMax {
  17954. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(1)
  17955. }
  17956. state = 2
  17957. open = int32(_BT_APOS)
  17958. } else {
  17959. if open == int32(_BT_APOS) {
  17960. state = 0
  17961. if nAtts < attsMax {
  17962. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  17963. }
  17964. nAtts++
  17965. }
  17966. }
  17967. case int32(_BT_AMP):
  17968. if nAtts < attsMax {
  17969. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  17970. }
  17971. case int32(_BT_S):
  17972. if state == 1 {
  17973. state = 0
  17974. } else {
  17975. if state == 2 && nAtts < attsMax && (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized != 0 && (ptr == (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr || int32(*(*int8)(unsafe.Pointer(ptr))) != int32(m_ASCII_SPACE1) || int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == int32(m_ASCII_SPACE1) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))))))) == open) {
  17976. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  17977. }
  17978. }
  17979. case int32(_BT_CR):
  17980. fallthrough
  17981. case int32(_BT_LF):
  17982. /* This case ensures that the first attribute name is counted
  17983. Apart from that we could just change state on the quote. */
  17984. if state == 1 {
  17985. state = 0
  17986. } else {
  17987. if state == 2 && nAtts < attsMax {
  17988. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  17989. }
  17990. }
  17991. case int32(_BT_GT):
  17992. fallthrough
  17993. case int32(_BT_SOL):
  17994. if state != 2 {
  17995. return nAtts
  17996. }
  17997. default:
  17998. break
  17999. }
  18000. goto _1
  18001. _1:
  18002. ;
  18003. ptr += uintptr(1)
  18004. }
  18005. /* not reached */
  18006. return r
  18007. }
  18008. func _normal_charRefNumber(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  18009. var c, c1, result int32
  18010. _, _, _ = c, c1, result
  18011. result = 0
  18012. /* skip &# */
  18013. _ = enc
  18014. ptr += uintptr(libc.Int32FromInt32(2) * libc.Int32FromInt32(1))
  18015. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  18016. ptr += uintptr(1)
  18017. for {
  18018. if !!(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_SEMI1)) {
  18019. break
  18020. }
  18021. c = int32(*(*int8)(unsafe.Pointer(ptr)))
  18022. switch c {
  18023. case int32(m_ASCII_02):
  18024. fallthrough
  18025. case int32(m_ASCII_12):
  18026. fallthrough
  18027. case int32(m_ASCII_22):
  18028. fallthrough
  18029. case int32(m_ASCII_32):
  18030. fallthrough
  18031. case int32(m_ASCII_41):
  18032. fallthrough
  18033. case int32(m_ASCII_51):
  18034. fallthrough
  18035. case int32(m_ASCII_61):
  18036. fallthrough
  18037. case int32(m_ASCII_71):
  18038. fallthrough
  18039. case int32(m_ASCII_82):
  18040. fallthrough
  18041. case int32(m_ASCII_92):
  18042. result <<= int32(4)
  18043. result |= c - int32(m_ASCII_02)
  18044. case int32(m_ASCII_A):
  18045. fallthrough
  18046. case int32(m_ASCII_B1):
  18047. fallthrough
  18048. case int32(m_ASCII_C):
  18049. fallthrough
  18050. case int32(m_ASCII_D):
  18051. fallthrough
  18052. case int32(m_ASCII_E):
  18053. fallthrough
  18054. case int32(m_ASCII_F):
  18055. result <<= int32(4)
  18056. result += int32(10) + (c - int32(m_ASCII_A))
  18057. case int32(m_ASCII_a2):
  18058. fallthrough
  18059. case int32(m_ASCII_b1):
  18060. fallthrough
  18061. case int32(m_ASCII_c2):
  18062. fallthrough
  18063. case int32(m_ASCII_d1):
  18064. fallthrough
  18065. case int32(m_ASCII_e2):
  18066. fallthrough
  18067. case int32(m_ASCII_f1):
  18068. result <<= int32(4)
  18069. result += int32(10) + (c - int32(m_ASCII_a2))
  18070. break
  18071. }
  18072. if result >= int32(0x110000) {
  18073. return -int32(1)
  18074. }
  18075. goto _1
  18076. _1:
  18077. ;
  18078. ptr += uintptr(1)
  18079. }
  18080. } else {
  18081. for {
  18082. if !!(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_SEMI1)) {
  18083. break
  18084. }
  18085. c1 = int32(*(*int8)(unsafe.Pointer(ptr)))
  18086. result *= int32(10)
  18087. result += c1 - int32(m_ASCII_02)
  18088. if result >= int32(0x110000) {
  18089. return -int32(1)
  18090. }
  18091. goto _2
  18092. _2:
  18093. ;
  18094. ptr += uintptr(1)
  18095. }
  18096. }
  18097. return _checkCharRefNumber(tls, result)
  18098. }
  18099. func _normal_predefinedEntityName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr) (r int32) {
  18100. _ = enc
  18101. switch (int64(end) - int64(ptr)) / libc.Int64FromInt32(1) {
  18102. case int64(2):
  18103. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == int32(m_ASCII_t2) {
  18104. switch int32(*(*int8)(unsafe.Pointer(ptr))) {
  18105. case int32(m_ASCII_l2):
  18106. return int32(m_ASCII_LT1)
  18107. case int32(m_ASCII_g2):
  18108. return int32(m_ASCII_GT1)
  18109. }
  18110. }
  18111. case int64(3):
  18112. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_a2) {
  18113. ptr += uintptr(1)
  18114. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_m2) {
  18115. ptr += uintptr(1)
  18116. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  18117. return int32(m_ASCII_AMP1)
  18118. }
  18119. }
  18120. }
  18121. case int64(4):
  18122. switch int32(*(*int8)(unsafe.Pointer(ptr))) {
  18123. case int32(m_ASCII_q1):
  18124. ptr += uintptr(1)
  18125. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_u1) {
  18126. ptr += uintptr(1)
  18127. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  18128. ptr += uintptr(1)
  18129. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_t2) {
  18130. return int32(m_ASCII_QUOT1)
  18131. }
  18132. }
  18133. }
  18134. case int32(m_ASCII_a2):
  18135. ptr += uintptr(1)
  18136. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  18137. ptr += uintptr(1)
  18138. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  18139. ptr += uintptr(1)
  18140. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_s2) {
  18141. return int32(m_ASCII_APOS1)
  18142. }
  18143. }
  18144. }
  18145. break
  18146. }
  18147. }
  18148. return 0
  18149. }
  18150. func _normal_nameMatchesAscii(tls *libc.TLS, enc uintptr, ptr1 uintptr, end1 uintptr, ptr2 uintptr) (r int32) {
  18151. _ = enc
  18152. for {
  18153. if !(*(*int8)(unsafe.Pointer(ptr2)) != 0) {
  18154. break
  18155. }
  18156. if int64(end1)-int64(ptr1) < int64(1) {
  18157. /* This line cannot be executed. The incoming data has already
  18158. * been tokenized once, so incomplete characters like this have
  18159. * already been eliminated from the input. Retaining the
  18160. * paranoia check is still valuable, however.
  18161. */
  18162. return 0 /* LCOV_EXCL_LINE */
  18163. }
  18164. if !(int32(*(*int8)(unsafe.Pointer(ptr1))) == int32(*(*int8)(unsafe.Pointer(ptr2)))) {
  18165. return 0
  18166. }
  18167. goto _1
  18168. _1:
  18169. ;
  18170. ptr1 += uintptr(1)
  18171. ptr2++
  18172. }
  18173. return libc.BoolInt32(ptr1 == end1)
  18174. }
  18175. func _normal_nameLength(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  18176. var start uintptr
  18177. _ = start
  18178. start = ptr
  18179. for {
  18180. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  18181. case int32(_BT_LEAD2):
  18182. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  18183. case int32(_BT_LEAD3):
  18184. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  18185. case int32(_BT_LEAD4):
  18186. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  18187. case int32(_BT_NONASCII):
  18188. fallthrough
  18189. case int32(_BT_NMSTRT):
  18190. fallthrough
  18191. case int32(_BT_COLON):
  18192. fallthrough
  18193. case int32(_BT_HEX):
  18194. fallthrough
  18195. case int32(_BT_DIGIT):
  18196. fallthrough
  18197. case int32(_BT_NAME):
  18198. fallthrough
  18199. case int32(_BT_MINUS):
  18200. ptr += uintptr(1)
  18201. default:
  18202. return int32(int64(ptr) - int64(start))
  18203. }
  18204. goto _1
  18205. _1:
  18206. }
  18207. return r
  18208. }
  18209. func _normal_skipS(tls *libc.TLS, enc uintptr, ptr uintptr) (r uintptr) {
  18210. for {
  18211. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  18212. case int32(_BT_LF):
  18213. fallthrough
  18214. case int32(_BT_CR):
  18215. fallthrough
  18216. case int32(_BT_S):
  18217. ptr += uintptr(1)
  18218. default:
  18219. return ptr
  18220. }
  18221. goto _1
  18222. _1:
  18223. }
  18224. return r
  18225. }
  18226. func _normal_updatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  18227. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  18228. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  18229. case int32(_BT_LEAD2):
  18230. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  18231. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  18232. case int32(_BT_LEAD3):
  18233. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  18234. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  18235. case int32(_BT_LEAD4):
  18236. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  18237. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  18238. case int32(_BT_LF):
  18239. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  18240. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  18241. ptr += uintptr(1)
  18242. case int32(_BT_CR):
  18243. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  18244. ptr += uintptr(1)
  18245. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) == int32(_BT_LF) {
  18246. ptr += uintptr(1)
  18247. }
  18248. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  18249. default:
  18250. ptr += uintptr(1)
  18251. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  18252. break
  18253. }
  18254. }
  18255. }
  18256. const /* UTF8_cvalN is value of masked first byte of N byte sequence */
  18257. _UTF8_cval1 = 0
  18258. const _UTF8_cval2 = 192
  18259. const _UTF8_cval3 = 224
  18260. const _UTF8_cval4 = 240
  18261. func X_INTERNAL_trim_to_complete_utf8_characters(tls *libc.TLS, from uintptr, fromLimRef uintptr) {
  18262. var fromLim uintptr
  18263. var prev uint8
  18264. var walked Tsize_t
  18265. _, _, _ = fromLim, prev, walked
  18266. fromLim = *(*uintptr)(unsafe.Pointer(fromLimRef))
  18267. walked = uint64(0)
  18268. for {
  18269. if !(fromLim > from) {
  18270. break
  18271. }
  18272. prev = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(fromLim + uintptr(-libc.Int32FromInt32(1)))))
  18273. if uint32(prev)&uint32(0xf8) == uint32(0xf0) { /* 4-byte character, lead by 0b11110xxx byte */
  18274. if walked+uint64(1) >= uint64(4) {
  18275. fromLim += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(1))
  18276. break
  18277. } else {
  18278. walked = uint64(0)
  18279. }
  18280. } else {
  18281. if uint32(prev)&uint32(0xf0) == uint32(0xe0) { /* 3-byte character, lead by 0b1110xxxx byte */
  18282. if walked+uint64(1) >= uint64(3) {
  18283. fromLim += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(1))
  18284. break
  18285. } else {
  18286. walked = uint64(0)
  18287. }
  18288. } else {
  18289. if uint32(prev)&uint32(0xe0) == uint32(0xc0) { /* 2-byte character, lead by 0b110xxxxx byte */
  18290. if walked+uint64(1) >= uint64(2) {
  18291. fromLim += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(1))
  18292. break
  18293. } else {
  18294. walked = uint64(0)
  18295. }
  18296. } else {
  18297. if uint32(prev)&uint32(0x80) == 0x00 { /* 1-byte character, matching 0b0xxxxxxx */
  18298. break
  18299. }
  18300. }
  18301. }
  18302. }
  18303. goto _1
  18304. _1:
  18305. ;
  18306. fromLim--
  18307. walked++
  18308. }
  18309. *(*uintptr)(unsafe.Pointer(fromLimRef)) = fromLim
  18310. }
  18311. func _utf8_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, _fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18312. bp := tls.Alloc(16)
  18313. defer tls.Free(16)
  18314. *(*uintptr)(unsafe.Pointer(bp)) = _fromLim
  18315. var bytesAvailable, bytesStorable, bytesToCopy Tptrdiff_t
  18316. var fromLimBefore uintptr
  18317. var input_incomplete, output_exhausted uint8
  18318. _, _, _, _, _, _ = bytesAvailable, bytesStorable, bytesToCopy, fromLimBefore, input_incomplete, output_exhausted
  18319. input_incomplete = uint8(m_false)
  18320. output_exhausted = uint8(m_false)
  18321. /* Avoid copying partial characters (due to limited space). */
  18322. bytesAvailable = int64(*(*uintptr)(unsafe.Pointer(bp))) - int64(*(*uintptr)(unsafe.Pointer(fromP)))
  18323. bytesStorable = int64(toLim) - int64(*(*uintptr)(unsafe.Pointer(toP)))
  18324. _ = enc
  18325. if bytesAvailable > bytesStorable {
  18326. *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(fromP)) + uintptr(bytesStorable)
  18327. output_exhausted = uint8(m_true)
  18328. }
  18329. /* Avoid copying partial characters (from incomplete input). */
  18330. fromLimBefore = *(*uintptr)(unsafe.Pointer(bp))
  18331. X_INTERNAL_trim_to_complete_utf8_characters(tls, *(*uintptr)(unsafe.Pointer(fromP)), bp)
  18332. if *(*uintptr)(unsafe.Pointer(bp)) < fromLimBefore {
  18333. input_incomplete = uint8(m_true)
  18334. }
  18335. bytesToCopy = int64(*(*uintptr)(unsafe.Pointer(bp))) - int64(*(*uintptr)(unsafe.Pointer(fromP)))
  18336. libc.X__builtin___memcpy_chk(tls, *(*uintptr)(unsafe.Pointer(toP)), *(*uintptr)(unsafe.Pointer(fromP)), libc.Uint64FromInt64(bytesToCopy), ^t__predefined_size_t(0))
  18337. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(bytesToCopy)
  18338. *(*uintptr)(unsafe.Pointer(toP)) += uintptr(bytesToCopy)
  18339. if output_exhausted != 0 { /* needs to go first */
  18340. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18341. } else {
  18342. if input_incomplete != 0 {
  18343. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18344. } else {
  18345. return int32(_XML_CONVERT_COMPLETED)
  18346. }
  18347. }
  18348. return r
  18349. }
  18350. func _utf8_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18351. var from, to, v1, v2, v3, v4 uintptr
  18352. var n uint64
  18353. var res _XML_Convert_Result
  18354. _, _, _, _, _, _, _, _ = from, n, res, to, v1, v2, v3, v4
  18355. res = int32(_XML_CONVERT_COMPLETED)
  18356. to = *(*uintptr)(unsafe.Pointer(toP))
  18357. from = *(*uintptr)(unsafe.Pointer(fromP))
  18358. for from < fromLim && to < toLim {
  18359. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from))))))) {
  18360. case int32(_BT_LEAD2):
  18361. if int64(fromLim)-int64(from) < int64(2) {
  18362. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18363. goto after
  18364. }
  18365. v1 = to
  18366. to += 2
  18367. *(*uint16)(unsafe.Pointer(v1)) = libc.Uint16FromInt32(int32(*(*int8)(unsafe.Pointer(from)))&libc.Int32FromInt32(0x1f)<<libc.Int32FromInt32(6) | int32(*(*int8)(unsafe.Pointer(from + 1)))&libc.Int32FromInt32(0x3f))
  18368. from += uintptr(2)
  18369. case int32(_BT_LEAD3):
  18370. if int64(fromLim)-int64(from) < int64(3) {
  18371. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18372. goto after
  18373. }
  18374. v2 = to
  18375. to += 2
  18376. *(*uint16)(unsafe.Pointer(v2)) = libc.Uint16FromInt32(int32(*(*int8)(unsafe.Pointer(from)))&libc.Int32FromInt32(0xf)<<libc.Int32FromInt32(12) | int32(*(*int8)(unsafe.Pointer(from + 1)))&libc.Int32FromInt32(0x3f)<<libc.Int32FromInt32(6) | int32(*(*int8)(unsafe.Pointer(from + 2)))&libc.Int32FromInt32(0x3f))
  18377. from += uintptr(3)
  18378. case int32(_BT_LEAD4):
  18379. if (int64(toLim)-int64(to))/2 < int64(2) {
  18380. res = int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18381. goto after
  18382. }
  18383. if int64(fromLim)-int64(from) < int64(4) {
  18384. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18385. goto after
  18386. }
  18387. n = libc.Uint64FromInt32(int32(*(*int8)(unsafe.Pointer(from)))&int32(0x7)<<int32(18) | int32(*(*int8)(unsafe.Pointer(from + 1)))&int32(0x3f)<<int32(12) | int32(*(*int8)(unsafe.Pointer(from + 2)))&int32(0x3f)<<int32(6) | int32(*(*int8)(unsafe.Pointer(from + 3)))&int32(0x3f))
  18388. n -= uint64(0x10000)
  18389. *(*uint16)(unsafe.Pointer(to)) = uint16(n>>libc.Int32FromInt32(10) | libc.Uint64FromInt32(0xD800))
  18390. *(*uint16)(unsafe.Pointer(to + 1*2)) = uint16(n&libc.Uint64FromInt32(0x3FF) | libc.Uint64FromInt32(0xDC00))
  18391. to += uintptr(2) * 2
  18392. from += uintptr(4)
  18393. default:
  18394. v3 = to
  18395. to += 2
  18396. v4 = from
  18397. from++
  18398. *(*uint16)(unsafe.Pointer(v3)) = libc.Uint16FromInt8(*(*int8)(unsafe.Pointer(v4)))
  18399. break
  18400. }
  18401. }
  18402. if from < fromLim {
  18403. res = int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18404. }
  18405. goto after
  18406. after:
  18407. ;
  18408. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18409. *(*uintptr)(unsafe.Pointer(toP)) = to
  18410. return res
  18411. }
  18412. var _utf8_encoding_ns = Tnormal_encoding{
  18413. Fenc: TENCODING{
  18414. Fscanners: [4]TSCANNER{},
  18415. FliteralScanners: [2]TSCANNER{},
  18416. FminBytesPerChar: int32(1),
  18417. FisUtf8: int8(1),
  18418. },
  18419. Ftype1: [256]uint8{
  18420. 9: uint8(_BT_S),
  18421. 10: uint8(_BT_LF),
  18422. 13: uint8(_BT_CR),
  18423. 32: uint8(_BT_S),
  18424. 33: uint8(_BT_EXCL),
  18425. 34: uint8(_BT_QUOT),
  18426. 35: uint8(_BT_NUM),
  18427. 36: uint8(_BT_OTHER),
  18428. 37: uint8(_BT_PERCNT),
  18429. 38: uint8(_BT_AMP),
  18430. 39: uint8(_BT_APOS),
  18431. 40: uint8(_BT_LPAR),
  18432. 41: uint8(_BT_RPAR),
  18433. 42: uint8(_BT_AST),
  18434. 43: uint8(_BT_PLUS),
  18435. 44: uint8(_BT_COMMA),
  18436. 45: uint8(_BT_MINUS),
  18437. 46: uint8(_BT_NAME),
  18438. 47: uint8(_BT_SOL),
  18439. 48: uint8(_BT_DIGIT),
  18440. 49: uint8(_BT_DIGIT),
  18441. 50: uint8(_BT_DIGIT),
  18442. 51: uint8(_BT_DIGIT),
  18443. 52: uint8(_BT_DIGIT),
  18444. 53: uint8(_BT_DIGIT),
  18445. 54: uint8(_BT_DIGIT),
  18446. 55: uint8(_BT_DIGIT),
  18447. 56: uint8(_BT_DIGIT),
  18448. 57: uint8(_BT_DIGIT),
  18449. 58: uint8(_BT_COLON),
  18450. 59: uint8(_BT_SEMI),
  18451. 60: uint8(_BT_LT),
  18452. 61: uint8(_BT_EQUALS),
  18453. 62: uint8(_BT_GT),
  18454. 63: uint8(_BT_QUEST),
  18455. 64: uint8(_BT_OTHER),
  18456. 65: uint8(_BT_HEX),
  18457. 66: uint8(_BT_HEX),
  18458. 67: uint8(_BT_HEX),
  18459. 68: uint8(_BT_HEX),
  18460. 69: uint8(_BT_HEX),
  18461. 70: uint8(_BT_HEX),
  18462. 71: uint8(_BT_NMSTRT),
  18463. 72: uint8(_BT_NMSTRT),
  18464. 73: uint8(_BT_NMSTRT),
  18465. 74: uint8(_BT_NMSTRT),
  18466. 75: uint8(_BT_NMSTRT),
  18467. 76: uint8(_BT_NMSTRT),
  18468. 77: uint8(_BT_NMSTRT),
  18469. 78: uint8(_BT_NMSTRT),
  18470. 79: uint8(_BT_NMSTRT),
  18471. 80: uint8(_BT_NMSTRT),
  18472. 81: uint8(_BT_NMSTRT),
  18473. 82: uint8(_BT_NMSTRT),
  18474. 83: uint8(_BT_NMSTRT),
  18475. 84: uint8(_BT_NMSTRT),
  18476. 85: uint8(_BT_NMSTRT),
  18477. 86: uint8(_BT_NMSTRT),
  18478. 87: uint8(_BT_NMSTRT),
  18479. 88: uint8(_BT_NMSTRT),
  18480. 89: uint8(_BT_NMSTRT),
  18481. 90: uint8(_BT_NMSTRT),
  18482. 91: uint8(_BT_LSQB),
  18483. 92: uint8(_BT_OTHER),
  18484. 93: uint8(_BT_RSQB),
  18485. 94: uint8(_BT_OTHER),
  18486. 95: uint8(_BT_NMSTRT),
  18487. 96: uint8(_BT_OTHER),
  18488. 97: uint8(_BT_HEX),
  18489. 98: uint8(_BT_HEX),
  18490. 99: uint8(_BT_HEX),
  18491. 100: uint8(_BT_HEX),
  18492. 101: uint8(_BT_HEX),
  18493. 102: uint8(_BT_HEX),
  18494. 103: uint8(_BT_NMSTRT),
  18495. 104: uint8(_BT_NMSTRT),
  18496. 105: uint8(_BT_NMSTRT),
  18497. 106: uint8(_BT_NMSTRT),
  18498. 107: uint8(_BT_NMSTRT),
  18499. 108: uint8(_BT_NMSTRT),
  18500. 109: uint8(_BT_NMSTRT),
  18501. 110: uint8(_BT_NMSTRT),
  18502. 111: uint8(_BT_NMSTRT),
  18503. 112: uint8(_BT_NMSTRT),
  18504. 113: uint8(_BT_NMSTRT),
  18505. 114: uint8(_BT_NMSTRT),
  18506. 115: uint8(_BT_NMSTRT),
  18507. 116: uint8(_BT_NMSTRT),
  18508. 117: uint8(_BT_NMSTRT),
  18509. 118: uint8(_BT_NMSTRT),
  18510. 119: uint8(_BT_NMSTRT),
  18511. 120: uint8(_BT_NMSTRT),
  18512. 121: uint8(_BT_NMSTRT),
  18513. 122: uint8(_BT_NMSTRT),
  18514. 123: uint8(_BT_OTHER),
  18515. 124: uint8(_BT_VERBAR),
  18516. 125: uint8(_BT_OTHER),
  18517. 126: uint8(_BT_OTHER),
  18518. 127: uint8(_BT_OTHER),
  18519. 128: uint8(_BT_TRAIL),
  18520. 129: uint8(_BT_TRAIL),
  18521. 130: uint8(_BT_TRAIL),
  18522. 131: uint8(_BT_TRAIL),
  18523. 132: uint8(_BT_TRAIL),
  18524. 133: uint8(_BT_TRAIL),
  18525. 134: uint8(_BT_TRAIL),
  18526. 135: uint8(_BT_TRAIL),
  18527. 136: uint8(_BT_TRAIL),
  18528. 137: uint8(_BT_TRAIL),
  18529. 138: uint8(_BT_TRAIL),
  18530. 139: uint8(_BT_TRAIL),
  18531. 140: uint8(_BT_TRAIL),
  18532. 141: uint8(_BT_TRAIL),
  18533. 142: uint8(_BT_TRAIL),
  18534. 143: uint8(_BT_TRAIL),
  18535. 144: uint8(_BT_TRAIL),
  18536. 145: uint8(_BT_TRAIL),
  18537. 146: uint8(_BT_TRAIL),
  18538. 147: uint8(_BT_TRAIL),
  18539. 148: uint8(_BT_TRAIL),
  18540. 149: uint8(_BT_TRAIL),
  18541. 150: uint8(_BT_TRAIL),
  18542. 151: uint8(_BT_TRAIL),
  18543. 152: uint8(_BT_TRAIL),
  18544. 153: uint8(_BT_TRAIL),
  18545. 154: uint8(_BT_TRAIL),
  18546. 155: uint8(_BT_TRAIL),
  18547. 156: uint8(_BT_TRAIL),
  18548. 157: uint8(_BT_TRAIL),
  18549. 158: uint8(_BT_TRAIL),
  18550. 159: uint8(_BT_TRAIL),
  18551. 160: uint8(_BT_TRAIL),
  18552. 161: uint8(_BT_TRAIL),
  18553. 162: uint8(_BT_TRAIL),
  18554. 163: uint8(_BT_TRAIL),
  18555. 164: uint8(_BT_TRAIL),
  18556. 165: uint8(_BT_TRAIL),
  18557. 166: uint8(_BT_TRAIL),
  18558. 167: uint8(_BT_TRAIL),
  18559. 168: uint8(_BT_TRAIL),
  18560. 169: uint8(_BT_TRAIL),
  18561. 170: uint8(_BT_TRAIL),
  18562. 171: uint8(_BT_TRAIL),
  18563. 172: uint8(_BT_TRAIL),
  18564. 173: uint8(_BT_TRAIL),
  18565. 174: uint8(_BT_TRAIL),
  18566. 175: uint8(_BT_TRAIL),
  18567. 176: uint8(_BT_TRAIL),
  18568. 177: uint8(_BT_TRAIL),
  18569. 178: uint8(_BT_TRAIL),
  18570. 179: uint8(_BT_TRAIL),
  18571. 180: uint8(_BT_TRAIL),
  18572. 181: uint8(_BT_TRAIL),
  18573. 182: uint8(_BT_TRAIL),
  18574. 183: uint8(_BT_TRAIL),
  18575. 184: uint8(_BT_TRAIL),
  18576. 185: uint8(_BT_TRAIL),
  18577. 186: uint8(_BT_TRAIL),
  18578. 187: uint8(_BT_TRAIL),
  18579. 188: uint8(_BT_TRAIL),
  18580. 189: uint8(_BT_TRAIL),
  18581. 190: uint8(_BT_TRAIL),
  18582. 191: uint8(_BT_TRAIL),
  18583. 192: uint8(_BT_LEAD2),
  18584. 193: uint8(_BT_LEAD2),
  18585. 194: uint8(_BT_LEAD2),
  18586. 195: uint8(_BT_LEAD2),
  18587. 196: uint8(_BT_LEAD2),
  18588. 197: uint8(_BT_LEAD2),
  18589. 198: uint8(_BT_LEAD2),
  18590. 199: uint8(_BT_LEAD2),
  18591. 200: uint8(_BT_LEAD2),
  18592. 201: uint8(_BT_LEAD2),
  18593. 202: uint8(_BT_LEAD2),
  18594. 203: uint8(_BT_LEAD2),
  18595. 204: uint8(_BT_LEAD2),
  18596. 205: uint8(_BT_LEAD2),
  18597. 206: uint8(_BT_LEAD2),
  18598. 207: uint8(_BT_LEAD2),
  18599. 208: uint8(_BT_LEAD2),
  18600. 209: uint8(_BT_LEAD2),
  18601. 210: uint8(_BT_LEAD2),
  18602. 211: uint8(_BT_LEAD2),
  18603. 212: uint8(_BT_LEAD2),
  18604. 213: uint8(_BT_LEAD2),
  18605. 214: uint8(_BT_LEAD2),
  18606. 215: uint8(_BT_LEAD2),
  18607. 216: uint8(_BT_LEAD2),
  18608. 217: uint8(_BT_LEAD2),
  18609. 218: uint8(_BT_LEAD2),
  18610. 219: uint8(_BT_LEAD2),
  18611. 220: uint8(_BT_LEAD2),
  18612. 221: uint8(_BT_LEAD2),
  18613. 222: uint8(_BT_LEAD2),
  18614. 223: uint8(_BT_LEAD2),
  18615. 224: uint8(_BT_LEAD3),
  18616. 225: uint8(_BT_LEAD3),
  18617. 226: uint8(_BT_LEAD3),
  18618. 227: uint8(_BT_LEAD3),
  18619. 228: uint8(_BT_LEAD3),
  18620. 229: uint8(_BT_LEAD3),
  18621. 230: uint8(_BT_LEAD3),
  18622. 231: uint8(_BT_LEAD3),
  18623. 232: uint8(_BT_LEAD3),
  18624. 233: uint8(_BT_LEAD3),
  18625. 234: uint8(_BT_LEAD3),
  18626. 235: uint8(_BT_LEAD3),
  18627. 236: uint8(_BT_LEAD3),
  18628. 237: uint8(_BT_LEAD3),
  18629. 238: uint8(_BT_LEAD3),
  18630. 239: uint8(_BT_LEAD3),
  18631. 240: uint8(_BT_LEAD4),
  18632. 241: uint8(_BT_LEAD4),
  18633. 242: uint8(_BT_LEAD4),
  18634. 243: uint8(_BT_LEAD4),
  18635. 244: uint8(_BT_LEAD4),
  18636. 254: uint8(_BT_MALFORM),
  18637. 255: uint8(_BT_MALFORM),
  18638. },
  18639. }
  18640. func init() {
  18641. p := unsafe.Pointer(&_utf8_encoding_ns)
  18642. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  18643. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  18644. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  18645. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  18646. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  18647. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  18648. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  18649. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  18650. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  18651. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  18652. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  18653. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  18654. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  18655. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  18656. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  18657. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  18658. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  18659. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  18660. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  18661. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  18662. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  18663. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  18664. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  18665. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  18666. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  18667. }
  18668. var _utf8_encoding = Tnormal_encoding{
  18669. Fenc: TENCODING{
  18670. Fscanners: [4]TSCANNER{},
  18671. FliteralScanners: [2]TSCANNER{},
  18672. FminBytesPerChar: int32(1),
  18673. FisUtf8: int8(1),
  18674. },
  18675. Ftype1: [256]uint8{
  18676. 9: uint8(_BT_S),
  18677. 10: uint8(_BT_LF),
  18678. 13: uint8(_BT_CR),
  18679. 32: uint8(_BT_S),
  18680. 33: uint8(_BT_EXCL),
  18681. 34: uint8(_BT_QUOT),
  18682. 35: uint8(_BT_NUM),
  18683. 36: uint8(_BT_OTHER),
  18684. 37: uint8(_BT_PERCNT),
  18685. 38: uint8(_BT_AMP),
  18686. 39: uint8(_BT_APOS),
  18687. 40: uint8(_BT_LPAR),
  18688. 41: uint8(_BT_RPAR),
  18689. 42: uint8(_BT_AST),
  18690. 43: uint8(_BT_PLUS),
  18691. 44: uint8(_BT_COMMA),
  18692. 45: uint8(_BT_MINUS),
  18693. 46: uint8(_BT_NAME),
  18694. 47: uint8(_BT_SOL),
  18695. 48: uint8(_BT_DIGIT),
  18696. 49: uint8(_BT_DIGIT),
  18697. 50: uint8(_BT_DIGIT),
  18698. 51: uint8(_BT_DIGIT),
  18699. 52: uint8(_BT_DIGIT),
  18700. 53: uint8(_BT_DIGIT),
  18701. 54: uint8(_BT_DIGIT),
  18702. 55: uint8(_BT_DIGIT),
  18703. 56: uint8(_BT_DIGIT),
  18704. 57: uint8(_BT_DIGIT),
  18705. 58: uint8(_BT_NMSTRT),
  18706. 59: uint8(_BT_SEMI),
  18707. 60: uint8(_BT_LT),
  18708. 61: uint8(_BT_EQUALS),
  18709. 62: uint8(_BT_GT),
  18710. 63: uint8(_BT_QUEST),
  18711. 64: uint8(_BT_OTHER),
  18712. 65: uint8(_BT_HEX),
  18713. 66: uint8(_BT_HEX),
  18714. 67: uint8(_BT_HEX),
  18715. 68: uint8(_BT_HEX),
  18716. 69: uint8(_BT_HEX),
  18717. 70: uint8(_BT_HEX),
  18718. 71: uint8(_BT_NMSTRT),
  18719. 72: uint8(_BT_NMSTRT),
  18720. 73: uint8(_BT_NMSTRT),
  18721. 74: uint8(_BT_NMSTRT),
  18722. 75: uint8(_BT_NMSTRT),
  18723. 76: uint8(_BT_NMSTRT),
  18724. 77: uint8(_BT_NMSTRT),
  18725. 78: uint8(_BT_NMSTRT),
  18726. 79: uint8(_BT_NMSTRT),
  18727. 80: uint8(_BT_NMSTRT),
  18728. 81: uint8(_BT_NMSTRT),
  18729. 82: uint8(_BT_NMSTRT),
  18730. 83: uint8(_BT_NMSTRT),
  18731. 84: uint8(_BT_NMSTRT),
  18732. 85: uint8(_BT_NMSTRT),
  18733. 86: uint8(_BT_NMSTRT),
  18734. 87: uint8(_BT_NMSTRT),
  18735. 88: uint8(_BT_NMSTRT),
  18736. 89: uint8(_BT_NMSTRT),
  18737. 90: uint8(_BT_NMSTRT),
  18738. 91: uint8(_BT_LSQB),
  18739. 92: uint8(_BT_OTHER),
  18740. 93: uint8(_BT_RSQB),
  18741. 94: uint8(_BT_OTHER),
  18742. 95: uint8(_BT_NMSTRT),
  18743. 96: uint8(_BT_OTHER),
  18744. 97: uint8(_BT_HEX),
  18745. 98: uint8(_BT_HEX),
  18746. 99: uint8(_BT_HEX),
  18747. 100: uint8(_BT_HEX),
  18748. 101: uint8(_BT_HEX),
  18749. 102: uint8(_BT_HEX),
  18750. 103: uint8(_BT_NMSTRT),
  18751. 104: uint8(_BT_NMSTRT),
  18752. 105: uint8(_BT_NMSTRT),
  18753. 106: uint8(_BT_NMSTRT),
  18754. 107: uint8(_BT_NMSTRT),
  18755. 108: uint8(_BT_NMSTRT),
  18756. 109: uint8(_BT_NMSTRT),
  18757. 110: uint8(_BT_NMSTRT),
  18758. 111: uint8(_BT_NMSTRT),
  18759. 112: uint8(_BT_NMSTRT),
  18760. 113: uint8(_BT_NMSTRT),
  18761. 114: uint8(_BT_NMSTRT),
  18762. 115: uint8(_BT_NMSTRT),
  18763. 116: uint8(_BT_NMSTRT),
  18764. 117: uint8(_BT_NMSTRT),
  18765. 118: uint8(_BT_NMSTRT),
  18766. 119: uint8(_BT_NMSTRT),
  18767. 120: uint8(_BT_NMSTRT),
  18768. 121: uint8(_BT_NMSTRT),
  18769. 122: uint8(_BT_NMSTRT),
  18770. 123: uint8(_BT_OTHER),
  18771. 124: uint8(_BT_VERBAR),
  18772. 125: uint8(_BT_OTHER),
  18773. 126: uint8(_BT_OTHER),
  18774. 127: uint8(_BT_OTHER),
  18775. 128: uint8(_BT_TRAIL),
  18776. 129: uint8(_BT_TRAIL),
  18777. 130: uint8(_BT_TRAIL),
  18778. 131: uint8(_BT_TRAIL),
  18779. 132: uint8(_BT_TRAIL),
  18780. 133: uint8(_BT_TRAIL),
  18781. 134: uint8(_BT_TRAIL),
  18782. 135: uint8(_BT_TRAIL),
  18783. 136: uint8(_BT_TRAIL),
  18784. 137: uint8(_BT_TRAIL),
  18785. 138: uint8(_BT_TRAIL),
  18786. 139: uint8(_BT_TRAIL),
  18787. 140: uint8(_BT_TRAIL),
  18788. 141: uint8(_BT_TRAIL),
  18789. 142: uint8(_BT_TRAIL),
  18790. 143: uint8(_BT_TRAIL),
  18791. 144: uint8(_BT_TRAIL),
  18792. 145: uint8(_BT_TRAIL),
  18793. 146: uint8(_BT_TRAIL),
  18794. 147: uint8(_BT_TRAIL),
  18795. 148: uint8(_BT_TRAIL),
  18796. 149: uint8(_BT_TRAIL),
  18797. 150: uint8(_BT_TRAIL),
  18798. 151: uint8(_BT_TRAIL),
  18799. 152: uint8(_BT_TRAIL),
  18800. 153: uint8(_BT_TRAIL),
  18801. 154: uint8(_BT_TRAIL),
  18802. 155: uint8(_BT_TRAIL),
  18803. 156: uint8(_BT_TRAIL),
  18804. 157: uint8(_BT_TRAIL),
  18805. 158: uint8(_BT_TRAIL),
  18806. 159: uint8(_BT_TRAIL),
  18807. 160: uint8(_BT_TRAIL),
  18808. 161: uint8(_BT_TRAIL),
  18809. 162: uint8(_BT_TRAIL),
  18810. 163: uint8(_BT_TRAIL),
  18811. 164: uint8(_BT_TRAIL),
  18812. 165: uint8(_BT_TRAIL),
  18813. 166: uint8(_BT_TRAIL),
  18814. 167: uint8(_BT_TRAIL),
  18815. 168: uint8(_BT_TRAIL),
  18816. 169: uint8(_BT_TRAIL),
  18817. 170: uint8(_BT_TRAIL),
  18818. 171: uint8(_BT_TRAIL),
  18819. 172: uint8(_BT_TRAIL),
  18820. 173: uint8(_BT_TRAIL),
  18821. 174: uint8(_BT_TRAIL),
  18822. 175: uint8(_BT_TRAIL),
  18823. 176: uint8(_BT_TRAIL),
  18824. 177: uint8(_BT_TRAIL),
  18825. 178: uint8(_BT_TRAIL),
  18826. 179: uint8(_BT_TRAIL),
  18827. 180: uint8(_BT_TRAIL),
  18828. 181: uint8(_BT_TRAIL),
  18829. 182: uint8(_BT_TRAIL),
  18830. 183: uint8(_BT_TRAIL),
  18831. 184: uint8(_BT_TRAIL),
  18832. 185: uint8(_BT_TRAIL),
  18833. 186: uint8(_BT_TRAIL),
  18834. 187: uint8(_BT_TRAIL),
  18835. 188: uint8(_BT_TRAIL),
  18836. 189: uint8(_BT_TRAIL),
  18837. 190: uint8(_BT_TRAIL),
  18838. 191: uint8(_BT_TRAIL),
  18839. 192: uint8(_BT_LEAD2),
  18840. 193: uint8(_BT_LEAD2),
  18841. 194: uint8(_BT_LEAD2),
  18842. 195: uint8(_BT_LEAD2),
  18843. 196: uint8(_BT_LEAD2),
  18844. 197: uint8(_BT_LEAD2),
  18845. 198: uint8(_BT_LEAD2),
  18846. 199: uint8(_BT_LEAD2),
  18847. 200: uint8(_BT_LEAD2),
  18848. 201: uint8(_BT_LEAD2),
  18849. 202: uint8(_BT_LEAD2),
  18850. 203: uint8(_BT_LEAD2),
  18851. 204: uint8(_BT_LEAD2),
  18852. 205: uint8(_BT_LEAD2),
  18853. 206: uint8(_BT_LEAD2),
  18854. 207: uint8(_BT_LEAD2),
  18855. 208: uint8(_BT_LEAD2),
  18856. 209: uint8(_BT_LEAD2),
  18857. 210: uint8(_BT_LEAD2),
  18858. 211: uint8(_BT_LEAD2),
  18859. 212: uint8(_BT_LEAD2),
  18860. 213: uint8(_BT_LEAD2),
  18861. 214: uint8(_BT_LEAD2),
  18862. 215: uint8(_BT_LEAD2),
  18863. 216: uint8(_BT_LEAD2),
  18864. 217: uint8(_BT_LEAD2),
  18865. 218: uint8(_BT_LEAD2),
  18866. 219: uint8(_BT_LEAD2),
  18867. 220: uint8(_BT_LEAD2),
  18868. 221: uint8(_BT_LEAD2),
  18869. 222: uint8(_BT_LEAD2),
  18870. 223: uint8(_BT_LEAD2),
  18871. 224: uint8(_BT_LEAD3),
  18872. 225: uint8(_BT_LEAD3),
  18873. 226: uint8(_BT_LEAD3),
  18874. 227: uint8(_BT_LEAD3),
  18875. 228: uint8(_BT_LEAD3),
  18876. 229: uint8(_BT_LEAD3),
  18877. 230: uint8(_BT_LEAD3),
  18878. 231: uint8(_BT_LEAD3),
  18879. 232: uint8(_BT_LEAD3),
  18880. 233: uint8(_BT_LEAD3),
  18881. 234: uint8(_BT_LEAD3),
  18882. 235: uint8(_BT_LEAD3),
  18883. 236: uint8(_BT_LEAD3),
  18884. 237: uint8(_BT_LEAD3),
  18885. 238: uint8(_BT_LEAD3),
  18886. 239: uint8(_BT_LEAD3),
  18887. 240: uint8(_BT_LEAD4),
  18888. 241: uint8(_BT_LEAD4),
  18889. 242: uint8(_BT_LEAD4),
  18890. 243: uint8(_BT_LEAD4),
  18891. 244: uint8(_BT_LEAD4),
  18892. 254: uint8(_BT_MALFORM),
  18893. 255: uint8(_BT_MALFORM),
  18894. },
  18895. }
  18896. func init() {
  18897. p := unsafe.Pointer(&_utf8_encoding)
  18898. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  18899. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  18900. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  18901. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  18902. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  18903. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  18904. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  18905. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  18906. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  18907. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  18908. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  18909. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  18910. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  18911. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  18912. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  18913. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  18914. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  18915. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  18916. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  18917. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  18918. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  18919. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  18920. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  18921. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  18922. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  18923. }
  18924. var _internal_utf8_encoding_ns = Tnormal_encoding{
  18925. Fenc: TENCODING{
  18926. Fscanners: [4]TSCANNER{},
  18927. FliteralScanners: [2]TSCANNER{},
  18928. FminBytesPerChar: int32(1),
  18929. FisUtf8: int8(1),
  18930. },
  18931. Ftype1: [256]uint8{
  18932. 9: uint8(_BT_S),
  18933. 10: uint8(_BT_LF),
  18934. 13: uint8(_BT_S),
  18935. 32: uint8(_BT_S),
  18936. 33: uint8(_BT_EXCL),
  18937. 34: uint8(_BT_QUOT),
  18938. 35: uint8(_BT_NUM),
  18939. 36: uint8(_BT_OTHER),
  18940. 37: uint8(_BT_PERCNT),
  18941. 38: uint8(_BT_AMP),
  18942. 39: uint8(_BT_APOS),
  18943. 40: uint8(_BT_LPAR),
  18944. 41: uint8(_BT_RPAR),
  18945. 42: uint8(_BT_AST),
  18946. 43: uint8(_BT_PLUS),
  18947. 44: uint8(_BT_COMMA),
  18948. 45: uint8(_BT_MINUS),
  18949. 46: uint8(_BT_NAME),
  18950. 47: uint8(_BT_SOL),
  18951. 48: uint8(_BT_DIGIT),
  18952. 49: uint8(_BT_DIGIT),
  18953. 50: uint8(_BT_DIGIT),
  18954. 51: uint8(_BT_DIGIT),
  18955. 52: uint8(_BT_DIGIT),
  18956. 53: uint8(_BT_DIGIT),
  18957. 54: uint8(_BT_DIGIT),
  18958. 55: uint8(_BT_DIGIT),
  18959. 56: uint8(_BT_DIGIT),
  18960. 57: uint8(_BT_DIGIT),
  18961. 58: uint8(_BT_COLON),
  18962. 59: uint8(_BT_SEMI),
  18963. 60: uint8(_BT_LT),
  18964. 61: uint8(_BT_EQUALS),
  18965. 62: uint8(_BT_GT),
  18966. 63: uint8(_BT_QUEST),
  18967. 64: uint8(_BT_OTHER),
  18968. 65: uint8(_BT_HEX),
  18969. 66: uint8(_BT_HEX),
  18970. 67: uint8(_BT_HEX),
  18971. 68: uint8(_BT_HEX),
  18972. 69: uint8(_BT_HEX),
  18973. 70: uint8(_BT_HEX),
  18974. 71: uint8(_BT_NMSTRT),
  18975. 72: uint8(_BT_NMSTRT),
  18976. 73: uint8(_BT_NMSTRT),
  18977. 74: uint8(_BT_NMSTRT),
  18978. 75: uint8(_BT_NMSTRT),
  18979. 76: uint8(_BT_NMSTRT),
  18980. 77: uint8(_BT_NMSTRT),
  18981. 78: uint8(_BT_NMSTRT),
  18982. 79: uint8(_BT_NMSTRT),
  18983. 80: uint8(_BT_NMSTRT),
  18984. 81: uint8(_BT_NMSTRT),
  18985. 82: uint8(_BT_NMSTRT),
  18986. 83: uint8(_BT_NMSTRT),
  18987. 84: uint8(_BT_NMSTRT),
  18988. 85: uint8(_BT_NMSTRT),
  18989. 86: uint8(_BT_NMSTRT),
  18990. 87: uint8(_BT_NMSTRT),
  18991. 88: uint8(_BT_NMSTRT),
  18992. 89: uint8(_BT_NMSTRT),
  18993. 90: uint8(_BT_NMSTRT),
  18994. 91: uint8(_BT_LSQB),
  18995. 92: uint8(_BT_OTHER),
  18996. 93: uint8(_BT_RSQB),
  18997. 94: uint8(_BT_OTHER),
  18998. 95: uint8(_BT_NMSTRT),
  18999. 96: uint8(_BT_OTHER),
  19000. 97: uint8(_BT_HEX),
  19001. 98: uint8(_BT_HEX),
  19002. 99: uint8(_BT_HEX),
  19003. 100: uint8(_BT_HEX),
  19004. 101: uint8(_BT_HEX),
  19005. 102: uint8(_BT_HEX),
  19006. 103: uint8(_BT_NMSTRT),
  19007. 104: uint8(_BT_NMSTRT),
  19008. 105: uint8(_BT_NMSTRT),
  19009. 106: uint8(_BT_NMSTRT),
  19010. 107: uint8(_BT_NMSTRT),
  19011. 108: uint8(_BT_NMSTRT),
  19012. 109: uint8(_BT_NMSTRT),
  19013. 110: uint8(_BT_NMSTRT),
  19014. 111: uint8(_BT_NMSTRT),
  19015. 112: uint8(_BT_NMSTRT),
  19016. 113: uint8(_BT_NMSTRT),
  19017. 114: uint8(_BT_NMSTRT),
  19018. 115: uint8(_BT_NMSTRT),
  19019. 116: uint8(_BT_NMSTRT),
  19020. 117: uint8(_BT_NMSTRT),
  19021. 118: uint8(_BT_NMSTRT),
  19022. 119: uint8(_BT_NMSTRT),
  19023. 120: uint8(_BT_NMSTRT),
  19024. 121: uint8(_BT_NMSTRT),
  19025. 122: uint8(_BT_NMSTRT),
  19026. 123: uint8(_BT_OTHER),
  19027. 124: uint8(_BT_VERBAR),
  19028. 125: uint8(_BT_OTHER),
  19029. 126: uint8(_BT_OTHER),
  19030. 127: uint8(_BT_OTHER),
  19031. 128: uint8(_BT_TRAIL),
  19032. 129: uint8(_BT_TRAIL),
  19033. 130: uint8(_BT_TRAIL),
  19034. 131: uint8(_BT_TRAIL),
  19035. 132: uint8(_BT_TRAIL),
  19036. 133: uint8(_BT_TRAIL),
  19037. 134: uint8(_BT_TRAIL),
  19038. 135: uint8(_BT_TRAIL),
  19039. 136: uint8(_BT_TRAIL),
  19040. 137: uint8(_BT_TRAIL),
  19041. 138: uint8(_BT_TRAIL),
  19042. 139: uint8(_BT_TRAIL),
  19043. 140: uint8(_BT_TRAIL),
  19044. 141: uint8(_BT_TRAIL),
  19045. 142: uint8(_BT_TRAIL),
  19046. 143: uint8(_BT_TRAIL),
  19047. 144: uint8(_BT_TRAIL),
  19048. 145: uint8(_BT_TRAIL),
  19049. 146: uint8(_BT_TRAIL),
  19050. 147: uint8(_BT_TRAIL),
  19051. 148: uint8(_BT_TRAIL),
  19052. 149: uint8(_BT_TRAIL),
  19053. 150: uint8(_BT_TRAIL),
  19054. 151: uint8(_BT_TRAIL),
  19055. 152: uint8(_BT_TRAIL),
  19056. 153: uint8(_BT_TRAIL),
  19057. 154: uint8(_BT_TRAIL),
  19058. 155: uint8(_BT_TRAIL),
  19059. 156: uint8(_BT_TRAIL),
  19060. 157: uint8(_BT_TRAIL),
  19061. 158: uint8(_BT_TRAIL),
  19062. 159: uint8(_BT_TRAIL),
  19063. 160: uint8(_BT_TRAIL),
  19064. 161: uint8(_BT_TRAIL),
  19065. 162: uint8(_BT_TRAIL),
  19066. 163: uint8(_BT_TRAIL),
  19067. 164: uint8(_BT_TRAIL),
  19068. 165: uint8(_BT_TRAIL),
  19069. 166: uint8(_BT_TRAIL),
  19070. 167: uint8(_BT_TRAIL),
  19071. 168: uint8(_BT_TRAIL),
  19072. 169: uint8(_BT_TRAIL),
  19073. 170: uint8(_BT_TRAIL),
  19074. 171: uint8(_BT_TRAIL),
  19075. 172: uint8(_BT_TRAIL),
  19076. 173: uint8(_BT_TRAIL),
  19077. 174: uint8(_BT_TRAIL),
  19078. 175: uint8(_BT_TRAIL),
  19079. 176: uint8(_BT_TRAIL),
  19080. 177: uint8(_BT_TRAIL),
  19081. 178: uint8(_BT_TRAIL),
  19082. 179: uint8(_BT_TRAIL),
  19083. 180: uint8(_BT_TRAIL),
  19084. 181: uint8(_BT_TRAIL),
  19085. 182: uint8(_BT_TRAIL),
  19086. 183: uint8(_BT_TRAIL),
  19087. 184: uint8(_BT_TRAIL),
  19088. 185: uint8(_BT_TRAIL),
  19089. 186: uint8(_BT_TRAIL),
  19090. 187: uint8(_BT_TRAIL),
  19091. 188: uint8(_BT_TRAIL),
  19092. 189: uint8(_BT_TRAIL),
  19093. 190: uint8(_BT_TRAIL),
  19094. 191: uint8(_BT_TRAIL),
  19095. 192: uint8(_BT_LEAD2),
  19096. 193: uint8(_BT_LEAD2),
  19097. 194: uint8(_BT_LEAD2),
  19098. 195: uint8(_BT_LEAD2),
  19099. 196: uint8(_BT_LEAD2),
  19100. 197: uint8(_BT_LEAD2),
  19101. 198: uint8(_BT_LEAD2),
  19102. 199: uint8(_BT_LEAD2),
  19103. 200: uint8(_BT_LEAD2),
  19104. 201: uint8(_BT_LEAD2),
  19105. 202: uint8(_BT_LEAD2),
  19106. 203: uint8(_BT_LEAD2),
  19107. 204: uint8(_BT_LEAD2),
  19108. 205: uint8(_BT_LEAD2),
  19109. 206: uint8(_BT_LEAD2),
  19110. 207: uint8(_BT_LEAD2),
  19111. 208: uint8(_BT_LEAD2),
  19112. 209: uint8(_BT_LEAD2),
  19113. 210: uint8(_BT_LEAD2),
  19114. 211: uint8(_BT_LEAD2),
  19115. 212: uint8(_BT_LEAD2),
  19116. 213: uint8(_BT_LEAD2),
  19117. 214: uint8(_BT_LEAD2),
  19118. 215: uint8(_BT_LEAD2),
  19119. 216: uint8(_BT_LEAD2),
  19120. 217: uint8(_BT_LEAD2),
  19121. 218: uint8(_BT_LEAD2),
  19122. 219: uint8(_BT_LEAD2),
  19123. 220: uint8(_BT_LEAD2),
  19124. 221: uint8(_BT_LEAD2),
  19125. 222: uint8(_BT_LEAD2),
  19126. 223: uint8(_BT_LEAD2),
  19127. 224: uint8(_BT_LEAD3),
  19128. 225: uint8(_BT_LEAD3),
  19129. 226: uint8(_BT_LEAD3),
  19130. 227: uint8(_BT_LEAD3),
  19131. 228: uint8(_BT_LEAD3),
  19132. 229: uint8(_BT_LEAD3),
  19133. 230: uint8(_BT_LEAD3),
  19134. 231: uint8(_BT_LEAD3),
  19135. 232: uint8(_BT_LEAD3),
  19136. 233: uint8(_BT_LEAD3),
  19137. 234: uint8(_BT_LEAD3),
  19138. 235: uint8(_BT_LEAD3),
  19139. 236: uint8(_BT_LEAD3),
  19140. 237: uint8(_BT_LEAD3),
  19141. 238: uint8(_BT_LEAD3),
  19142. 239: uint8(_BT_LEAD3),
  19143. 240: uint8(_BT_LEAD4),
  19144. 241: uint8(_BT_LEAD4),
  19145. 242: uint8(_BT_LEAD4),
  19146. 243: uint8(_BT_LEAD4),
  19147. 244: uint8(_BT_LEAD4),
  19148. 254: uint8(_BT_MALFORM),
  19149. 255: uint8(_BT_MALFORM),
  19150. },
  19151. }
  19152. func init() {
  19153. p := unsafe.Pointer(&_internal_utf8_encoding_ns)
  19154. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  19155. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  19156. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  19157. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  19158. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  19159. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  19160. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  19161. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  19162. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  19163. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  19164. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  19165. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  19166. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  19167. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  19168. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  19169. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  19170. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  19171. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  19172. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  19173. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  19174. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  19175. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  19176. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  19177. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  19178. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  19179. }
  19180. var _internal_utf8_encoding = Tnormal_encoding{
  19181. Fenc: TENCODING{
  19182. Fscanners: [4]TSCANNER{},
  19183. FliteralScanners: [2]TSCANNER{},
  19184. FminBytesPerChar: int32(1),
  19185. FisUtf8: int8(1),
  19186. },
  19187. Ftype1: [256]uint8{
  19188. 9: uint8(_BT_S),
  19189. 10: uint8(_BT_LF),
  19190. 13: uint8(_BT_S),
  19191. 32: uint8(_BT_S),
  19192. 33: uint8(_BT_EXCL),
  19193. 34: uint8(_BT_QUOT),
  19194. 35: uint8(_BT_NUM),
  19195. 36: uint8(_BT_OTHER),
  19196. 37: uint8(_BT_PERCNT),
  19197. 38: uint8(_BT_AMP),
  19198. 39: uint8(_BT_APOS),
  19199. 40: uint8(_BT_LPAR),
  19200. 41: uint8(_BT_RPAR),
  19201. 42: uint8(_BT_AST),
  19202. 43: uint8(_BT_PLUS),
  19203. 44: uint8(_BT_COMMA),
  19204. 45: uint8(_BT_MINUS),
  19205. 46: uint8(_BT_NAME),
  19206. 47: uint8(_BT_SOL),
  19207. 48: uint8(_BT_DIGIT),
  19208. 49: uint8(_BT_DIGIT),
  19209. 50: uint8(_BT_DIGIT),
  19210. 51: uint8(_BT_DIGIT),
  19211. 52: uint8(_BT_DIGIT),
  19212. 53: uint8(_BT_DIGIT),
  19213. 54: uint8(_BT_DIGIT),
  19214. 55: uint8(_BT_DIGIT),
  19215. 56: uint8(_BT_DIGIT),
  19216. 57: uint8(_BT_DIGIT),
  19217. 58: uint8(_BT_NMSTRT),
  19218. 59: uint8(_BT_SEMI),
  19219. 60: uint8(_BT_LT),
  19220. 61: uint8(_BT_EQUALS),
  19221. 62: uint8(_BT_GT),
  19222. 63: uint8(_BT_QUEST),
  19223. 64: uint8(_BT_OTHER),
  19224. 65: uint8(_BT_HEX),
  19225. 66: uint8(_BT_HEX),
  19226. 67: uint8(_BT_HEX),
  19227. 68: uint8(_BT_HEX),
  19228. 69: uint8(_BT_HEX),
  19229. 70: uint8(_BT_HEX),
  19230. 71: uint8(_BT_NMSTRT),
  19231. 72: uint8(_BT_NMSTRT),
  19232. 73: uint8(_BT_NMSTRT),
  19233. 74: uint8(_BT_NMSTRT),
  19234. 75: uint8(_BT_NMSTRT),
  19235. 76: uint8(_BT_NMSTRT),
  19236. 77: uint8(_BT_NMSTRT),
  19237. 78: uint8(_BT_NMSTRT),
  19238. 79: uint8(_BT_NMSTRT),
  19239. 80: uint8(_BT_NMSTRT),
  19240. 81: uint8(_BT_NMSTRT),
  19241. 82: uint8(_BT_NMSTRT),
  19242. 83: uint8(_BT_NMSTRT),
  19243. 84: uint8(_BT_NMSTRT),
  19244. 85: uint8(_BT_NMSTRT),
  19245. 86: uint8(_BT_NMSTRT),
  19246. 87: uint8(_BT_NMSTRT),
  19247. 88: uint8(_BT_NMSTRT),
  19248. 89: uint8(_BT_NMSTRT),
  19249. 90: uint8(_BT_NMSTRT),
  19250. 91: uint8(_BT_LSQB),
  19251. 92: uint8(_BT_OTHER),
  19252. 93: uint8(_BT_RSQB),
  19253. 94: uint8(_BT_OTHER),
  19254. 95: uint8(_BT_NMSTRT),
  19255. 96: uint8(_BT_OTHER),
  19256. 97: uint8(_BT_HEX),
  19257. 98: uint8(_BT_HEX),
  19258. 99: uint8(_BT_HEX),
  19259. 100: uint8(_BT_HEX),
  19260. 101: uint8(_BT_HEX),
  19261. 102: uint8(_BT_HEX),
  19262. 103: uint8(_BT_NMSTRT),
  19263. 104: uint8(_BT_NMSTRT),
  19264. 105: uint8(_BT_NMSTRT),
  19265. 106: uint8(_BT_NMSTRT),
  19266. 107: uint8(_BT_NMSTRT),
  19267. 108: uint8(_BT_NMSTRT),
  19268. 109: uint8(_BT_NMSTRT),
  19269. 110: uint8(_BT_NMSTRT),
  19270. 111: uint8(_BT_NMSTRT),
  19271. 112: uint8(_BT_NMSTRT),
  19272. 113: uint8(_BT_NMSTRT),
  19273. 114: uint8(_BT_NMSTRT),
  19274. 115: uint8(_BT_NMSTRT),
  19275. 116: uint8(_BT_NMSTRT),
  19276. 117: uint8(_BT_NMSTRT),
  19277. 118: uint8(_BT_NMSTRT),
  19278. 119: uint8(_BT_NMSTRT),
  19279. 120: uint8(_BT_NMSTRT),
  19280. 121: uint8(_BT_NMSTRT),
  19281. 122: uint8(_BT_NMSTRT),
  19282. 123: uint8(_BT_OTHER),
  19283. 124: uint8(_BT_VERBAR),
  19284. 125: uint8(_BT_OTHER),
  19285. 126: uint8(_BT_OTHER),
  19286. 127: uint8(_BT_OTHER),
  19287. 128: uint8(_BT_TRAIL),
  19288. 129: uint8(_BT_TRAIL),
  19289. 130: uint8(_BT_TRAIL),
  19290. 131: uint8(_BT_TRAIL),
  19291. 132: uint8(_BT_TRAIL),
  19292. 133: uint8(_BT_TRAIL),
  19293. 134: uint8(_BT_TRAIL),
  19294. 135: uint8(_BT_TRAIL),
  19295. 136: uint8(_BT_TRAIL),
  19296. 137: uint8(_BT_TRAIL),
  19297. 138: uint8(_BT_TRAIL),
  19298. 139: uint8(_BT_TRAIL),
  19299. 140: uint8(_BT_TRAIL),
  19300. 141: uint8(_BT_TRAIL),
  19301. 142: uint8(_BT_TRAIL),
  19302. 143: uint8(_BT_TRAIL),
  19303. 144: uint8(_BT_TRAIL),
  19304. 145: uint8(_BT_TRAIL),
  19305. 146: uint8(_BT_TRAIL),
  19306. 147: uint8(_BT_TRAIL),
  19307. 148: uint8(_BT_TRAIL),
  19308. 149: uint8(_BT_TRAIL),
  19309. 150: uint8(_BT_TRAIL),
  19310. 151: uint8(_BT_TRAIL),
  19311. 152: uint8(_BT_TRAIL),
  19312. 153: uint8(_BT_TRAIL),
  19313. 154: uint8(_BT_TRAIL),
  19314. 155: uint8(_BT_TRAIL),
  19315. 156: uint8(_BT_TRAIL),
  19316. 157: uint8(_BT_TRAIL),
  19317. 158: uint8(_BT_TRAIL),
  19318. 159: uint8(_BT_TRAIL),
  19319. 160: uint8(_BT_TRAIL),
  19320. 161: uint8(_BT_TRAIL),
  19321. 162: uint8(_BT_TRAIL),
  19322. 163: uint8(_BT_TRAIL),
  19323. 164: uint8(_BT_TRAIL),
  19324. 165: uint8(_BT_TRAIL),
  19325. 166: uint8(_BT_TRAIL),
  19326. 167: uint8(_BT_TRAIL),
  19327. 168: uint8(_BT_TRAIL),
  19328. 169: uint8(_BT_TRAIL),
  19329. 170: uint8(_BT_TRAIL),
  19330. 171: uint8(_BT_TRAIL),
  19331. 172: uint8(_BT_TRAIL),
  19332. 173: uint8(_BT_TRAIL),
  19333. 174: uint8(_BT_TRAIL),
  19334. 175: uint8(_BT_TRAIL),
  19335. 176: uint8(_BT_TRAIL),
  19336. 177: uint8(_BT_TRAIL),
  19337. 178: uint8(_BT_TRAIL),
  19338. 179: uint8(_BT_TRAIL),
  19339. 180: uint8(_BT_TRAIL),
  19340. 181: uint8(_BT_TRAIL),
  19341. 182: uint8(_BT_TRAIL),
  19342. 183: uint8(_BT_TRAIL),
  19343. 184: uint8(_BT_TRAIL),
  19344. 185: uint8(_BT_TRAIL),
  19345. 186: uint8(_BT_TRAIL),
  19346. 187: uint8(_BT_TRAIL),
  19347. 188: uint8(_BT_TRAIL),
  19348. 189: uint8(_BT_TRAIL),
  19349. 190: uint8(_BT_TRAIL),
  19350. 191: uint8(_BT_TRAIL),
  19351. 192: uint8(_BT_LEAD2),
  19352. 193: uint8(_BT_LEAD2),
  19353. 194: uint8(_BT_LEAD2),
  19354. 195: uint8(_BT_LEAD2),
  19355. 196: uint8(_BT_LEAD2),
  19356. 197: uint8(_BT_LEAD2),
  19357. 198: uint8(_BT_LEAD2),
  19358. 199: uint8(_BT_LEAD2),
  19359. 200: uint8(_BT_LEAD2),
  19360. 201: uint8(_BT_LEAD2),
  19361. 202: uint8(_BT_LEAD2),
  19362. 203: uint8(_BT_LEAD2),
  19363. 204: uint8(_BT_LEAD2),
  19364. 205: uint8(_BT_LEAD2),
  19365. 206: uint8(_BT_LEAD2),
  19366. 207: uint8(_BT_LEAD2),
  19367. 208: uint8(_BT_LEAD2),
  19368. 209: uint8(_BT_LEAD2),
  19369. 210: uint8(_BT_LEAD2),
  19370. 211: uint8(_BT_LEAD2),
  19371. 212: uint8(_BT_LEAD2),
  19372. 213: uint8(_BT_LEAD2),
  19373. 214: uint8(_BT_LEAD2),
  19374. 215: uint8(_BT_LEAD2),
  19375. 216: uint8(_BT_LEAD2),
  19376. 217: uint8(_BT_LEAD2),
  19377. 218: uint8(_BT_LEAD2),
  19378. 219: uint8(_BT_LEAD2),
  19379. 220: uint8(_BT_LEAD2),
  19380. 221: uint8(_BT_LEAD2),
  19381. 222: uint8(_BT_LEAD2),
  19382. 223: uint8(_BT_LEAD2),
  19383. 224: uint8(_BT_LEAD3),
  19384. 225: uint8(_BT_LEAD3),
  19385. 226: uint8(_BT_LEAD3),
  19386. 227: uint8(_BT_LEAD3),
  19387. 228: uint8(_BT_LEAD3),
  19388. 229: uint8(_BT_LEAD3),
  19389. 230: uint8(_BT_LEAD3),
  19390. 231: uint8(_BT_LEAD3),
  19391. 232: uint8(_BT_LEAD3),
  19392. 233: uint8(_BT_LEAD3),
  19393. 234: uint8(_BT_LEAD3),
  19394. 235: uint8(_BT_LEAD3),
  19395. 236: uint8(_BT_LEAD3),
  19396. 237: uint8(_BT_LEAD3),
  19397. 238: uint8(_BT_LEAD3),
  19398. 239: uint8(_BT_LEAD3),
  19399. 240: uint8(_BT_LEAD4),
  19400. 241: uint8(_BT_LEAD4),
  19401. 242: uint8(_BT_LEAD4),
  19402. 243: uint8(_BT_LEAD4),
  19403. 244: uint8(_BT_LEAD4),
  19404. 254: uint8(_BT_MALFORM),
  19405. 255: uint8(_BT_MALFORM),
  19406. },
  19407. }
  19408. func init() {
  19409. p := unsafe.Pointer(&_internal_utf8_encoding)
  19410. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  19411. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  19412. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  19413. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  19414. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  19415. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  19416. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  19417. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  19418. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  19419. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  19420. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  19421. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  19422. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  19423. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  19424. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  19425. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  19426. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  19427. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  19428. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  19429. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  19430. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  19431. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  19432. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  19433. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  19434. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  19435. }
  19436. func _latin1_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  19437. var c uint8
  19438. var v2, v3, v4, v5, v6, v7, v8, v9 uintptr
  19439. _, _, _, _, _, _, _, _, _ = c, v2, v3, v4, v5, v6, v7, v8, v9
  19440. _ = enc
  19441. for {
  19442. if *(*uintptr)(unsafe.Pointer(fromP)) == fromLim {
  19443. return int32(_XML_CONVERT_COMPLETED)
  19444. }
  19445. c = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)))))
  19446. if libc.Int32FromUint8(c)&int32(0x80) != 0 {
  19447. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(2) {
  19448. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  19449. }
  19450. v3 = toP
  19451. v2 = *(*uintptr)(unsafe.Pointer(v3))
  19452. *(*uintptr)(unsafe.Pointer(v3))++
  19453. *(*int8)(unsafe.Pointer(v2)) = int8(libc.Int32FromUint8(c)>>libc.Int32FromInt32(6) | int32(_UTF8_cval2))
  19454. v5 = toP
  19455. v4 = *(*uintptr)(unsafe.Pointer(v5))
  19456. *(*uintptr)(unsafe.Pointer(v5))++
  19457. *(*int8)(unsafe.Pointer(v4)) = int8(libc.Int32FromUint8(c)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  19458. *(*uintptr)(unsafe.Pointer(fromP))++
  19459. } else {
  19460. if *(*uintptr)(unsafe.Pointer(toP)) == toLim {
  19461. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  19462. }
  19463. v7 = toP
  19464. v6 = *(*uintptr)(unsafe.Pointer(v7))
  19465. *(*uintptr)(unsafe.Pointer(v7))++
  19466. v9 = fromP
  19467. v8 = *(*uintptr)(unsafe.Pointer(v9))
  19468. *(*uintptr)(unsafe.Pointer(v9))++
  19469. *(*int8)(unsafe.Pointer(v6)) = *(*int8)(unsafe.Pointer(v8))
  19470. }
  19471. goto _1
  19472. _1:
  19473. }
  19474. return r
  19475. }
  19476. func _latin1_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  19477. var v1, v2, v3, v4 uintptr
  19478. _, _, _, _ = v1, v2, v3, v4
  19479. _ = enc
  19480. for *(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim {
  19481. v2 = toP
  19482. v1 = *(*uintptr)(unsafe.Pointer(v2))
  19483. *(*uintptr)(unsafe.Pointer(v2)) += 2
  19484. v4 = fromP
  19485. v3 = *(*uintptr)(unsafe.Pointer(v4))
  19486. *(*uintptr)(unsafe.Pointer(v4))++
  19487. *(*uint16)(unsafe.Pointer(v1)) = uint16(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(v3))))
  19488. }
  19489. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  19490. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  19491. } else {
  19492. return int32(_XML_CONVERT_COMPLETED)
  19493. }
  19494. return r
  19495. }
  19496. var _latin1_encoding_ns = Tnormal_encoding{
  19497. Fenc: TENCODING{
  19498. Fscanners: [4]TSCANNER{},
  19499. FliteralScanners: [2]TSCANNER{},
  19500. FminBytesPerChar: int32(1),
  19501. },
  19502. Ftype1: [256]uint8{
  19503. 9: uint8(_BT_S),
  19504. 10: uint8(_BT_LF),
  19505. 13: uint8(_BT_CR),
  19506. 32: uint8(_BT_S),
  19507. 33: uint8(_BT_EXCL),
  19508. 34: uint8(_BT_QUOT),
  19509. 35: uint8(_BT_NUM),
  19510. 36: uint8(_BT_OTHER),
  19511. 37: uint8(_BT_PERCNT),
  19512. 38: uint8(_BT_AMP),
  19513. 39: uint8(_BT_APOS),
  19514. 40: uint8(_BT_LPAR),
  19515. 41: uint8(_BT_RPAR),
  19516. 42: uint8(_BT_AST),
  19517. 43: uint8(_BT_PLUS),
  19518. 44: uint8(_BT_COMMA),
  19519. 45: uint8(_BT_MINUS),
  19520. 46: uint8(_BT_NAME),
  19521. 47: uint8(_BT_SOL),
  19522. 48: uint8(_BT_DIGIT),
  19523. 49: uint8(_BT_DIGIT),
  19524. 50: uint8(_BT_DIGIT),
  19525. 51: uint8(_BT_DIGIT),
  19526. 52: uint8(_BT_DIGIT),
  19527. 53: uint8(_BT_DIGIT),
  19528. 54: uint8(_BT_DIGIT),
  19529. 55: uint8(_BT_DIGIT),
  19530. 56: uint8(_BT_DIGIT),
  19531. 57: uint8(_BT_DIGIT),
  19532. 58: uint8(_BT_COLON),
  19533. 59: uint8(_BT_SEMI),
  19534. 60: uint8(_BT_LT),
  19535. 61: uint8(_BT_EQUALS),
  19536. 62: uint8(_BT_GT),
  19537. 63: uint8(_BT_QUEST),
  19538. 64: uint8(_BT_OTHER),
  19539. 65: uint8(_BT_HEX),
  19540. 66: uint8(_BT_HEX),
  19541. 67: uint8(_BT_HEX),
  19542. 68: uint8(_BT_HEX),
  19543. 69: uint8(_BT_HEX),
  19544. 70: uint8(_BT_HEX),
  19545. 71: uint8(_BT_NMSTRT),
  19546. 72: uint8(_BT_NMSTRT),
  19547. 73: uint8(_BT_NMSTRT),
  19548. 74: uint8(_BT_NMSTRT),
  19549. 75: uint8(_BT_NMSTRT),
  19550. 76: uint8(_BT_NMSTRT),
  19551. 77: uint8(_BT_NMSTRT),
  19552. 78: uint8(_BT_NMSTRT),
  19553. 79: uint8(_BT_NMSTRT),
  19554. 80: uint8(_BT_NMSTRT),
  19555. 81: uint8(_BT_NMSTRT),
  19556. 82: uint8(_BT_NMSTRT),
  19557. 83: uint8(_BT_NMSTRT),
  19558. 84: uint8(_BT_NMSTRT),
  19559. 85: uint8(_BT_NMSTRT),
  19560. 86: uint8(_BT_NMSTRT),
  19561. 87: uint8(_BT_NMSTRT),
  19562. 88: uint8(_BT_NMSTRT),
  19563. 89: uint8(_BT_NMSTRT),
  19564. 90: uint8(_BT_NMSTRT),
  19565. 91: uint8(_BT_LSQB),
  19566. 92: uint8(_BT_OTHER),
  19567. 93: uint8(_BT_RSQB),
  19568. 94: uint8(_BT_OTHER),
  19569. 95: uint8(_BT_NMSTRT),
  19570. 96: uint8(_BT_OTHER),
  19571. 97: uint8(_BT_HEX),
  19572. 98: uint8(_BT_HEX),
  19573. 99: uint8(_BT_HEX),
  19574. 100: uint8(_BT_HEX),
  19575. 101: uint8(_BT_HEX),
  19576. 102: uint8(_BT_HEX),
  19577. 103: uint8(_BT_NMSTRT),
  19578. 104: uint8(_BT_NMSTRT),
  19579. 105: uint8(_BT_NMSTRT),
  19580. 106: uint8(_BT_NMSTRT),
  19581. 107: uint8(_BT_NMSTRT),
  19582. 108: uint8(_BT_NMSTRT),
  19583. 109: uint8(_BT_NMSTRT),
  19584. 110: uint8(_BT_NMSTRT),
  19585. 111: uint8(_BT_NMSTRT),
  19586. 112: uint8(_BT_NMSTRT),
  19587. 113: uint8(_BT_NMSTRT),
  19588. 114: uint8(_BT_NMSTRT),
  19589. 115: uint8(_BT_NMSTRT),
  19590. 116: uint8(_BT_NMSTRT),
  19591. 117: uint8(_BT_NMSTRT),
  19592. 118: uint8(_BT_NMSTRT),
  19593. 119: uint8(_BT_NMSTRT),
  19594. 120: uint8(_BT_NMSTRT),
  19595. 121: uint8(_BT_NMSTRT),
  19596. 122: uint8(_BT_NMSTRT),
  19597. 123: uint8(_BT_OTHER),
  19598. 124: uint8(_BT_VERBAR),
  19599. 125: uint8(_BT_OTHER),
  19600. 126: uint8(_BT_OTHER),
  19601. 127: uint8(_BT_OTHER),
  19602. 128: uint8(_BT_OTHER),
  19603. 129: uint8(_BT_OTHER),
  19604. 130: uint8(_BT_OTHER),
  19605. 131: uint8(_BT_OTHER),
  19606. 132: uint8(_BT_OTHER),
  19607. 133: uint8(_BT_OTHER),
  19608. 134: uint8(_BT_OTHER),
  19609. 135: uint8(_BT_OTHER),
  19610. 136: uint8(_BT_OTHER),
  19611. 137: uint8(_BT_OTHER),
  19612. 138: uint8(_BT_OTHER),
  19613. 139: uint8(_BT_OTHER),
  19614. 140: uint8(_BT_OTHER),
  19615. 141: uint8(_BT_OTHER),
  19616. 142: uint8(_BT_OTHER),
  19617. 143: uint8(_BT_OTHER),
  19618. 144: uint8(_BT_OTHER),
  19619. 145: uint8(_BT_OTHER),
  19620. 146: uint8(_BT_OTHER),
  19621. 147: uint8(_BT_OTHER),
  19622. 148: uint8(_BT_OTHER),
  19623. 149: uint8(_BT_OTHER),
  19624. 150: uint8(_BT_OTHER),
  19625. 151: uint8(_BT_OTHER),
  19626. 152: uint8(_BT_OTHER),
  19627. 153: uint8(_BT_OTHER),
  19628. 154: uint8(_BT_OTHER),
  19629. 155: uint8(_BT_OTHER),
  19630. 156: uint8(_BT_OTHER),
  19631. 157: uint8(_BT_OTHER),
  19632. 158: uint8(_BT_OTHER),
  19633. 159: uint8(_BT_OTHER),
  19634. 160: uint8(_BT_OTHER),
  19635. 161: uint8(_BT_OTHER),
  19636. 162: uint8(_BT_OTHER),
  19637. 163: uint8(_BT_OTHER),
  19638. 164: uint8(_BT_OTHER),
  19639. 165: uint8(_BT_OTHER),
  19640. 166: uint8(_BT_OTHER),
  19641. 167: uint8(_BT_OTHER),
  19642. 168: uint8(_BT_OTHER),
  19643. 169: uint8(_BT_OTHER),
  19644. 170: uint8(_BT_NMSTRT),
  19645. 171: uint8(_BT_OTHER),
  19646. 172: uint8(_BT_OTHER),
  19647. 173: uint8(_BT_OTHER),
  19648. 174: uint8(_BT_OTHER),
  19649. 175: uint8(_BT_OTHER),
  19650. 176: uint8(_BT_OTHER),
  19651. 177: uint8(_BT_OTHER),
  19652. 178: uint8(_BT_OTHER),
  19653. 179: uint8(_BT_OTHER),
  19654. 180: uint8(_BT_OTHER),
  19655. 181: uint8(_BT_NMSTRT),
  19656. 182: uint8(_BT_OTHER),
  19657. 183: uint8(_BT_NAME),
  19658. 184: uint8(_BT_OTHER),
  19659. 185: uint8(_BT_OTHER),
  19660. 186: uint8(_BT_NMSTRT),
  19661. 187: uint8(_BT_OTHER),
  19662. 188: uint8(_BT_OTHER),
  19663. 189: uint8(_BT_OTHER),
  19664. 190: uint8(_BT_OTHER),
  19665. 191: uint8(_BT_OTHER),
  19666. 192: uint8(_BT_NMSTRT),
  19667. 193: uint8(_BT_NMSTRT),
  19668. 194: uint8(_BT_NMSTRT),
  19669. 195: uint8(_BT_NMSTRT),
  19670. 196: uint8(_BT_NMSTRT),
  19671. 197: uint8(_BT_NMSTRT),
  19672. 198: uint8(_BT_NMSTRT),
  19673. 199: uint8(_BT_NMSTRT),
  19674. 200: uint8(_BT_NMSTRT),
  19675. 201: uint8(_BT_NMSTRT),
  19676. 202: uint8(_BT_NMSTRT),
  19677. 203: uint8(_BT_NMSTRT),
  19678. 204: uint8(_BT_NMSTRT),
  19679. 205: uint8(_BT_NMSTRT),
  19680. 206: uint8(_BT_NMSTRT),
  19681. 207: uint8(_BT_NMSTRT),
  19682. 208: uint8(_BT_NMSTRT),
  19683. 209: uint8(_BT_NMSTRT),
  19684. 210: uint8(_BT_NMSTRT),
  19685. 211: uint8(_BT_NMSTRT),
  19686. 212: uint8(_BT_NMSTRT),
  19687. 213: uint8(_BT_NMSTRT),
  19688. 214: uint8(_BT_NMSTRT),
  19689. 215: uint8(_BT_OTHER),
  19690. 216: uint8(_BT_NMSTRT),
  19691. 217: uint8(_BT_NMSTRT),
  19692. 218: uint8(_BT_NMSTRT),
  19693. 219: uint8(_BT_NMSTRT),
  19694. 220: uint8(_BT_NMSTRT),
  19695. 221: uint8(_BT_NMSTRT),
  19696. 222: uint8(_BT_NMSTRT),
  19697. 223: uint8(_BT_NMSTRT),
  19698. 224: uint8(_BT_NMSTRT),
  19699. 225: uint8(_BT_NMSTRT),
  19700. 226: uint8(_BT_NMSTRT),
  19701. 227: uint8(_BT_NMSTRT),
  19702. 228: uint8(_BT_NMSTRT),
  19703. 229: uint8(_BT_NMSTRT),
  19704. 230: uint8(_BT_NMSTRT),
  19705. 231: uint8(_BT_NMSTRT),
  19706. 232: uint8(_BT_NMSTRT),
  19707. 233: uint8(_BT_NMSTRT),
  19708. 234: uint8(_BT_NMSTRT),
  19709. 235: uint8(_BT_NMSTRT),
  19710. 236: uint8(_BT_NMSTRT),
  19711. 237: uint8(_BT_NMSTRT),
  19712. 238: uint8(_BT_NMSTRT),
  19713. 239: uint8(_BT_NMSTRT),
  19714. 240: uint8(_BT_NMSTRT),
  19715. 241: uint8(_BT_NMSTRT),
  19716. 242: uint8(_BT_NMSTRT),
  19717. 243: uint8(_BT_NMSTRT),
  19718. 244: uint8(_BT_NMSTRT),
  19719. 245: uint8(_BT_NMSTRT),
  19720. 246: uint8(_BT_NMSTRT),
  19721. 247: uint8(_BT_OTHER),
  19722. 248: uint8(_BT_NMSTRT),
  19723. 249: uint8(_BT_NMSTRT),
  19724. 250: uint8(_BT_NMSTRT),
  19725. 251: uint8(_BT_NMSTRT),
  19726. 252: uint8(_BT_NMSTRT),
  19727. 253: uint8(_BT_NMSTRT),
  19728. 254: uint8(_BT_NMSTRT),
  19729. 255: uint8(_BT_NMSTRT),
  19730. },
  19731. }
  19732. func init() {
  19733. p := unsafe.Pointer(&_latin1_encoding_ns)
  19734. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  19735. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  19736. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  19737. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  19738. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  19739. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  19740. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  19741. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  19742. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  19743. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  19744. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  19745. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  19746. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  19747. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  19748. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_latin1_toUtf8)
  19749. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  19750. }
  19751. var _latin1_encoding = Tnormal_encoding{
  19752. Fenc: TENCODING{
  19753. Fscanners: [4]TSCANNER{},
  19754. FliteralScanners: [2]TSCANNER{},
  19755. FminBytesPerChar: int32(1),
  19756. },
  19757. Ftype1: [256]uint8{
  19758. 9: uint8(_BT_S),
  19759. 10: uint8(_BT_LF),
  19760. 13: uint8(_BT_CR),
  19761. 32: uint8(_BT_S),
  19762. 33: uint8(_BT_EXCL),
  19763. 34: uint8(_BT_QUOT),
  19764. 35: uint8(_BT_NUM),
  19765. 36: uint8(_BT_OTHER),
  19766. 37: uint8(_BT_PERCNT),
  19767. 38: uint8(_BT_AMP),
  19768. 39: uint8(_BT_APOS),
  19769. 40: uint8(_BT_LPAR),
  19770. 41: uint8(_BT_RPAR),
  19771. 42: uint8(_BT_AST),
  19772. 43: uint8(_BT_PLUS),
  19773. 44: uint8(_BT_COMMA),
  19774. 45: uint8(_BT_MINUS),
  19775. 46: uint8(_BT_NAME),
  19776. 47: uint8(_BT_SOL),
  19777. 48: uint8(_BT_DIGIT),
  19778. 49: uint8(_BT_DIGIT),
  19779. 50: uint8(_BT_DIGIT),
  19780. 51: uint8(_BT_DIGIT),
  19781. 52: uint8(_BT_DIGIT),
  19782. 53: uint8(_BT_DIGIT),
  19783. 54: uint8(_BT_DIGIT),
  19784. 55: uint8(_BT_DIGIT),
  19785. 56: uint8(_BT_DIGIT),
  19786. 57: uint8(_BT_DIGIT),
  19787. 58: uint8(_BT_NMSTRT),
  19788. 59: uint8(_BT_SEMI),
  19789. 60: uint8(_BT_LT),
  19790. 61: uint8(_BT_EQUALS),
  19791. 62: uint8(_BT_GT),
  19792. 63: uint8(_BT_QUEST),
  19793. 64: uint8(_BT_OTHER),
  19794. 65: uint8(_BT_HEX),
  19795. 66: uint8(_BT_HEX),
  19796. 67: uint8(_BT_HEX),
  19797. 68: uint8(_BT_HEX),
  19798. 69: uint8(_BT_HEX),
  19799. 70: uint8(_BT_HEX),
  19800. 71: uint8(_BT_NMSTRT),
  19801. 72: uint8(_BT_NMSTRT),
  19802. 73: uint8(_BT_NMSTRT),
  19803. 74: uint8(_BT_NMSTRT),
  19804. 75: uint8(_BT_NMSTRT),
  19805. 76: uint8(_BT_NMSTRT),
  19806. 77: uint8(_BT_NMSTRT),
  19807. 78: uint8(_BT_NMSTRT),
  19808. 79: uint8(_BT_NMSTRT),
  19809. 80: uint8(_BT_NMSTRT),
  19810. 81: uint8(_BT_NMSTRT),
  19811. 82: uint8(_BT_NMSTRT),
  19812. 83: uint8(_BT_NMSTRT),
  19813. 84: uint8(_BT_NMSTRT),
  19814. 85: uint8(_BT_NMSTRT),
  19815. 86: uint8(_BT_NMSTRT),
  19816. 87: uint8(_BT_NMSTRT),
  19817. 88: uint8(_BT_NMSTRT),
  19818. 89: uint8(_BT_NMSTRT),
  19819. 90: uint8(_BT_NMSTRT),
  19820. 91: uint8(_BT_LSQB),
  19821. 92: uint8(_BT_OTHER),
  19822. 93: uint8(_BT_RSQB),
  19823. 94: uint8(_BT_OTHER),
  19824. 95: uint8(_BT_NMSTRT),
  19825. 96: uint8(_BT_OTHER),
  19826. 97: uint8(_BT_HEX),
  19827. 98: uint8(_BT_HEX),
  19828. 99: uint8(_BT_HEX),
  19829. 100: uint8(_BT_HEX),
  19830. 101: uint8(_BT_HEX),
  19831. 102: uint8(_BT_HEX),
  19832. 103: uint8(_BT_NMSTRT),
  19833. 104: uint8(_BT_NMSTRT),
  19834. 105: uint8(_BT_NMSTRT),
  19835. 106: uint8(_BT_NMSTRT),
  19836. 107: uint8(_BT_NMSTRT),
  19837. 108: uint8(_BT_NMSTRT),
  19838. 109: uint8(_BT_NMSTRT),
  19839. 110: uint8(_BT_NMSTRT),
  19840. 111: uint8(_BT_NMSTRT),
  19841. 112: uint8(_BT_NMSTRT),
  19842. 113: uint8(_BT_NMSTRT),
  19843. 114: uint8(_BT_NMSTRT),
  19844. 115: uint8(_BT_NMSTRT),
  19845. 116: uint8(_BT_NMSTRT),
  19846. 117: uint8(_BT_NMSTRT),
  19847. 118: uint8(_BT_NMSTRT),
  19848. 119: uint8(_BT_NMSTRT),
  19849. 120: uint8(_BT_NMSTRT),
  19850. 121: uint8(_BT_NMSTRT),
  19851. 122: uint8(_BT_NMSTRT),
  19852. 123: uint8(_BT_OTHER),
  19853. 124: uint8(_BT_VERBAR),
  19854. 125: uint8(_BT_OTHER),
  19855. 126: uint8(_BT_OTHER),
  19856. 127: uint8(_BT_OTHER),
  19857. 128: uint8(_BT_OTHER),
  19858. 129: uint8(_BT_OTHER),
  19859. 130: uint8(_BT_OTHER),
  19860. 131: uint8(_BT_OTHER),
  19861. 132: uint8(_BT_OTHER),
  19862. 133: uint8(_BT_OTHER),
  19863. 134: uint8(_BT_OTHER),
  19864. 135: uint8(_BT_OTHER),
  19865. 136: uint8(_BT_OTHER),
  19866. 137: uint8(_BT_OTHER),
  19867. 138: uint8(_BT_OTHER),
  19868. 139: uint8(_BT_OTHER),
  19869. 140: uint8(_BT_OTHER),
  19870. 141: uint8(_BT_OTHER),
  19871. 142: uint8(_BT_OTHER),
  19872. 143: uint8(_BT_OTHER),
  19873. 144: uint8(_BT_OTHER),
  19874. 145: uint8(_BT_OTHER),
  19875. 146: uint8(_BT_OTHER),
  19876. 147: uint8(_BT_OTHER),
  19877. 148: uint8(_BT_OTHER),
  19878. 149: uint8(_BT_OTHER),
  19879. 150: uint8(_BT_OTHER),
  19880. 151: uint8(_BT_OTHER),
  19881. 152: uint8(_BT_OTHER),
  19882. 153: uint8(_BT_OTHER),
  19883. 154: uint8(_BT_OTHER),
  19884. 155: uint8(_BT_OTHER),
  19885. 156: uint8(_BT_OTHER),
  19886. 157: uint8(_BT_OTHER),
  19887. 158: uint8(_BT_OTHER),
  19888. 159: uint8(_BT_OTHER),
  19889. 160: uint8(_BT_OTHER),
  19890. 161: uint8(_BT_OTHER),
  19891. 162: uint8(_BT_OTHER),
  19892. 163: uint8(_BT_OTHER),
  19893. 164: uint8(_BT_OTHER),
  19894. 165: uint8(_BT_OTHER),
  19895. 166: uint8(_BT_OTHER),
  19896. 167: uint8(_BT_OTHER),
  19897. 168: uint8(_BT_OTHER),
  19898. 169: uint8(_BT_OTHER),
  19899. 170: uint8(_BT_NMSTRT),
  19900. 171: uint8(_BT_OTHER),
  19901. 172: uint8(_BT_OTHER),
  19902. 173: uint8(_BT_OTHER),
  19903. 174: uint8(_BT_OTHER),
  19904. 175: uint8(_BT_OTHER),
  19905. 176: uint8(_BT_OTHER),
  19906. 177: uint8(_BT_OTHER),
  19907. 178: uint8(_BT_OTHER),
  19908. 179: uint8(_BT_OTHER),
  19909. 180: uint8(_BT_OTHER),
  19910. 181: uint8(_BT_NMSTRT),
  19911. 182: uint8(_BT_OTHER),
  19912. 183: uint8(_BT_NAME),
  19913. 184: uint8(_BT_OTHER),
  19914. 185: uint8(_BT_OTHER),
  19915. 186: uint8(_BT_NMSTRT),
  19916. 187: uint8(_BT_OTHER),
  19917. 188: uint8(_BT_OTHER),
  19918. 189: uint8(_BT_OTHER),
  19919. 190: uint8(_BT_OTHER),
  19920. 191: uint8(_BT_OTHER),
  19921. 192: uint8(_BT_NMSTRT),
  19922. 193: uint8(_BT_NMSTRT),
  19923. 194: uint8(_BT_NMSTRT),
  19924. 195: uint8(_BT_NMSTRT),
  19925. 196: uint8(_BT_NMSTRT),
  19926. 197: uint8(_BT_NMSTRT),
  19927. 198: uint8(_BT_NMSTRT),
  19928. 199: uint8(_BT_NMSTRT),
  19929. 200: uint8(_BT_NMSTRT),
  19930. 201: uint8(_BT_NMSTRT),
  19931. 202: uint8(_BT_NMSTRT),
  19932. 203: uint8(_BT_NMSTRT),
  19933. 204: uint8(_BT_NMSTRT),
  19934. 205: uint8(_BT_NMSTRT),
  19935. 206: uint8(_BT_NMSTRT),
  19936. 207: uint8(_BT_NMSTRT),
  19937. 208: uint8(_BT_NMSTRT),
  19938. 209: uint8(_BT_NMSTRT),
  19939. 210: uint8(_BT_NMSTRT),
  19940. 211: uint8(_BT_NMSTRT),
  19941. 212: uint8(_BT_NMSTRT),
  19942. 213: uint8(_BT_NMSTRT),
  19943. 214: uint8(_BT_NMSTRT),
  19944. 215: uint8(_BT_OTHER),
  19945. 216: uint8(_BT_NMSTRT),
  19946. 217: uint8(_BT_NMSTRT),
  19947. 218: uint8(_BT_NMSTRT),
  19948. 219: uint8(_BT_NMSTRT),
  19949. 220: uint8(_BT_NMSTRT),
  19950. 221: uint8(_BT_NMSTRT),
  19951. 222: uint8(_BT_NMSTRT),
  19952. 223: uint8(_BT_NMSTRT),
  19953. 224: uint8(_BT_NMSTRT),
  19954. 225: uint8(_BT_NMSTRT),
  19955. 226: uint8(_BT_NMSTRT),
  19956. 227: uint8(_BT_NMSTRT),
  19957. 228: uint8(_BT_NMSTRT),
  19958. 229: uint8(_BT_NMSTRT),
  19959. 230: uint8(_BT_NMSTRT),
  19960. 231: uint8(_BT_NMSTRT),
  19961. 232: uint8(_BT_NMSTRT),
  19962. 233: uint8(_BT_NMSTRT),
  19963. 234: uint8(_BT_NMSTRT),
  19964. 235: uint8(_BT_NMSTRT),
  19965. 236: uint8(_BT_NMSTRT),
  19966. 237: uint8(_BT_NMSTRT),
  19967. 238: uint8(_BT_NMSTRT),
  19968. 239: uint8(_BT_NMSTRT),
  19969. 240: uint8(_BT_NMSTRT),
  19970. 241: uint8(_BT_NMSTRT),
  19971. 242: uint8(_BT_NMSTRT),
  19972. 243: uint8(_BT_NMSTRT),
  19973. 244: uint8(_BT_NMSTRT),
  19974. 245: uint8(_BT_NMSTRT),
  19975. 246: uint8(_BT_NMSTRT),
  19976. 247: uint8(_BT_OTHER),
  19977. 248: uint8(_BT_NMSTRT),
  19978. 249: uint8(_BT_NMSTRT),
  19979. 250: uint8(_BT_NMSTRT),
  19980. 251: uint8(_BT_NMSTRT),
  19981. 252: uint8(_BT_NMSTRT),
  19982. 253: uint8(_BT_NMSTRT),
  19983. 254: uint8(_BT_NMSTRT),
  19984. 255: uint8(_BT_NMSTRT),
  19985. },
  19986. }
  19987. func init() {
  19988. p := unsafe.Pointer(&_latin1_encoding)
  19989. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  19990. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  19991. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  19992. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  19993. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  19994. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  19995. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  19996. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  19997. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  19998. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  19999. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  20000. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  20001. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  20002. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  20003. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_latin1_toUtf8)
  20004. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  20005. }
  20006. func _ascii_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  20007. var v1, v2, v3, v4 uintptr
  20008. _, _, _, _ = v1, v2, v3, v4
  20009. _ = enc
  20010. for *(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim {
  20011. v2 = toP
  20012. v1 = *(*uintptr)(unsafe.Pointer(v2))
  20013. *(*uintptr)(unsafe.Pointer(v2))++
  20014. v4 = fromP
  20015. v3 = *(*uintptr)(unsafe.Pointer(v4))
  20016. *(*uintptr)(unsafe.Pointer(v4))++
  20017. *(*int8)(unsafe.Pointer(v1)) = *(*int8)(unsafe.Pointer(v3))
  20018. }
  20019. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  20020. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  20021. } else {
  20022. return int32(_XML_CONVERT_COMPLETED)
  20023. }
  20024. return r
  20025. }
  20026. var _ascii_encoding_ns = Tnormal_encoding{
  20027. Fenc: TENCODING{
  20028. Fscanners: [4]TSCANNER{},
  20029. FliteralScanners: [2]TSCANNER{},
  20030. FminBytesPerChar: int32(1),
  20031. FisUtf8: int8(1),
  20032. },
  20033. Ftype1: [256]uint8{
  20034. 9: uint8(_BT_S),
  20035. 10: uint8(_BT_LF),
  20036. 13: uint8(_BT_CR),
  20037. 32: uint8(_BT_S),
  20038. 33: uint8(_BT_EXCL),
  20039. 34: uint8(_BT_QUOT),
  20040. 35: uint8(_BT_NUM),
  20041. 36: uint8(_BT_OTHER),
  20042. 37: uint8(_BT_PERCNT),
  20043. 38: uint8(_BT_AMP),
  20044. 39: uint8(_BT_APOS),
  20045. 40: uint8(_BT_LPAR),
  20046. 41: uint8(_BT_RPAR),
  20047. 42: uint8(_BT_AST),
  20048. 43: uint8(_BT_PLUS),
  20049. 44: uint8(_BT_COMMA),
  20050. 45: uint8(_BT_MINUS),
  20051. 46: uint8(_BT_NAME),
  20052. 47: uint8(_BT_SOL),
  20053. 48: uint8(_BT_DIGIT),
  20054. 49: uint8(_BT_DIGIT),
  20055. 50: uint8(_BT_DIGIT),
  20056. 51: uint8(_BT_DIGIT),
  20057. 52: uint8(_BT_DIGIT),
  20058. 53: uint8(_BT_DIGIT),
  20059. 54: uint8(_BT_DIGIT),
  20060. 55: uint8(_BT_DIGIT),
  20061. 56: uint8(_BT_DIGIT),
  20062. 57: uint8(_BT_DIGIT),
  20063. 58: uint8(_BT_COLON),
  20064. 59: uint8(_BT_SEMI),
  20065. 60: uint8(_BT_LT),
  20066. 61: uint8(_BT_EQUALS),
  20067. 62: uint8(_BT_GT),
  20068. 63: uint8(_BT_QUEST),
  20069. 64: uint8(_BT_OTHER),
  20070. 65: uint8(_BT_HEX),
  20071. 66: uint8(_BT_HEX),
  20072. 67: uint8(_BT_HEX),
  20073. 68: uint8(_BT_HEX),
  20074. 69: uint8(_BT_HEX),
  20075. 70: uint8(_BT_HEX),
  20076. 71: uint8(_BT_NMSTRT),
  20077. 72: uint8(_BT_NMSTRT),
  20078. 73: uint8(_BT_NMSTRT),
  20079. 74: uint8(_BT_NMSTRT),
  20080. 75: uint8(_BT_NMSTRT),
  20081. 76: uint8(_BT_NMSTRT),
  20082. 77: uint8(_BT_NMSTRT),
  20083. 78: uint8(_BT_NMSTRT),
  20084. 79: uint8(_BT_NMSTRT),
  20085. 80: uint8(_BT_NMSTRT),
  20086. 81: uint8(_BT_NMSTRT),
  20087. 82: uint8(_BT_NMSTRT),
  20088. 83: uint8(_BT_NMSTRT),
  20089. 84: uint8(_BT_NMSTRT),
  20090. 85: uint8(_BT_NMSTRT),
  20091. 86: uint8(_BT_NMSTRT),
  20092. 87: uint8(_BT_NMSTRT),
  20093. 88: uint8(_BT_NMSTRT),
  20094. 89: uint8(_BT_NMSTRT),
  20095. 90: uint8(_BT_NMSTRT),
  20096. 91: uint8(_BT_LSQB),
  20097. 92: uint8(_BT_OTHER),
  20098. 93: uint8(_BT_RSQB),
  20099. 94: uint8(_BT_OTHER),
  20100. 95: uint8(_BT_NMSTRT),
  20101. 96: uint8(_BT_OTHER),
  20102. 97: uint8(_BT_HEX),
  20103. 98: uint8(_BT_HEX),
  20104. 99: uint8(_BT_HEX),
  20105. 100: uint8(_BT_HEX),
  20106. 101: uint8(_BT_HEX),
  20107. 102: uint8(_BT_HEX),
  20108. 103: uint8(_BT_NMSTRT),
  20109. 104: uint8(_BT_NMSTRT),
  20110. 105: uint8(_BT_NMSTRT),
  20111. 106: uint8(_BT_NMSTRT),
  20112. 107: uint8(_BT_NMSTRT),
  20113. 108: uint8(_BT_NMSTRT),
  20114. 109: uint8(_BT_NMSTRT),
  20115. 110: uint8(_BT_NMSTRT),
  20116. 111: uint8(_BT_NMSTRT),
  20117. 112: uint8(_BT_NMSTRT),
  20118. 113: uint8(_BT_NMSTRT),
  20119. 114: uint8(_BT_NMSTRT),
  20120. 115: uint8(_BT_NMSTRT),
  20121. 116: uint8(_BT_NMSTRT),
  20122. 117: uint8(_BT_NMSTRT),
  20123. 118: uint8(_BT_NMSTRT),
  20124. 119: uint8(_BT_NMSTRT),
  20125. 120: uint8(_BT_NMSTRT),
  20126. 121: uint8(_BT_NMSTRT),
  20127. 122: uint8(_BT_NMSTRT),
  20128. 123: uint8(_BT_OTHER),
  20129. 124: uint8(_BT_VERBAR),
  20130. 125: uint8(_BT_OTHER),
  20131. 126: uint8(_BT_OTHER),
  20132. 127: uint8(_BT_OTHER),
  20133. },
  20134. }
  20135. func init() {
  20136. p := unsafe.Pointer(&_ascii_encoding_ns)
  20137. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  20138. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  20139. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  20140. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  20141. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  20142. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  20143. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  20144. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  20145. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  20146. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  20147. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  20148. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  20149. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  20150. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  20151. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_ascii_toUtf8)
  20152. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  20153. }
  20154. var _ascii_encoding = Tnormal_encoding{
  20155. Fenc: TENCODING{
  20156. Fscanners: [4]TSCANNER{},
  20157. FliteralScanners: [2]TSCANNER{},
  20158. FminBytesPerChar: int32(1),
  20159. FisUtf8: int8(1),
  20160. },
  20161. Ftype1: [256]uint8{
  20162. 9: uint8(_BT_S),
  20163. 10: uint8(_BT_LF),
  20164. 13: uint8(_BT_CR),
  20165. 32: uint8(_BT_S),
  20166. 33: uint8(_BT_EXCL),
  20167. 34: uint8(_BT_QUOT),
  20168. 35: uint8(_BT_NUM),
  20169. 36: uint8(_BT_OTHER),
  20170. 37: uint8(_BT_PERCNT),
  20171. 38: uint8(_BT_AMP),
  20172. 39: uint8(_BT_APOS),
  20173. 40: uint8(_BT_LPAR),
  20174. 41: uint8(_BT_RPAR),
  20175. 42: uint8(_BT_AST),
  20176. 43: uint8(_BT_PLUS),
  20177. 44: uint8(_BT_COMMA),
  20178. 45: uint8(_BT_MINUS),
  20179. 46: uint8(_BT_NAME),
  20180. 47: uint8(_BT_SOL),
  20181. 48: uint8(_BT_DIGIT),
  20182. 49: uint8(_BT_DIGIT),
  20183. 50: uint8(_BT_DIGIT),
  20184. 51: uint8(_BT_DIGIT),
  20185. 52: uint8(_BT_DIGIT),
  20186. 53: uint8(_BT_DIGIT),
  20187. 54: uint8(_BT_DIGIT),
  20188. 55: uint8(_BT_DIGIT),
  20189. 56: uint8(_BT_DIGIT),
  20190. 57: uint8(_BT_DIGIT),
  20191. 58: uint8(_BT_NMSTRT),
  20192. 59: uint8(_BT_SEMI),
  20193. 60: uint8(_BT_LT),
  20194. 61: uint8(_BT_EQUALS),
  20195. 62: uint8(_BT_GT),
  20196. 63: uint8(_BT_QUEST),
  20197. 64: uint8(_BT_OTHER),
  20198. 65: uint8(_BT_HEX),
  20199. 66: uint8(_BT_HEX),
  20200. 67: uint8(_BT_HEX),
  20201. 68: uint8(_BT_HEX),
  20202. 69: uint8(_BT_HEX),
  20203. 70: uint8(_BT_HEX),
  20204. 71: uint8(_BT_NMSTRT),
  20205. 72: uint8(_BT_NMSTRT),
  20206. 73: uint8(_BT_NMSTRT),
  20207. 74: uint8(_BT_NMSTRT),
  20208. 75: uint8(_BT_NMSTRT),
  20209. 76: uint8(_BT_NMSTRT),
  20210. 77: uint8(_BT_NMSTRT),
  20211. 78: uint8(_BT_NMSTRT),
  20212. 79: uint8(_BT_NMSTRT),
  20213. 80: uint8(_BT_NMSTRT),
  20214. 81: uint8(_BT_NMSTRT),
  20215. 82: uint8(_BT_NMSTRT),
  20216. 83: uint8(_BT_NMSTRT),
  20217. 84: uint8(_BT_NMSTRT),
  20218. 85: uint8(_BT_NMSTRT),
  20219. 86: uint8(_BT_NMSTRT),
  20220. 87: uint8(_BT_NMSTRT),
  20221. 88: uint8(_BT_NMSTRT),
  20222. 89: uint8(_BT_NMSTRT),
  20223. 90: uint8(_BT_NMSTRT),
  20224. 91: uint8(_BT_LSQB),
  20225. 92: uint8(_BT_OTHER),
  20226. 93: uint8(_BT_RSQB),
  20227. 94: uint8(_BT_OTHER),
  20228. 95: uint8(_BT_NMSTRT),
  20229. 96: uint8(_BT_OTHER),
  20230. 97: uint8(_BT_HEX),
  20231. 98: uint8(_BT_HEX),
  20232. 99: uint8(_BT_HEX),
  20233. 100: uint8(_BT_HEX),
  20234. 101: uint8(_BT_HEX),
  20235. 102: uint8(_BT_HEX),
  20236. 103: uint8(_BT_NMSTRT),
  20237. 104: uint8(_BT_NMSTRT),
  20238. 105: uint8(_BT_NMSTRT),
  20239. 106: uint8(_BT_NMSTRT),
  20240. 107: uint8(_BT_NMSTRT),
  20241. 108: uint8(_BT_NMSTRT),
  20242. 109: uint8(_BT_NMSTRT),
  20243. 110: uint8(_BT_NMSTRT),
  20244. 111: uint8(_BT_NMSTRT),
  20245. 112: uint8(_BT_NMSTRT),
  20246. 113: uint8(_BT_NMSTRT),
  20247. 114: uint8(_BT_NMSTRT),
  20248. 115: uint8(_BT_NMSTRT),
  20249. 116: uint8(_BT_NMSTRT),
  20250. 117: uint8(_BT_NMSTRT),
  20251. 118: uint8(_BT_NMSTRT),
  20252. 119: uint8(_BT_NMSTRT),
  20253. 120: uint8(_BT_NMSTRT),
  20254. 121: uint8(_BT_NMSTRT),
  20255. 122: uint8(_BT_NMSTRT),
  20256. 123: uint8(_BT_OTHER),
  20257. 124: uint8(_BT_VERBAR),
  20258. 125: uint8(_BT_OTHER),
  20259. 126: uint8(_BT_OTHER),
  20260. 127: uint8(_BT_OTHER),
  20261. },
  20262. }
  20263. func init() {
  20264. p := unsafe.Pointer(&_ascii_encoding)
  20265. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  20266. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  20267. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  20268. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  20269. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  20270. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  20271. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  20272. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  20273. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  20274. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  20275. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  20276. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  20277. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  20278. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  20279. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_ascii_toUtf8)
  20280. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  20281. }
  20282. func _unicode_byte_type(tls *libc.TLS, hi int8, lo int8) (r int32) {
  20283. switch libc.Int32FromUint8(libc.Uint8FromInt8(hi)) {
  20284. /* 0xD800-0xDBFF first 16-bit code unit or high surrogate (W1) */
  20285. case int32(0xD8):
  20286. fallthrough
  20287. case int32(0xD9):
  20288. fallthrough
  20289. case int32(0xDA):
  20290. fallthrough
  20291. case int32(0xDB):
  20292. return int32(_BT_LEAD4)
  20293. /* 0xDC00-0xDFFF second 16-bit code unit or low surrogate (W2) */
  20294. fallthrough
  20295. case int32(0xDC):
  20296. fallthrough
  20297. case int32(0xDD):
  20298. fallthrough
  20299. case int32(0xDE):
  20300. fallthrough
  20301. case int32(0xDF):
  20302. return int32(_BT_TRAIL)
  20303. case int32(0xFF):
  20304. switch libc.Int32FromUint8(libc.Uint8FromInt8(lo)) {
  20305. case int32(0xFF): /* noncharacter-FFFF */
  20306. fallthrough
  20307. case int32(0xFE): /* noncharacter-FFFE */
  20308. return int32(_BT_NONXML)
  20309. }
  20310. break
  20311. }
  20312. return int32(_BT_NONASCII)
  20313. }
  20314. func _little2_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  20315. var from, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v3, v4, v5, v6, v7, v8, v9 uintptr
  20316. var hi, lo, lo2 uint8
  20317. var plane int32
  20318. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  20319. from = *(*uintptr)(unsafe.Pointer(fromP))
  20320. _ = enc
  20321. fromLim = from + uintptr((int64(fromLim)-int64(from))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */
  20322. for {
  20323. if !(from < fromLim) {
  20324. break
  20325. }
  20326. lo = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from)))
  20327. hi = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from + 1)))
  20328. switch libc.Int32FromUint8(hi) {
  20329. case 0:
  20330. if libc.Int32FromUint8(lo) < int32(0x80) {
  20331. if *(*uintptr)(unsafe.Pointer(toP)) == toLim {
  20332. *(*uintptr)(unsafe.Pointer(fromP)) = from
  20333. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  20334. }
  20335. v3 = toP
  20336. v2 = *(*uintptr)(unsafe.Pointer(v3))
  20337. *(*uintptr)(unsafe.Pointer(v3))++
  20338. *(*int8)(unsafe.Pointer(v2)) = libc.Int8FromUint8(lo)
  20339. break
  20340. } /* fall through */
  20341. fallthrough
  20342. case int32(0x1):
  20343. fallthrough
  20344. case int32(0x2):
  20345. fallthrough
  20346. case int32(0x3):
  20347. fallthrough
  20348. case int32(0x4):
  20349. fallthrough
  20350. case int32(0x5):
  20351. fallthrough
  20352. case int32(0x6):
  20353. fallthrough
  20354. case int32(0x7):
  20355. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(2) {
  20356. *(*uintptr)(unsafe.Pointer(fromP)) = from
  20357. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  20358. }
  20359. v5 = toP
  20360. v4 = *(*uintptr)(unsafe.Pointer(v5))
  20361. *(*uintptr)(unsafe.Pointer(v5))++
  20362. *(*int8)(unsafe.Pointer(v4)) = int8(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromUint8(hi)<<libc.Int32FromInt32(2) | int32(_UTF8_cval2))
  20363. v7 = toP
  20364. v6 = *(*uintptr)(unsafe.Pointer(v7))
  20365. *(*uintptr)(unsafe.Pointer(v7))++
  20366. *(*int8)(unsafe.Pointer(v6)) = int8(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  20367. default:
  20368. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(3) {
  20369. *(*uintptr)(unsafe.Pointer(fromP)) = from
  20370. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  20371. } /* 16 bits divided 4, 6, 6 amongst 3 bytes */
  20372. v9 = toP
  20373. v8 = *(*uintptr)(unsafe.Pointer(v9))
  20374. *(*uintptr)(unsafe.Pointer(v9))++
  20375. *(*int8)(unsafe.Pointer(v8)) = int8(libc.Int32FromUint8(hi)>>libc.Int32FromInt32(4) | int32(_UTF8_cval3))
  20376. v11 = toP
  20377. v10 = *(*uintptr)(unsafe.Pointer(v11))
  20378. *(*uintptr)(unsafe.Pointer(v11))++
  20379. *(*int8)(unsafe.Pointer(v10)) = int8(libc.Int32FromUint8(hi)&libc.Int32FromInt32(0xf)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  20380. v13 = toP
  20381. v12 = *(*uintptr)(unsafe.Pointer(v13))
  20382. *(*uintptr)(unsafe.Pointer(v13))++
  20383. *(*int8)(unsafe.Pointer(v12)) = int8(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  20384. case int32(0xD8):
  20385. fallthrough
  20386. case int32(0xD9):
  20387. fallthrough
  20388. case int32(0xDA):
  20389. fallthrough
  20390. case int32(0xDB):
  20391. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(4) {
  20392. *(*uintptr)(unsafe.Pointer(fromP)) = from
  20393. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  20394. }
  20395. if int64(fromLim)-int64(from) < int64(4) {
  20396. *(*uintptr)(unsafe.Pointer(fromP)) = from
  20397. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  20398. }
  20399. plane = libc.Int32FromUint8(hi)&int32(0x3)<<int32(2) | libc.Int32FromUint8(lo)>>int32(6)&int32(0x3) + int32(1)
  20400. v15 = toP
  20401. v14 = *(*uintptr)(unsafe.Pointer(v15))
  20402. *(*uintptr)(unsafe.Pointer(v15))++
  20403. *(*int8)(unsafe.Pointer(v14)) = int8(plane>>libc.Int32FromInt32(2) | int32(_UTF8_cval4))
  20404. v17 = toP
  20405. v16 = *(*uintptr)(unsafe.Pointer(v17))
  20406. *(*uintptr)(unsafe.Pointer(v17))++
  20407. *(*int8)(unsafe.Pointer(v16)) = int8(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(2)&libc.Int32FromInt32(0xF) | plane&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromInt32(0x80))
  20408. from += uintptr(2)
  20409. lo2 = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from)))
  20410. v19 = toP
  20411. v18 = *(*uintptr)(unsafe.Pointer(v19))
  20412. *(*uintptr)(unsafe.Pointer(v19))++
  20413. *(*int8)(unsafe.Pointer(v18)) = int8(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from + 1))))&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo2)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  20414. v21 = toP
  20415. v20 = *(*uintptr)(unsafe.Pointer(v21))
  20416. *(*uintptr)(unsafe.Pointer(v21))++
  20417. *(*int8)(unsafe.Pointer(v20)) = int8(libc.Int32FromUint8(lo2)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  20418. break
  20419. }
  20420. goto _1
  20421. _1:
  20422. ;
  20423. from += uintptr(2)
  20424. }
  20425. *(*uintptr)(unsafe.Pointer(fromP)) = from
  20426. if from < fromLim {
  20427. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  20428. } else {
  20429. return int32(_XML_CONVERT_COMPLETED)
  20430. }
  20431. return r
  20432. }
  20433. func _little2_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  20434. var res _XML_Convert_Result
  20435. var v2, v3 uintptr
  20436. _, _, _ = res, v2, v3
  20437. res = int32(_XML_CONVERT_COMPLETED)
  20438. _ = enc
  20439. fromLim = *(*uintptr)(unsafe.Pointer(fromP)) + uintptr((int64(fromLim)-int64(*(*uintptr)(unsafe.Pointer(fromP))))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */ /* Avoid copying first half only of surrogate */
  20440. if int64(fromLim)-int64(*(*uintptr)(unsafe.Pointer(fromP))) > (int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))))/2<<libc.Int32FromInt32(1) && libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(fromLim - libc.UintptrFromInt32(2) + 1))))&int32(0xF8) == int32(0xD8) {
  20441. fromLim -= uintptr(2)
  20442. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  20443. }
  20444. for {
  20445. if !(*(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim) {
  20446. break
  20447. }
  20448. v3 = toP
  20449. v2 = *(*uintptr)(unsafe.Pointer(v3))
  20450. *(*uintptr)(unsafe.Pointer(v3)) += 2
  20451. *(*uint16)(unsafe.Pointer(v2)) = libc.Uint16FromInt32(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)) + 1))))<<int32(8) | libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)))))))
  20452. goto _1
  20453. _1:
  20454. ;
  20455. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(2)
  20456. }
  20457. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  20458. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  20459. } else {
  20460. return res
  20461. }
  20462. return r
  20463. }
  20464. func _big2_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  20465. var from, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v3, v4, v5, v6, v7, v8, v9 uintptr
  20466. var hi, lo, lo2 uint8
  20467. var plane int32
  20468. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  20469. from = *(*uintptr)(unsafe.Pointer(fromP))
  20470. _ = enc
  20471. fromLim = from + uintptr((int64(fromLim)-int64(from))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */
  20472. for {
  20473. if !(from < fromLim) {
  20474. break
  20475. }
  20476. lo = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from + 1)))
  20477. hi = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from)))
  20478. switch libc.Int32FromUint8(hi) {
  20479. case 0:
  20480. if libc.Int32FromUint8(lo) < int32(0x80) {
  20481. if *(*uintptr)(unsafe.Pointer(toP)) == toLim {
  20482. *(*uintptr)(unsafe.Pointer(fromP)) = from
  20483. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  20484. }
  20485. v3 = toP
  20486. v2 = *(*uintptr)(unsafe.Pointer(v3))
  20487. *(*uintptr)(unsafe.Pointer(v3))++
  20488. *(*int8)(unsafe.Pointer(v2)) = libc.Int8FromUint8(lo)
  20489. break
  20490. } /* fall through */
  20491. fallthrough
  20492. case int32(0x1):
  20493. fallthrough
  20494. case int32(0x2):
  20495. fallthrough
  20496. case int32(0x3):
  20497. fallthrough
  20498. case int32(0x4):
  20499. fallthrough
  20500. case int32(0x5):
  20501. fallthrough
  20502. case int32(0x6):
  20503. fallthrough
  20504. case int32(0x7):
  20505. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(2) {
  20506. *(*uintptr)(unsafe.Pointer(fromP)) = from
  20507. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  20508. }
  20509. v5 = toP
  20510. v4 = *(*uintptr)(unsafe.Pointer(v5))
  20511. *(*uintptr)(unsafe.Pointer(v5))++
  20512. *(*int8)(unsafe.Pointer(v4)) = int8(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromUint8(hi)<<libc.Int32FromInt32(2) | int32(_UTF8_cval2))
  20513. v7 = toP
  20514. v6 = *(*uintptr)(unsafe.Pointer(v7))
  20515. *(*uintptr)(unsafe.Pointer(v7))++
  20516. *(*int8)(unsafe.Pointer(v6)) = int8(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  20517. default:
  20518. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(3) {
  20519. *(*uintptr)(unsafe.Pointer(fromP)) = from
  20520. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  20521. } /* 16 bits divided 4, 6, 6 amongst 3 bytes */
  20522. v9 = toP
  20523. v8 = *(*uintptr)(unsafe.Pointer(v9))
  20524. *(*uintptr)(unsafe.Pointer(v9))++
  20525. *(*int8)(unsafe.Pointer(v8)) = int8(libc.Int32FromUint8(hi)>>libc.Int32FromInt32(4) | int32(_UTF8_cval3))
  20526. v11 = toP
  20527. v10 = *(*uintptr)(unsafe.Pointer(v11))
  20528. *(*uintptr)(unsafe.Pointer(v11))++
  20529. *(*int8)(unsafe.Pointer(v10)) = int8(libc.Int32FromUint8(hi)&libc.Int32FromInt32(0xf)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  20530. v13 = toP
  20531. v12 = *(*uintptr)(unsafe.Pointer(v13))
  20532. *(*uintptr)(unsafe.Pointer(v13))++
  20533. *(*int8)(unsafe.Pointer(v12)) = int8(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  20534. case int32(0xD8):
  20535. fallthrough
  20536. case int32(0xD9):
  20537. fallthrough
  20538. case int32(0xDA):
  20539. fallthrough
  20540. case int32(0xDB):
  20541. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(4) {
  20542. *(*uintptr)(unsafe.Pointer(fromP)) = from
  20543. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  20544. }
  20545. if int64(fromLim)-int64(from) < int64(4) {
  20546. *(*uintptr)(unsafe.Pointer(fromP)) = from
  20547. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  20548. }
  20549. plane = libc.Int32FromUint8(hi)&int32(0x3)<<int32(2) | libc.Int32FromUint8(lo)>>int32(6)&int32(0x3) + int32(1)
  20550. v15 = toP
  20551. v14 = *(*uintptr)(unsafe.Pointer(v15))
  20552. *(*uintptr)(unsafe.Pointer(v15))++
  20553. *(*int8)(unsafe.Pointer(v14)) = int8(plane>>libc.Int32FromInt32(2) | int32(_UTF8_cval4))
  20554. v17 = toP
  20555. v16 = *(*uintptr)(unsafe.Pointer(v17))
  20556. *(*uintptr)(unsafe.Pointer(v17))++
  20557. *(*int8)(unsafe.Pointer(v16)) = int8(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(2)&libc.Int32FromInt32(0xF) | plane&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromInt32(0x80))
  20558. from += uintptr(2)
  20559. lo2 = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from + 1)))
  20560. v19 = toP
  20561. v18 = *(*uintptr)(unsafe.Pointer(v19))
  20562. *(*uintptr)(unsafe.Pointer(v19))++
  20563. *(*int8)(unsafe.Pointer(v18)) = int8(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from))))&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo2)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  20564. v21 = toP
  20565. v20 = *(*uintptr)(unsafe.Pointer(v21))
  20566. *(*uintptr)(unsafe.Pointer(v21))++
  20567. *(*int8)(unsafe.Pointer(v20)) = int8(libc.Int32FromUint8(lo2)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  20568. break
  20569. }
  20570. goto _1
  20571. _1:
  20572. ;
  20573. from += uintptr(2)
  20574. }
  20575. *(*uintptr)(unsafe.Pointer(fromP)) = from
  20576. if from < fromLim {
  20577. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  20578. } else {
  20579. return int32(_XML_CONVERT_COMPLETED)
  20580. }
  20581. return r
  20582. }
  20583. func _big2_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  20584. var res _XML_Convert_Result
  20585. var v2, v3 uintptr
  20586. _, _, _ = res, v2, v3
  20587. res = int32(_XML_CONVERT_COMPLETED)
  20588. _ = enc
  20589. fromLim = *(*uintptr)(unsafe.Pointer(fromP)) + uintptr((int64(fromLim)-int64(*(*uintptr)(unsafe.Pointer(fromP))))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */ /* Avoid copying first half only of surrogate */
  20590. if int64(fromLim)-int64(*(*uintptr)(unsafe.Pointer(fromP))) > (int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))))/2<<libc.Int32FromInt32(1) && libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(fromLim - libc.UintptrFromInt32(2)))))&int32(0xF8) == int32(0xD8) {
  20591. fromLim -= uintptr(2)
  20592. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  20593. }
  20594. for {
  20595. if !(*(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim) {
  20596. break
  20597. }
  20598. v3 = toP
  20599. v2 = *(*uintptr)(unsafe.Pointer(v3))
  20600. *(*uintptr)(unsafe.Pointer(v3)) += 2
  20601. *(*uint16)(unsafe.Pointer(v2)) = libc.Uint16FromInt32(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP))))))<<int32(8) | libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)) + 1)))))
  20602. goto _1
  20603. _1:
  20604. ;
  20605. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(2)
  20606. }
  20607. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  20608. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  20609. } else {
  20610. return res
  20611. }
  20612. return r
  20613. }
  20614. /* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
  20615. /* This file is included (from xmltok.c, 1-3 times depending on XML_MIN_SIZE)!
  20616. __ __ _
  20617. ___\ \/ /_ __ __ _| |_
  20618. / _ \\ /| '_ \ / _` | __|
  20619. | __// \| |_) | (_| | |_
  20620. \___/_/\_\ .__/ \__,_|\__|
  20621. |_| XML parser
  20622. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  20623. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  20624. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  20625. Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
  20626. Copyright (c) 2016-2022 Sebastian Pipping <sebastian@pipping.org>
  20627. Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
  20628. Copyright (c) 2018 Benjamin Peterson <benjamin@python.org>
  20629. Copyright (c) 2018 Anton Maklakov <antmak.pub@gmail.com>
  20630. Copyright (c) 2019 David Loffredo <loffredo@steptools.com>
  20631. Copyright (c) 2020 Boris Kolpackov <boris@codesynthesis.com>
  20632. Copyright (c) 2022 Martin Ettl <ettl.martin78@googlemail.com>
  20633. Licensed under the MIT license:
  20634. Permission is hereby granted, free of charge, to any person obtaining
  20635. a copy of this software and associated documentation files (the
  20636. "Software"), to deal in the Software without restriction, including
  20637. without limitation the rights to use, copy, modify, merge, publish,
  20638. distribute, sublicense, and/or sell copies of the Software, and to permit
  20639. persons to whom the Software is furnished to do so, subject to the
  20640. following conditions:
  20641. The above copyright notice and this permission notice shall be included
  20642. in all copies or substantial portions of the Software.
  20643. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  20644. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  20645. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  20646. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  20647. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  20648. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  20649. USE OR OTHER DEALINGS IN THE SOFTWARE.
  20650. */
  20651. /* ptr points to character following "<!-" */
  20652. func _little2_scanComment(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20653. var v1 int32
  20654. _ = v1
  20655. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20656. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_MINUS1)) {
  20657. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20658. return m_XML_TOK_INVALID
  20659. }
  20660. ptr += uintptr(2)
  20661. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20662. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20663. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20664. } else {
  20665. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20666. }
  20667. switch v1 {
  20668. case int32(_BT_LEAD2):
  20669. if int64(end)-int64(ptr) < int64(2) {
  20670. return -int32(2)
  20671. }
  20672. if 0 != 0 {
  20673. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20674. return m_XML_TOK_INVALID
  20675. }
  20676. ptr += uintptr(2)
  20677. case int32(_BT_LEAD3):
  20678. if int64(end)-int64(ptr) < int64(3) {
  20679. return -int32(2)
  20680. }
  20681. if 0 != 0 {
  20682. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20683. return m_XML_TOK_INVALID
  20684. }
  20685. ptr += uintptr(3)
  20686. case int32(_BT_LEAD4):
  20687. if int64(end)-int64(ptr) < int64(4) {
  20688. return -int32(2)
  20689. }
  20690. if 0 != 0 {
  20691. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20692. return m_XML_TOK_INVALID
  20693. }
  20694. ptr += uintptr(4)
  20695. case int32(_BT_NONXML):
  20696. fallthrough
  20697. case int32(_BT_MALFORM):
  20698. fallthrough
  20699. case int32(_BT_TRAIL):
  20700. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20701. return m_XML_TOK_INVALID
  20702. case int32(_BT_MINUS):
  20703. ptr += uintptr(2)
  20704. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20705. return -int32(1)
  20706. }
  20707. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_MINUS1) {
  20708. ptr += uintptr(2)
  20709. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20710. return -int32(1)
  20711. }
  20712. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  20713. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20714. return m_XML_TOK_INVALID
  20715. }
  20716. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20717. return int32(m_XML_TOK_COMMENT)
  20718. }
  20719. default:
  20720. ptr += uintptr(2)
  20721. break
  20722. }
  20723. }
  20724. }
  20725. return -int32(1)
  20726. }
  20727. /* ptr points to character following "<!" */
  20728. func _little2_scanDecl(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20729. var v1, v2, v3 int32
  20730. _, _, _ = v1, v2, v3
  20731. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20732. return -int32(1)
  20733. }
  20734. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20735. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20736. } else {
  20737. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20738. }
  20739. switch v1 {
  20740. case int32(_BT_MINUS):
  20741. return _little2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20742. case int32(_BT_LSQB):
  20743. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20744. return int32(m_XML_TOK_COND_SECT_OPEN)
  20745. case int32(_BT_NMSTRT):
  20746. fallthrough
  20747. case int32(_BT_HEX):
  20748. ptr += uintptr(2)
  20749. default:
  20750. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20751. return m_XML_TOK_INVALID
  20752. }
  20753. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20754. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20755. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20756. } else {
  20757. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20758. }
  20759. switch v2 {
  20760. case int32(_BT_PERCNT):
  20761. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  20762. return -int32(1)
  20763. }
  20764. /* don't allow <!ENTITY% foo "whatever"> */
  20765. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 {
  20766. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))))))
  20767. } else {
  20768. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)), *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))
  20769. }
  20770. switch v3 {
  20771. case int32(_BT_S):
  20772. fallthrough
  20773. case int32(_BT_CR):
  20774. fallthrough
  20775. case int32(_BT_LF):
  20776. fallthrough
  20777. case int32(_BT_PERCNT):
  20778. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20779. return m_XML_TOK_INVALID
  20780. }
  20781. /* fall through */
  20782. fallthrough
  20783. case int32(_BT_S):
  20784. fallthrough
  20785. case int32(_BT_CR):
  20786. fallthrough
  20787. case int32(_BT_LF):
  20788. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20789. return int32(m_XML_TOK_DECL_OPEN)
  20790. case int32(_BT_NMSTRT):
  20791. fallthrough
  20792. case int32(_BT_HEX):
  20793. ptr += uintptr(2)
  20794. default:
  20795. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20796. return m_XML_TOK_INVALID
  20797. }
  20798. }
  20799. return -int32(1)
  20800. }
  20801. func _little2_checkPiTarget(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, tokPtr uintptr) (r int32) {
  20802. var upper, v1, v2, v3 int32
  20803. _, _, _, _ = upper, v1, v2, v3
  20804. upper = 0
  20805. _ = enc
  20806. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_PI)
  20807. if int64(end)-int64(ptr) != int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(3)) {
  20808. return int32(1)
  20809. }
  20810. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20811. v1 = int32(*(*int8)(unsafe.Pointer(ptr)))
  20812. } else {
  20813. v1 = -int32(1)
  20814. }
  20815. switch v1 {
  20816. case int32(m_ASCII_x2):
  20817. case int32(m_ASCII_X):
  20818. upper = int32(1)
  20819. default:
  20820. return int32(1)
  20821. }
  20822. ptr += uintptr(2)
  20823. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20824. v2 = int32(*(*int8)(unsafe.Pointer(ptr)))
  20825. } else {
  20826. v2 = -int32(1)
  20827. }
  20828. switch v2 {
  20829. case int32(m_ASCII_m2):
  20830. case int32(m_ASCII_M):
  20831. upper = int32(1)
  20832. default:
  20833. return int32(1)
  20834. }
  20835. ptr += uintptr(2)
  20836. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20837. v3 = int32(*(*int8)(unsafe.Pointer(ptr)))
  20838. } else {
  20839. v3 = -int32(1)
  20840. }
  20841. switch v3 {
  20842. case int32(m_ASCII_l2):
  20843. case int32(m_ASCII_L):
  20844. upper = int32(1)
  20845. default:
  20846. return int32(1)
  20847. }
  20848. if upper != 0 {
  20849. return 0
  20850. }
  20851. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_XML_DECL)
  20852. return int32(1)
  20853. }
  20854. /* ptr points to character following "<?" */
  20855. func _little2_scanPi(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20856. bp := tls.Alloc(16)
  20857. defer tls.Free(16)
  20858. var target uintptr
  20859. var v1, v2, v3 int32
  20860. var _ /* tok at bp+0 */ int32
  20861. _, _, _, _ = target, v1, v2, v3
  20862. target = ptr
  20863. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20864. return -int32(1)
  20865. }
  20866. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20867. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20868. } else {
  20869. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20870. }
  20871. switch v1 {
  20872. case int32(_BT_NONASCII):
  20873. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  20874. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20875. return m_XML_TOK_INVALID
  20876. } /* fall through */
  20877. fallthrough
  20878. case int32(_BT_NMSTRT):
  20879. fallthrough
  20880. case int32(_BT_HEX):
  20881. ptr += uintptr(2)
  20882. case int32(_BT_LEAD2):
  20883. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  20884. return -int32(2)
  20885. }
  20886. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20887. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20888. return m_XML_TOK_INVALID
  20889. }
  20890. ptr += uintptr(2)
  20891. case int32(_BT_LEAD3):
  20892. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  20893. return -int32(2)
  20894. }
  20895. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20896. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20897. return m_XML_TOK_INVALID
  20898. }
  20899. ptr += uintptr(3)
  20900. case int32(_BT_LEAD4):
  20901. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  20902. return -int32(2)
  20903. }
  20904. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20905. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20906. return m_XML_TOK_INVALID
  20907. }
  20908. ptr += uintptr(4)
  20909. default:
  20910. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20911. return m_XML_TOK_INVALID
  20912. }
  20913. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20914. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20915. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20916. } else {
  20917. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20918. }
  20919. switch v2 {
  20920. case int32(_BT_NONASCII):
  20921. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  20922. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20923. return m_XML_TOK_INVALID
  20924. } /* fall through */
  20925. fallthrough
  20926. case int32(_BT_NMSTRT):
  20927. fallthrough
  20928. case int32(_BT_HEX):
  20929. fallthrough
  20930. case int32(_BT_DIGIT):
  20931. fallthrough
  20932. case int32(_BT_NAME):
  20933. fallthrough
  20934. case int32(_BT_MINUS):
  20935. ptr += uintptr(2)
  20936. case int32(_BT_LEAD2):
  20937. if int64(end)-int64(ptr) < int64(2) {
  20938. return -int32(2)
  20939. }
  20940. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20941. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20942. return m_XML_TOK_INVALID
  20943. }
  20944. ptr += uintptr(2)
  20945. case int32(_BT_LEAD3):
  20946. if int64(end)-int64(ptr) < int64(3) {
  20947. return -int32(2)
  20948. }
  20949. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20950. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20951. return m_XML_TOK_INVALID
  20952. }
  20953. ptr += uintptr(3)
  20954. case int32(_BT_LEAD4):
  20955. if int64(end)-int64(ptr) < int64(4) {
  20956. return -int32(2)
  20957. }
  20958. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20959. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20960. return m_XML_TOK_INVALID
  20961. }
  20962. ptr += uintptr(4)
  20963. case int32(_BT_S):
  20964. fallthrough
  20965. case int32(_BT_CR):
  20966. fallthrough
  20967. case int32(_BT_LF):
  20968. if !(_little2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  20969. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20970. return m_XML_TOK_INVALID
  20971. }
  20972. ptr += uintptr(2)
  20973. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20974. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20975. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20976. } else {
  20977. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20978. }
  20979. switch v3 {
  20980. case int32(_BT_LEAD2):
  20981. if int64(end)-int64(ptr) < int64(2) {
  20982. return -int32(2)
  20983. }
  20984. if 0 != 0 {
  20985. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20986. return m_XML_TOK_INVALID
  20987. }
  20988. ptr += uintptr(2)
  20989. case int32(_BT_LEAD3):
  20990. if int64(end)-int64(ptr) < int64(3) {
  20991. return -int32(2)
  20992. }
  20993. if 0 != 0 {
  20994. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20995. return m_XML_TOK_INVALID
  20996. }
  20997. ptr += uintptr(3)
  20998. case int32(_BT_LEAD4):
  20999. if int64(end)-int64(ptr) < int64(4) {
  21000. return -int32(2)
  21001. }
  21002. if 0 != 0 {
  21003. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21004. return m_XML_TOK_INVALID
  21005. }
  21006. ptr += uintptr(4)
  21007. case int32(_BT_NONXML):
  21008. fallthrough
  21009. case int32(_BT_MALFORM):
  21010. fallthrough
  21011. case int32(_BT_TRAIL):
  21012. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21013. return m_XML_TOK_INVALID
  21014. case int32(_BT_QUEST):
  21015. ptr += uintptr(2)
  21016. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21017. return -int32(1)
  21018. }
  21019. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  21020. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21021. return *(*int32)(unsafe.Pointer(bp))
  21022. }
  21023. default:
  21024. ptr += uintptr(2)
  21025. break
  21026. }
  21027. }
  21028. return -int32(1)
  21029. case int32(_BT_QUEST):
  21030. if !(_little2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  21031. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21032. return m_XML_TOK_INVALID
  21033. }
  21034. ptr += uintptr(2)
  21035. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21036. return -int32(1)
  21037. }
  21038. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  21039. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21040. return *(*int32)(unsafe.Pointer(bp))
  21041. }
  21042. /* fall through */
  21043. fallthrough
  21044. default:
  21045. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21046. return m_XML_TOK_INVALID
  21047. }
  21048. }
  21049. return -int32(1)
  21050. }
  21051. func _little2_scanCdataSection(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21052. var i int32
  21053. _ = i
  21054. _ = enc
  21055. /* CDATA[ */
  21056. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(6)*libc.Int32FromInt32(2))) {
  21057. return -int32(1)
  21058. }
  21059. i = 0
  21060. for {
  21061. if !(i < int32(6)) {
  21062. break
  21063. }
  21064. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(_CDATA_LSQB1[i])) {
  21065. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21066. return m_XML_TOK_INVALID
  21067. }
  21068. goto _1
  21069. _1:
  21070. ;
  21071. i++
  21072. ptr += uintptr(2)
  21073. }
  21074. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21075. return int32(m_XML_TOK_CDATA_SECT_OPEN)
  21076. }
  21077. var _CDATA_LSQB1 = [6]int8{
  21078. 0: int8(m_ASCII_C),
  21079. 1: int8(m_ASCII_D),
  21080. 2: int8(m_ASCII_A),
  21081. 3: int8(m_ASCII_T),
  21082. 4: int8(m_ASCII_A),
  21083. 5: int8(m_ASCII_LSQB1),
  21084. }
  21085. func _little2_cdataSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21086. var n Tsize_t
  21087. var v1, v2, v3 int32
  21088. _, _, _, _ = n, v1, v2, v3
  21089. if ptr >= end {
  21090. return -int32(4)
  21091. }
  21092. if int32(2) > int32(1) {
  21093. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  21094. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  21095. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  21096. if n == uint64(0) {
  21097. return -int32(1)
  21098. }
  21099. end = ptr + uintptr(n)
  21100. }
  21101. }
  21102. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21103. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21104. } else {
  21105. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21106. }
  21107. switch v1 {
  21108. case int32(_BT_RSQB):
  21109. ptr += uintptr(2)
  21110. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21111. return -int32(1)
  21112. }
  21113. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1)) {
  21114. break
  21115. }
  21116. ptr += uintptr(2)
  21117. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21118. return -int32(1)
  21119. }
  21120. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  21121. ptr -= uintptr(2)
  21122. break
  21123. }
  21124. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21125. return int32(m_XML_TOK_CDATA_SECT_CLOSE)
  21126. case int32(_BT_CR):
  21127. ptr += uintptr(2)
  21128. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21129. return -int32(1)
  21130. }
  21131. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21132. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21133. } else {
  21134. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21135. }
  21136. if v2 == int32(_BT_LF) {
  21137. ptr += uintptr(2)
  21138. }
  21139. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21140. return int32(m_XML_TOK_DATA_NEWLINE)
  21141. case int32(_BT_LF):
  21142. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21143. return int32(m_XML_TOK_DATA_NEWLINE)
  21144. case int32(_BT_LEAD2):
  21145. if int64(end)-int64(ptr) < int64(2) {
  21146. return -int32(2)
  21147. }
  21148. if 0 != 0 {
  21149. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21150. return m_XML_TOK_INVALID
  21151. }
  21152. ptr += uintptr(2)
  21153. case int32(_BT_LEAD3):
  21154. if int64(end)-int64(ptr) < int64(3) {
  21155. return -int32(2)
  21156. }
  21157. if 0 != 0 {
  21158. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21159. return m_XML_TOK_INVALID
  21160. }
  21161. ptr += uintptr(3)
  21162. case int32(_BT_LEAD4):
  21163. if int64(end)-int64(ptr) < int64(4) {
  21164. return -int32(2)
  21165. }
  21166. if 0 != 0 {
  21167. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21168. return m_XML_TOK_INVALID
  21169. }
  21170. ptr += uintptr(4)
  21171. case int32(_BT_NONXML):
  21172. fallthrough
  21173. case int32(_BT_MALFORM):
  21174. fallthrough
  21175. case int32(_BT_TRAIL):
  21176. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21177. return m_XML_TOK_INVALID
  21178. default:
  21179. ptr += uintptr(2)
  21180. break
  21181. }
  21182. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21183. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21184. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21185. } else {
  21186. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21187. }
  21188. switch v3 {
  21189. case int32(_BT_LEAD2):
  21190. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  21191. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21192. return int32(m_XML_TOK_DATA_CHARS)
  21193. }
  21194. ptr += uintptr(2)
  21195. case int32(_BT_LEAD3):
  21196. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  21197. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21198. return int32(m_XML_TOK_DATA_CHARS)
  21199. }
  21200. ptr += uintptr(3)
  21201. case int32(_BT_LEAD4):
  21202. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  21203. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21204. return int32(m_XML_TOK_DATA_CHARS)
  21205. }
  21206. ptr += uintptr(4)
  21207. case int32(_BT_NONXML):
  21208. fallthrough
  21209. case int32(_BT_MALFORM):
  21210. fallthrough
  21211. case int32(_BT_TRAIL):
  21212. fallthrough
  21213. case int32(_BT_CR):
  21214. fallthrough
  21215. case int32(_BT_LF):
  21216. fallthrough
  21217. case int32(_BT_RSQB):
  21218. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21219. return int32(m_XML_TOK_DATA_CHARS)
  21220. default:
  21221. ptr += uintptr(2)
  21222. break
  21223. }
  21224. }
  21225. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21226. return int32(m_XML_TOK_DATA_CHARS)
  21227. }
  21228. /* ptr points to character following "</" */
  21229. func _little2_scanEndTag(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21230. var v1, v2, v22 int32
  21231. _, _, _ = v1, v2, v22
  21232. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21233. return -int32(1)
  21234. }
  21235. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21236. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21237. } else {
  21238. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21239. }
  21240. switch v1 {
  21241. case int32(_BT_NONASCII):
  21242. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  21243. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21244. return m_XML_TOK_INVALID
  21245. } /* fall through */
  21246. fallthrough
  21247. case int32(_BT_NMSTRT):
  21248. fallthrough
  21249. case int32(_BT_HEX):
  21250. ptr += uintptr(2)
  21251. case int32(_BT_LEAD2):
  21252. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  21253. return -int32(2)
  21254. }
  21255. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21256. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21257. return m_XML_TOK_INVALID
  21258. }
  21259. ptr += uintptr(2)
  21260. case int32(_BT_LEAD3):
  21261. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  21262. return -int32(2)
  21263. }
  21264. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21265. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21266. return m_XML_TOK_INVALID
  21267. }
  21268. ptr += uintptr(3)
  21269. case int32(_BT_LEAD4):
  21270. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  21271. return -int32(2)
  21272. }
  21273. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21274. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21275. return m_XML_TOK_INVALID
  21276. }
  21277. ptr += uintptr(4)
  21278. default:
  21279. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21280. return m_XML_TOK_INVALID
  21281. }
  21282. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21283. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21284. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21285. } else {
  21286. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21287. }
  21288. switch v2 {
  21289. case int32(_BT_NONASCII):
  21290. goto _3
  21291. case int32(_BT_MINUS):
  21292. goto _4
  21293. case int32(_BT_NAME):
  21294. goto _5
  21295. case int32(_BT_DIGIT):
  21296. goto _6
  21297. case int32(_BT_HEX):
  21298. goto _7
  21299. case int32(_BT_NMSTRT):
  21300. goto _8
  21301. case int32(_BT_LEAD2):
  21302. goto _9
  21303. case int32(_BT_LEAD3):
  21304. goto _10
  21305. case int32(_BT_LEAD4):
  21306. goto _11
  21307. case int32(_BT_LF):
  21308. goto _12
  21309. case int32(_BT_CR):
  21310. goto _13
  21311. case int32(_BT_S):
  21312. goto _14
  21313. case int32(_BT_COLON):
  21314. goto _15
  21315. case int32(_BT_GT):
  21316. goto _16
  21317. default:
  21318. goto _17
  21319. }
  21320. goto _18
  21321. _3:
  21322. ;
  21323. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  21324. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21325. return m_XML_TOK_INVALID
  21326. } /* fall through */
  21327. _8:
  21328. ;
  21329. _7:
  21330. ;
  21331. _6:
  21332. ;
  21333. _5:
  21334. ;
  21335. _4:
  21336. ;
  21337. ptr += uintptr(2)
  21338. goto _18
  21339. _9:
  21340. ;
  21341. if int64(end)-int64(ptr) < int64(2) {
  21342. return -int32(2)
  21343. }
  21344. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21345. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21346. return m_XML_TOK_INVALID
  21347. }
  21348. ptr += uintptr(2)
  21349. goto _18
  21350. _10:
  21351. ;
  21352. if int64(end)-int64(ptr) < int64(3) {
  21353. return -int32(2)
  21354. }
  21355. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21356. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21357. return m_XML_TOK_INVALID
  21358. }
  21359. ptr += uintptr(3)
  21360. goto _18
  21361. _11:
  21362. ;
  21363. if int64(end)-int64(ptr) < int64(4) {
  21364. return -int32(2)
  21365. }
  21366. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21367. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21368. return m_XML_TOK_INVALID
  21369. }
  21370. ptr += uintptr(4)
  21371. goto _18
  21372. _14:
  21373. ;
  21374. _13:
  21375. ;
  21376. _12:
  21377. ;
  21378. ptr += uintptr(2)
  21379. _21:
  21380. ;
  21381. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21382. goto _19
  21383. }
  21384. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21385. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21386. } else {
  21387. v22 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21388. }
  21389. switch v22 {
  21390. case int32(_BT_S):
  21391. fallthrough
  21392. case int32(_BT_CR):
  21393. fallthrough
  21394. case int32(_BT_LF):
  21395. case int32(_BT_GT):
  21396. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21397. return int32(m_XML_TOK_END_TAG)
  21398. default:
  21399. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21400. return m_XML_TOK_INVALID
  21401. }
  21402. goto _20
  21403. _20:
  21404. ;
  21405. ptr += uintptr(2)
  21406. goto _21
  21407. goto _19
  21408. _19:
  21409. ;
  21410. return -int32(1)
  21411. _15:
  21412. ;
  21413. /* no need to check qname syntax here,
  21414. since end-tag must match exactly */
  21415. ptr += uintptr(2)
  21416. goto _18
  21417. _16:
  21418. ;
  21419. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21420. return int32(m_XML_TOK_END_TAG)
  21421. _17:
  21422. ;
  21423. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21424. return m_XML_TOK_INVALID
  21425. _18:
  21426. }
  21427. return -int32(1)
  21428. }
  21429. /* ptr points to character following "&#X" */
  21430. func _little2_scanHexCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21431. var v1, v3 int32
  21432. _, _ = v1, v3
  21433. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21434. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21435. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21436. } else {
  21437. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21438. }
  21439. switch v1 {
  21440. case int32(_BT_DIGIT):
  21441. fallthrough
  21442. case int32(_BT_HEX):
  21443. default:
  21444. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21445. return m_XML_TOK_INVALID
  21446. }
  21447. ptr += uintptr(2)
  21448. for {
  21449. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21450. break
  21451. }
  21452. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21453. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21454. } else {
  21455. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21456. }
  21457. switch v3 {
  21458. case int32(_BT_DIGIT):
  21459. fallthrough
  21460. case int32(_BT_HEX):
  21461. case int32(_BT_SEMI):
  21462. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21463. return int32(m_XML_TOK_CHAR_REF)
  21464. default:
  21465. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21466. return m_XML_TOK_INVALID
  21467. }
  21468. goto _2
  21469. _2:
  21470. ;
  21471. ptr += uintptr(2)
  21472. }
  21473. }
  21474. return -int32(1)
  21475. }
  21476. /* ptr points to character following "&#" */
  21477. func _little2_scanCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21478. var v1, v3 int32
  21479. _, _ = v1, v3
  21480. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21481. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  21482. return _little2_scanHexCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21483. }
  21484. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21485. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21486. } else {
  21487. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21488. }
  21489. switch v1 {
  21490. case int32(_BT_DIGIT):
  21491. default:
  21492. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21493. return m_XML_TOK_INVALID
  21494. }
  21495. ptr += uintptr(2)
  21496. for {
  21497. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21498. break
  21499. }
  21500. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21501. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21502. } else {
  21503. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21504. }
  21505. switch v3 {
  21506. case int32(_BT_DIGIT):
  21507. case int32(_BT_SEMI):
  21508. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21509. return int32(m_XML_TOK_CHAR_REF)
  21510. default:
  21511. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21512. return m_XML_TOK_INVALID
  21513. }
  21514. goto _2
  21515. _2:
  21516. ;
  21517. ptr += uintptr(2)
  21518. }
  21519. }
  21520. return -int32(1)
  21521. }
  21522. /* ptr points to character following "&" */
  21523. func _little2_scanRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21524. var v1, v2 int32
  21525. _, _ = v1, v2
  21526. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21527. return -int32(1)
  21528. }
  21529. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21530. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21531. } else {
  21532. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21533. }
  21534. switch v1 {
  21535. case int32(_BT_NONASCII):
  21536. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  21537. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21538. return m_XML_TOK_INVALID
  21539. } /* fall through */
  21540. fallthrough
  21541. case int32(_BT_NMSTRT):
  21542. fallthrough
  21543. case int32(_BT_HEX):
  21544. ptr += uintptr(2)
  21545. case int32(_BT_LEAD2):
  21546. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  21547. return -int32(2)
  21548. }
  21549. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21550. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21551. return m_XML_TOK_INVALID
  21552. }
  21553. ptr += uintptr(2)
  21554. case int32(_BT_LEAD3):
  21555. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  21556. return -int32(2)
  21557. }
  21558. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21559. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21560. return m_XML_TOK_INVALID
  21561. }
  21562. ptr += uintptr(3)
  21563. case int32(_BT_LEAD4):
  21564. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  21565. return -int32(2)
  21566. }
  21567. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21568. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21569. return m_XML_TOK_INVALID
  21570. }
  21571. ptr += uintptr(4)
  21572. case int32(_BT_NUM):
  21573. return _little2_scanCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21574. default:
  21575. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21576. return m_XML_TOK_INVALID
  21577. }
  21578. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21579. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21580. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21581. } else {
  21582. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21583. }
  21584. switch v2 {
  21585. case int32(_BT_NONASCII):
  21586. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  21587. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21588. return m_XML_TOK_INVALID
  21589. } /* fall through */
  21590. fallthrough
  21591. case int32(_BT_NMSTRT):
  21592. fallthrough
  21593. case int32(_BT_HEX):
  21594. fallthrough
  21595. case int32(_BT_DIGIT):
  21596. fallthrough
  21597. case int32(_BT_NAME):
  21598. fallthrough
  21599. case int32(_BT_MINUS):
  21600. ptr += uintptr(2)
  21601. case int32(_BT_LEAD2):
  21602. if int64(end)-int64(ptr) < int64(2) {
  21603. return -int32(2)
  21604. }
  21605. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21606. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21607. return m_XML_TOK_INVALID
  21608. }
  21609. ptr += uintptr(2)
  21610. case int32(_BT_LEAD3):
  21611. if int64(end)-int64(ptr) < int64(3) {
  21612. return -int32(2)
  21613. }
  21614. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21615. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21616. return m_XML_TOK_INVALID
  21617. }
  21618. ptr += uintptr(3)
  21619. case int32(_BT_LEAD4):
  21620. if int64(end)-int64(ptr) < int64(4) {
  21621. return -int32(2)
  21622. }
  21623. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21624. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21625. return m_XML_TOK_INVALID
  21626. }
  21627. ptr += uintptr(4)
  21628. case int32(_BT_SEMI):
  21629. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21630. return int32(m_XML_TOK_ENTITY_REF)
  21631. default:
  21632. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21633. return m_XML_TOK_INVALID
  21634. }
  21635. }
  21636. return -int32(1)
  21637. }
  21638. /* ptr points to character following first character of attribute name */
  21639. func _little2_scanAtts(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21640. bp := tls.Alloc(16)
  21641. defer tls.Free(16)
  21642. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  21643. var hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31 int32
  21644. _, _, _, _, _, _, _, _, _, _, _, _ = hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31
  21645. hadColon = 0
  21646. for int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21647. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  21648. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  21649. } else {
  21650. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  21651. }
  21652. switch v1 {
  21653. case int32(_BT_NONASCII):
  21654. goto _2
  21655. case int32(_BT_MINUS):
  21656. goto _3
  21657. case int32(_BT_NAME):
  21658. goto _4
  21659. case int32(_BT_DIGIT):
  21660. goto _5
  21661. case int32(_BT_HEX):
  21662. goto _6
  21663. case int32(_BT_NMSTRT):
  21664. goto _7
  21665. case int32(_BT_LEAD2):
  21666. goto _8
  21667. case int32(_BT_LEAD3):
  21668. goto _9
  21669. case int32(_BT_LEAD4):
  21670. goto _10
  21671. case int32(_BT_COLON):
  21672. goto _11
  21673. case int32(_BT_LF):
  21674. goto _12
  21675. case int32(_BT_CR):
  21676. goto _13
  21677. case int32(_BT_S):
  21678. goto _14
  21679. case int32(_BT_EQUALS):
  21680. goto _15
  21681. default:
  21682. goto _16
  21683. }
  21684. goto _17
  21685. _2:
  21686. ;
  21687. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))&libc.Int32FromInt32(0x1F))) != 0) {
  21688. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21689. return m_XML_TOK_INVALID
  21690. } /* fall through */
  21691. _7:
  21692. ;
  21693. _6:
  21694. ;
  21695. _5:
  21696. ;
  21697. _4:
  21698. ;
  21699. _3:
  21700. ;
  21701. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21702. goto _17
  21703. _8:
  21704. ;
  21705. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  21706. return -int32(2)
  21707. }
  21708. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21709. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21710. return m_XML_TOK_INVALID
  21711. }
  21712. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21713. goto _17
  21714. _9:
  21715. ;
  21716. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  21717. return -int32(2)
  21718. }
  21719. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21720. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21721. return m_XML_TOK_INVALID
  21722. }
  21723. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  21724. goto _17
  21725. _10:
  21726. ;
  21727. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  21728. return -int32(2)
  21729. }
  21730. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21731. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21732. return m_XML_TOK_INVALID
  21733. }
  21734. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  21735. goto _17
  21736. _11:
  21737. ;
  21738. if hadColon != 0 {
  21739. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21740. return m_XML_TOK_INVALID
  21741. }
  21742. hadColon = int32(1)
  21743. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21744. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21745. return -int32(1)
  21746. }
  21747. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  21748. v18 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  21749. } else {
  21750. v18 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  21751. }
  21752. switch v18 {
  21753. case int32(_BT_NONASCII):
  21754. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))&libc.Int32FromInt32(0x1F))) != 0) {
  21755. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21756. return m_XML_TOK_INVALID
  21757. } /* fall through */
  21758. fallthrough
  21759. case int32(_BT_NMSTRT):
  21760. fallthrough
  21761. case int32(_BT_HEX):
  21762. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21763. case int32(_BT_LEAD2):
  21764. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  21765. return -int32(2)
  21766. }
  21767. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21768. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21769. return m_XML_TOK_INVALID
  21770. }
  21771. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21772. case int32(_BT_LEAD3):
  21773. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  21774. return -int32(2)
  21775. }
  21776. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21777. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21778. return m_XML_TOK_INVALID
  21779. }
  21780. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  21781. case int32(_BT_LEAD4):
  21782. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  21783. return -int32(2)
  21784. }
  21785. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21786. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21787. return m_XML_TOK_INVALID
  21788. }
  21789. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  21790. default:
  21791. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21792. return m_XML_TOK_INVALID
  21793. }
  21794. goto _17
  21795. _14:
  21796. ;
  21797. _13:
  21798. ;
  21799. _12:
  21800. ;
  21801. _21:
  21802. ;
  21803. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21804. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21805. return -int32(1)
  21806. }
  21807. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  21808. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  21809. } else {
  21810. v22 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  21811. }
  21812. t = v22
  21813. if t == int32(_BT_EQUALS) {
  21814. goto _19
  21815. }
  21816. switch t {
  21817. case int32(_BT_S):
  21818. fallthrough
  21819. case int32(_BT_LF):
  21820. fallthrough
  21821. case int32(_BT_CR):
  21822. default:
  21823. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21824. return m_XML_TOK_INVALID
  21825. }
  21826. goto _20
  21827. _20:
  21828. ;
  21829. goto _21
  21830. goto _19
  21831. _19:
  21832. ;
  21833. /* fall through */
  21834. _15:
  21835. ;
  21836. hadColon = 0
  21837. for {
  21838. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21839. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21840. return -int32(1)
  21841. }
  21842. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  21843. v24 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  21844. } else {
  21845. v24 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  21846. }
  21847. open = v24
  21848. if open == int32(_BT_QUOT) || open == int32(_BT_APOS) {
  21849. break
  21850. }
  21851. switch open {
  21852. case int32(_BT_S):
  21853. fallthrough
  21854. case int32(_BT_LF):
  21855. fallthrough
  21856. case int32(_BT_CR):
  21857. default:
  21858. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21859. return m_XML_TOK_INVALID
  21860. }
  21861. goto _23
  21862. _23:
  21863. }
  21864. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21865. /* in attribute value */
  21866. for {
  21867. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21868. return -int32(1)
  21869. }
  21870. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  21871. v26 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  21872. } else {
  21873. v26 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  21874. }
  21875. t1 = v26
  21876. if t1 == open {
  21877. break
  21878. }
  21879. switch t1 {
  21880. case int32(_BT_LEAD2):
  21881. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  21882. return -int32(2)
  21883. }
  21884. if 0 != 0 {
  21885. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21886. return m_XML_TOK_INVALID
  21887. }
  21888. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21889. case int32(_BT_LEAD3):
  21890. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  21891. return -int32(2)
  21892. }
  21893. if 0 != 0 {
  21894. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21895. return m_XML_TOK_INVALID
  21896. }
  21897. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  21898. case int32(_BT_LEAD4):
  21899. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  21900. return -int32(2)
  21901. }
  21902. if 0 != 0 {
  21903. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21904. return m_XML_TOK_INVALID
  21905. }
  21906. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  21907. case int32(_BT_NONXML):
  21908. fallthrough
  21909. case int32(_BT_MALFORM):
  21910. fallthrough
  21911. case int32(_BT_TRAIL):
  21912. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21913. return m_XML_TOK_INVALID
  21914. case int32(_BT_AMP):
  21915. tok = _little2_scanRef(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr(2), end, bp)
  21916. if tok <= 0 {
  21917. if tok == m_XML_TOK_INVALID {
  21918. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21919. }
  21920. return tok
  21921. }
  21922. case int32(_BT_LT):
  21923. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21924. return m_XML_TOK_INVALID
  21925. default:
  21926. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21927. break
  21928. }
  21929. goto _25
  21930. _25:
  21931. }
  21932. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21933. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21934. return -int32(1)
  21935. }
  21936. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  21937. v27 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  21938. } else {
  21939. v27 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  21940. }
  21941. switch v27 {
  21942. case int32(_BT_S):
  21943. fallthrough
  21944. case int32(_BT_CR):
  21945. fallthrough
  21946. case int32(_BT_LF):
  21947. case int32(_BT_SOL):
  21948. goto sol
  21949. case int32(_BT_GT):
  21950. goto gt
  21951. default:
  21952. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21953. return m_XML_TOK_INVALID
  21954. }
  21955. /* ptr points to closing quote */
  21956. _30:
  21957. ;
  21958. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21959. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21960. return -int32(1)
  21961. }
  21962. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  21963. v31 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  21964. } else {
  21965. v31 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  21966. }
  21967. switch v31 {
  21968. case int32(_BT_NONASCII):
  21969. goto _32
  21970. case int32(_BT_HEX):
  21971. goto _33
  21972. case int32(_BT_NMSTRT):
  21973. goto _34
  21974. case int32(_BT_LEAD2):
  21975. goto _35
  21976. case int32(_BT_LEAD3):
  21977. goto _36
  21978. case int32(_BT_LEAD4):
  21979. goto _37
  21980. case int32(_BT_LF):
  21981. goto _38
  21982. case int32(_BT_CR):
  21983. goto _39
  21984. case int32(_BT_S):
  21985. goto _40
  21986. case int32(_BT_GT):
  21987. goto _41
  21988. case int32(_BT_SOL):
  21989. goto _42
  21990. default:
  21991. goto _43
  21992. }
  21993. goto _44
  21994. _32:
  21995. ;
  21996. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))&libc.Int32FromInt32(0x1F))) != 0) {
  21997. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21998. return m_XML_TOK_INVALID
  21999. } /* fall through */
  22000. _34:
  22001. ;
  22002. _33:
  22003. ;
  22004. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  22005. goto _44
  22006. _35:
  22007. ;
  22008. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  22009. return -int32(2)
  22010. }
  22011. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  22012. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  22013. return m_XML_TOK_INVALID
  22014. }
  22015. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  22016. goto _44
  22017. _36:
  22018. ;
  22019. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  22020. return -int32(2)
  22021. }
  22022. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  22023. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  22024. return m_XML_TOK_INVALID
  22025. }
  22026. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  22027. goto _44
  22028. _37:
  22029. ;
  22030. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  22031. return -int32(2)
  22032. }
  22033. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  22034. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  22035. return m_XML_TOK_INVALID
  22036. }
  22037. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  22038. goto _44
  22039. _40:
  22040. ;
  22041. _39:
  22042. ;
  22043. _38:
  22044. ;
  22045. goto _29
  22046. _41:
  22047. ;
  22048. goto gt
  22049. gt:
  22050. ;
  22051. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  22052. return int32(m_XML_TOK_START_TAG_WITH_ATTS)
  22053. _42:
  22054. ;
  22055. goto sol
  22056. sol:
  22057. ;
  22058. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  22059. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22060. return -int32(1)
  22061. }
  22062. if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == int32(m_ASCII_GT1)) {
  22063. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  22064. return m_XML_TOK_INVALID
  22065. }
  22066. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  22067. return int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS)
  22068. _43:
  22069. ;
  22070. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  22071. return m_XML_TOK_INVALID
  22072. _44:
  22073. ;
  22074. goto _28
  22075. goto _29
  22076. _29:
  22077. ;
  22078. goto _30
  22079. goto _28
  22080. _28:
  22081. ;
  22082. goto _17
  22083. _16:
  22084. ;
  22085. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  22086. return m_XML_TOK_INVALID
  22087. _17:
  22088. }
  22089. return -int32(1)
  22090. }
  22091. /* ptr points to character following "<" */
  22092. func _little2_scanLt(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  22093. var hadColon, v1, v2, v21, v22, v3 int32
  22094. _, _, _, _, _, _ = hadColon, v1, v2, v21, v22, v3
  22095. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22096. return -int32(1)
  22097. }
  22098. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22099. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22100. } else {
  22101. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22102. }
  22103. switch v1 {
  22104. case int32(_BT_NONASCII):
  22105. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  22106. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22107. return m_XML_TOK_INVALID
  22108. } /* fall through */
  22109. fallthrough
  22110. case int32(_BT_NMSTRT):
  22111. fallthrough
  22112. case int32(_BT_HEX):
  22113. ptr += uintptr(2)
  22114. case int32(_BT_LEAD2):
  22115. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  22116. return -int32(2)
  22117. }
  22118. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  22119. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22120. return m_XML_TOK_INVALID
  22121. }
  22122. ptr += uintptr(2)
  22123. case int32(_BT_LEAD3):
  22124. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  22125. return -int32(2)
  22126. }
  22127. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  22128. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22129. return m_XML_TOK_INVALID
  22130. }
  22131. ptr += uintptr(3)
  22132. case int32(_BT_LEAD4):
  22133. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  22134. return -int32(2)
  22135. }
  22136. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  22137. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22138. return m_XML_TOK_INVALID
  22139. }
  22140. ptr += uintptr(4)
  22141. case int32(_BT_EXCL):
  22142. ptr += uintptr(2)
  22143. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22144. return -int32(1)
  22145. }
  22146. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22147. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22148. } else {
  22149. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22150. }
  22151. switch v2 {
  22152. case int32(_BT_MINUS):
  22153. return _little2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  22154. case int32(_BT_LSQB):
  22155. return _little2_scanCdataSection(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  22156. }
  22157. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22158. return m_XML_TOK_INVALID
  22159. case int32(_BT_QUEST):
  22160. return _little2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  22161. case int32(_BT_SOL):
  22162. return _little2_scanEndTag(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  22163. default:
  22164. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22165. return m_XML_TOK_INVALID
  22166. }
  22167. hadColon = 0
  22168. /* we have a start-tag */
  22169. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  22170. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22171. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22172. } else {
  22173. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22174. }
  22175. switch v3 {
  22176. case int32(_BT_NONASCII):
  22177. goto _4
  22178. case int32(_BT_MINUS):
  22179. goto _5
  22180. case int32(_BT_NAME):
  22181. goto _6
  22182. case int32(_BT_DIGIT):
  22183. goto _7
  22184. case int32(_BT_HEX):
  22185. goto _8
  22186. case int32(_BT_NMSTRT):
  22187. goto _9
  22188. case int32(_BT_LEAD2):
  22189. goto _10
  22190. case int32(_BT_LEAD3):
  22191. goto _11
  22192. case int32(_BT_LEAD4):
  22193. goto _12
  22194. case int32(_BT_COLON):
  22195. goto _13
  22196. case int32(_BT_LF):
  22197. goto _14
  22198. case int32(_BT_CR):
  22199. goto _15
  22200. case int32(_BT_S):
  22201. goto _16
  22202. case int32(_BT_GT):
  22203. goto _17
  22204. case int32(_BT_SOL):
  22205. goto _18
  22206. default:
  22207. goto _19
  22208. }
  22209. goto _20
  22210. _4:
  22211. ;
  22212. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  22213. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22214. return m_XML_TOK_INVALID
  22215. } /* fall through */
  22216. _9:
  22217. ;
  22218. _8:
  22219. ;
  22220. _7:
  22221. ;
  22222. _6:
  22223. ;
  22224. _5:
  22225. ;
  22226. ptr += uintptr(2)
  22227. goto _20
  22228. _10:
  22229. ;
  22230. if int64(end)-int64(ptr) < int64(2) {
  22231. return -int32(2)
  22232. }
  22233. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  22234. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22235. return m_XML_TOK_INVALID
  22236. }
  22237. ptr += uintptr(2)
  22238. goto _20
  22239. _11:
  22240. ;
  22241. if int64(end)-int64(ptr) < int64(3) {
  22242. return -int32(2)
  22243. }
  22244. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  22245. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22246. return m_XML_TOK_INVALID
  22247. }
  22248. ptr += uintptr(3)
  22249. goto _20
  22250. _12:
  22251. ;
  22252. if int64(end)-int64(ptr) < int64(4) {
  22253. return -int32(2)
  22254. }
  22255. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  22256. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22257. return m_XML_TOK_INVALID
  22258. }
  22259. ptr += uintptr(4)
  22260. goto _20
  22261. _13:
  22262. ;
  22263. if hadColon != 0 {
  22264. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22265. return m_XML_TOK_INVALID
  22266. }
  22267. hadColon = int32(1)
  22268. ptr += uintptr(2)
  22269. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22270. return -int32(1)
  22271. }
  22272. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22273. v21 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22274. } else {
  22275. v21 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22276. }
  22277. switch v21 {
  22278. case int32(_BT_NONASCII):
  22279. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  22280. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22281. return m_XML_TOK_INVALID
  22282. } /* fall through */
  22283. fallthrough
  22284. case int32(_BT_NMSTRT):
  22285. fallthrough
  22286. case int32(_BT_HEX):
  22287. ptr += uintptr(2)
  22288. case int32(_BT_LEAD2):
  22289. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  22290. return -int32(2)
  22291. }
  22292. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  22293. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22294. return m_XML_TOK_INVALID
  22295. }
  22296. ptr += uintptr(2)
  22297. case int32(_BT_LEAD3):
  22298. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  22299. return -int32(2)
  22300. }
  22301. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  22302. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22303. return m_XML_TOK_INVALID
  22304. }
  22305. ptr += uintptr(3)
  22306. case int32(_BT_LEAD4):
  22307. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  22308. return -int32(2)
  22309. }
  22310. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  22311. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22312. return m_XML_TOK_INVALID
  22313. }
  22314. ptr += uintptr(4)
  22315. default:
  22316. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22317. return m_XML_TOK_INVALID
  22318. }
  22319. goto _20
  22320. _16:
  22321. ;
  22322. _15:
  22323. ;
  22324. _14:
  22325. ;
  22326. ptr += uintptr(2)
  22327. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  22328. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22329. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22330. } else {
  22331. v22 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22332. }
  22333. switch v22 {
  22334. case int32(_BT_NONASCII):
  22335. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  22336. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22337. return m_XML_TOK_INVALID
  22338. } /* fall through */
  22339. fallthrough
  22340. case int32(_BT_NMSTRT):
  22341. fallthrough
  22342. case int32(_BT_HEX):
  22343. ptr += uintptr(2)
  22344. case int32(_BT_LEAD2):
  22345. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  22346. return -int32(2)
  22347. }
  22348. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  22349. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22350. return m_XML_TOK_INVALID
  22351. }
  22352. ptr += uintptr(2)
  22353. case int32(_BT_LEAD3):
  22354. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  22355. return -int32(2)
  22356. }
  22357. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  22358. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22359. return m_XML_TOK_INVALID
  22360. }
  22361. ptr += uintptr(3)
  22362. case int32(_BT_LEAD4):
  22363. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  22364. return -int32(2)
  22365. }
  22366. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  22367. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22368. return m_XML_TOK_INVALID
  22369. }
  22370. ptr += uintptr(4)
  22371. case int32(_BT_GT):
  22372. goto gt
  22373. case int32(_BT_SOL):
  22374. goto sol
  22375. case int32(_BT_S):
  22376. fallthrough
  22377. case int32(_BT_CR):
  22378. fallthrough
  22379. case int32(_BT_LF):
  22380. ptr += uintptr(2)
  22381. continue
  22382. default:
  22383. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22384. return m_XML_TOK_INVALID
  22385. }
  22386. return _little2_scanAtts(tls, enc, ptr, end, nextTokPtr)
  22387. }
  22388. return -int32(1)
  22389. _17:
  22390. ;
  22391. goto gt
  22392. gt:
  22393. ;
  22394. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  22395. return int32(m_XML_TOK_START_TAG_NO_ATTS)
  22396. _18:
  22397. ;
  22398. goto sol
  22399. sol:
  22400. ;
  22401. ptr += uintptr(2)
  22402. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22403. return -int32(1)
  22404. }
  22405. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  22406. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22407. return m_XML_TOK_INVALID
  22408. }
  22409. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  22410. return int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS)
  22411. _19:
  22412. ;
  22413. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22414. return m_XML_TOK_INVALID
  22415. _20:
  22416. }
  22417. return -int32(1)
  22418. }
  22419. func _little2_contentTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  22420. var n Tsize_t
  22421. var v1, v2, v3 int32
  22422. _, _, _, _ = n, v1, v2, v3
  22423. if ptr >= end {
  22424. return -int32(4)
  22425. }
  22426. if int32(2) > int32(1) {
  22427. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  22428. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  22429. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  22430. if n == uint64(0) {
  22431. return -int32(1)
  22432. }
  22433. end = ptr + uintptr(n)
  22434. }
  22435. }
  22436. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22437. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22438. } else {
  22439. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22440. }
  22441. switch v1 {
  22442. case int32(_BT_LT):
  22443. return _little2_scanLt(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  22444. case int32(_BT_AMP):
  22445. return _little2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  22446. case int32(_BT_CR):
  22447. ptr += uintptr(2)
  22448. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22449. return -int32(3)
  22450. }
  22451. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22452. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22453. } else {
  22454. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22455. }
  22456. if v2 == int32(_BT_LF) {
  22457. ptr += uintptr(2)
  22458. }
  22459. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22460. return int32(m_XML_TOK_DATA_NEWLINE)
  22461. case int32(_BT_LF):
  22462. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  22463. return int32(m_XML_TOK_DATA_NEWLINE)
  22464. case int32(_BT_RSQB):
  22465. ptr += uintptr(2)
  22466. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22467. return -int32(5)
  22468. }
  22469. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1)) {
  22470. break
  22471. }
  22472. ptr += uintptr(2)
  22473. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22474. return -int32(5)
  22475. }
  22476. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  22477. ptr -= uintptr(2)
  22478. break
  22479. }
  22480. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22481. return m_XML_TOK_INVALID
  22482. case int32(_BT_LEAD2):
  22483. if int64(end)-int64(ptr) < int64(2) {
  22484. return -int32(2)
  22485. }
  22486. if 0 != 0 {
  22487. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22488. return m_XML_TOK_INVALID
  22489. }
  22490. ptr += uintptr(2)
  22491. case int32(_BT_LEAD3):
  22492. if int64(end)-int64(ptr) < int64(3) {
  22493. return -int32(2)
  22494. }
  22495. if 0 != 0 {
  22496. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22497. return m_XML_TOK_INVALID
  22498. }
  22499. ptr += uintptr(3)
  22500. case int32(_BT_LEAD4):
  22501. if int64(end)-int64(ptr) < int64(4) {
  22502. return -int32(2)
  22503. }
  22504. if 0 != 0 {
  22505. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22506. return m_XML_TOK_INVALID
  22507. }
  22508. ptr += uintptr(4)
  22509. case int32(_BT_NONXML):
  22510. fallthrough
  22511. case int32(_BT_MALFORM):
  22512. fallthrough
  22513. case int32(_BT_TRAIL):
  22514. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22515. return m_XML_TOK_INVALID
  22516. default:
  22517. ptr += uintptr(2)
  22518. break
  22519. }
  22520. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  22521. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22522. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22523. } else {
  22524. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22525. }
  22526. switch v3 {
  22527. case int32(_BT_LEAD2):
  22528. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  22529. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22530. return int32(m_XML_TOK_DATA_CHARS)
  22531. }
  22532. ptr += uintptr(2)
  22533. case int32(_BT_LEAD3):
  22534. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  22535. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22536. return int32(m_XML_TOK_DATA_CHARS)
  22537. }
  22538. ptr += uintptr(3)
  22539. case int32(_BT_LEAD4):
  22540. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  22541. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22542. return int32(m_XML_TOK_DATA_CHARS)
  22543. }
  22544. ptr += uintptr(4)
  22545. case int32(_BT_RSQB):
  22546. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) {
  22547. if !(int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == int32(m_ASCII_RSQB1)) {
  22548. ptr += uintptr(2)
  22549. break
  22550. }
  22551. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(3)*libc.Int32FromInt32(2)) {
  22552. if !(int32(*(*int8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))))) == int32(m_ASCII_GT1)) {
  22553. ptr += uintptr(2)
  22554. break
  22555. }
  22556. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  22557. return m_XML_TOK_INVALID
  22558. }
  22559. }
  22560. /* fall through */
  22561. fallthrough
  22562. case int32(_BT_AMP):
  22563. fallthrough
  22564. case int32(_BT_LT):
  22565. fallthrough
  22566. case int32(_BT_NONXML):
  22567. fallthrough
  22568. case int32(_BT_MALFORM):
  22569. fallthrough
  22570. case int32(_BT_TRAIL):
  22571. fallthrough
  22572. case int32(_BT_CR):
  22573. fallthrough
  22574. case int32(_BT_LF):
  22575. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22576. return int32(m_XML_TOK_DATA_CHARS)
  22577. default:
  22578. ptr += uintptr(2)
  22579. break
  22580. }
  22581. }
  22582. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22583. return int32(m_XML_TOK_DATA_CHARS)
  22584. }
  22585. /* ptr points to character following "%" */
  22586. func _little2_scanPercent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  22587. var v1, v2 int32
  22588. _, _ = v1, v2
  22589. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22590. return -int32(1)
  22591. }
  22592. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22593. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22594. } else {
  22595. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22596. }
  22597. switch v1 {
  22598. case int32(_BT_NONASCII):
  22599. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  22600. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22601. return m_XML_TOK_INVALID
  22602. } /* fall through */
  22603. fallthrough
  22604. case int32(_BT_NMSTRT):
  22605. fallthrough
  22606. case int32(_BT_HEX):
  22607. ptr += uintptr(2)
  22608. case int32(_BT_LEAD2):
  22609. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  22610. return -int32(2)
  22611. }
  22612. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  22613. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22614. return m_XML_TOK_INVALID
  22615. }
  22616. ptr += uintptr(2)
  22617. case int32(_BT_LEAD3):
  22618. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  22619. return -int32(2)
  22620. }
  22621. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  22622. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22623. return m_XML_TOK_INVALID
  22624. }
  22625. ptr += uintptr(3)
  22626. case int32(_BT_LEAD4):
  22627. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  22628. return -int32(2)
  22629. }
  22630. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  22631. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22632. return m_XML_TOK_INVALID
  22633. }
  22634. ptr += uintptr(4)
  22635. case int32(_BT_S):
  22636. fallthrough
  22637. case int32(_BT_LF):
  22638. fallthrough
  22639. case int32(_BT_CR):
  22640. fallthrough
  22641. case int32(_BT_PERCNT):
  22642. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22643. return int32(m_XML_TOK_PERCENT)
  22644. default:
  22645. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22646. return m_XML_TOK_INVALID
  22647. }
  22648. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  22649. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22650. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22651. } else {
  22652. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22653. }
  22654. switch v2 {
  22655. case int32(_BT_NONASCII):
  22656. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  22657. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22658. return m_XML_TOK_INVALID
  22659. } /* fall through */
  22660. fallthrough
  22661. case int32(_BT_NMSTRT):
  22662. fallthrough
  22663. case int32(_BT_HEX):
  22664. fallthrough
  22665. case int32(_BT_DIGIT):
  22666. fallthrough
  22667. case int32(_BT_NAME):
  22668. fallthrough
  22669. case int32(_BT_MINUS):
  22670. ptr += uintptr(2)
  22671. case int32(_BT_LEAD2):
  22672. if int64(end)-int64(ptr) < int64(2) {
  22673. return -int32(2)
  22674. }
  22675. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  22676. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22677. return m_XML_TOK_INVALID
  22678. }
  22679. ptr += uintptr(2)
  22680. case int32(_BT_LEAD3):
  22681. if int64(end)-int64(ptr) < int64(3) {
  22682. return -int32(2)
  22683. }
  22684. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  22685. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22686. return m_XML_TOK_INVALID
  22687. }
  22688. ptr += uintptr(3)
  22689. case int32(_BT_LEAD4):
  22690. if int64(end)-int64(ptr) < int64(4) {
  22691. return -int32(2)
  22692. }
  22693. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  22694. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22695. return m_XML_TOK_INVALID
  22696. }
  22697. ptr += uintptr(4)
  22698. case int32(_BT_SEMI):
  22699. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  22700. return int32(m_XML_TOK_PARAM_ENTITY_REF)
  22701. default:
  22702. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22703. return m_XML_TOK_INVALID
  22704. }
  22705. }
  22706. return -int32(1)
  22707. }
  22708. func _little2_scanPoundName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  22709. var v1, v2 int32
  22710. _, _ = v1, v2
  22711. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22712. return -int32(1)
  22713. }
  22714. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22715. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22716. } else {
  22717. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22718. }
  22719. switch v1 {
  22720. case int32(_BT_NONASCII):
  22721. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  22722. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22723. return m_XML_TOK_INVALID
  22724. } /* fall through */
  22725. fallthrough
  22726. case int32(_BT_NMSTRT):
  22727. fallthrough
  22728. case int32(_BT_HEX):
  22729. ptr += uintptr(2)
  22730. case int32(_BT_LEAD2):
  22731. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  22732. return -int32(2)
  22733. }
  22734. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  22735. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22736. return m_XML_TOK_INVALID
  22737. }
  22738. ptr += uintptr(2)
  22739. case int32(_BT_LEAD3):
  22740. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  22741. return -int32(2)
  22742. }
  22743. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  22744. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22745. return m_XML_TOK_INVALID
  22746. }
  22747. ptr += uintptr(3)
  22748. case int32(_BT_LEAD4):
  22749. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  22750. return -int32(2)
  22751. }
  22752. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  22753. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22754. return m_XML_TOK_INVALID
  22755. }
  22756. ptr += uintptr(4)
  22757. default:
  22758. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22759. return m_XML_TOK_INVALID
  22760. }
  22761. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  22762. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22763. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22764. } else {
  22765. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22766. }
  22767. switch v2 {
  22768. case int32(_BT_NONASCII):
  22769. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  22770. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22771. return m_XML_TOK_INVALID
  22772. } /* fall through */
  22773. fallthrough
  22774. case int32(_BT_NMSTRT):
  22775. fallthrough
  22776. case int32(_BT_HEX):
  22777. fallthrough
  22778. case int32(_BT_DIGIT):
  22779. fallthrough
  22780. case int32(_BT_NAME):
  22781. fallthrough
  22782. case int32(_BT_MINUS):
  22783. ptr += uintptr(2)
  22784. case int32(_BT_LEAD2):
  22785. if int64(end)-int64(ptr) < int64(2) {
  22786. return -int32(2)
  22787. }
  22788. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  22789. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22790. return m_XML_TOK_INVALID
  22791. }
  22792. ptr += uintptr(2)
  22793. case int32(_BT_LEAD3):
  22794. if int64(end)-int64(ptr) < int64(3) {
  22795. return -int32(2)
  22796. }
  22797. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  22798. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22799. return m_XML_TOK_INVALID
  22800. }
  22801. ptr += uintptr(3)
  22802. case int32(_BT_LEAD4):
  22803. if int64(end)-int64(ptr) < int64(4) {
  22804. return -int32(2)
  22805. }
  22806. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  22807. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22808. return m_XML_TOK_INVALID
  22809. }
  22810. ptr += uintptr(4)
  22811. case int32(_BT_CR):
  22812. fallthrough
  22813. case int32(_BT_LF):
  22814. fallthrough
  22815. case int32(_BT_S):
  22816. fallthrough
  22817. case int32(_BT_RPAR):
  22818. fallthrough
  22819. case int32(_BT_GT):
  22820. fallthrough
  22821. case int32(_BT_PERCNT):
  22822. fallthrough
  22823. case int32(_BT_VERBAR):
  22824. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22825. return int32(m_XML_TOK_POUND_NAME)
  22826. default:
  22827. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22828. return m_XML_TOK_INVALID
  22829. }
  22830. }
  22831. return -int32(m_XML_TOK_POUND_NAME)
  22832. }
  22833. func _little2_scanLit(tls *libc.TLS, open int32, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  22834. var t, v1, v2 int32
  22835. _, _, _ = t, v1, v2
  22836. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  22837. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22838. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22839. } else {
  22840. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22841. }
  22842. t = v1
  22843. switch t {
  22844. case int32(_BT_LEAD2):
  22845. if int64(end)-int64(ptr) < int64(2) {
  22846. return -int32(2)
  22847. }
  22848. if 0 != 0 {
  22849. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22850. return m_XML_TOK_INVALID
  22851. }
  22852. ptr += uintptr(2)
  22853. case int32(_BT_LEAD3):
  22854. if int64(end)-int64(ptr) < int64(3) {
  22855. return -int32(2)
  22856. }
  22857. if 0 != 0 {
  22858. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22859. return m_XML_TOK_INVALID
  22860. }
  22861. ptr += uintptr(3)
  22862. case int32(_BT_LEAD4):
  22863. if int64(end)-int64(ptr) < int64(4) {
  22864. return -int32(2)
  22865. }
  22866. if 0 != 0 {
  22867. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22868. return m_XML_TOK_INVALID
  22869. }
  22870. ptr += uintptr(4)
  22871. case int32(_BT_NONXML):
  22872. fallthrough
  22873. case int32(_BT_MALFORM):
  22874. fallthrough
  22875. case int32(_BT_TRAIL):
  22876. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22877. return m_XML_TOK_INVALID
  22878. case int32(_BT_QUOT):
  22879. fallthrough
  22880. case int32(_BT_APOS):
  22881. ptr += uintptr(2)
  22882. if t != open {
  22883. break
  22884. }
  22885. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22886. return -int32(m_XML_TOK_LITERAL)
  22887. }
  22888. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22889. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22890. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22891. } else {
  22892. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22893. }
  22894. switch v2 {
  22895. case int32(_BT_S):
  22896. fallthrough
  22897. case int32(_BT_CR):
  22898. fallthrough
  22899. case int32(_BT_LF):
  22900. fallthrough
  22901. case int32(_BT_GT):
  22902. fallthrough
  22903. case int32(_BT_PERCNT):
  22904. fallthrough
  22905. case int32(_BT_LSQB):
  22906. return int32(m_XML_TOK_LITERAL)
  22907. default:
  22908. return m_XML_TOK_INVALID
  22909. }
  22910. fallthrough
  22911. default:
  22912. ptr += uintptr(2)
  22913. break
  22914. }
  22915. }
  22916. return -int32(1)
  22917. }
  22918. func _little2_prologTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  22919. var n Tsize_t
  22920. var tok, v1, v29, v33, v34, v35, v36 int32
  22921. _, _, _, _, _, _, _, _ = n, tok, v1, v29, v33, v34, v35, v36
  22922. if ptr >= end {
  22923. return -int32(4)
  22924. }
  22925. if int32(2) > int32(1) {
  22926. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  22927. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  22928. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  22929. if n == uint64(0) {
  22930. return -int32(1)
  22931. }
  22932. end = ptr + uintptr(n)
  22933. }
  22934. }
  22935. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22936. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22937. } else {
  22938. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22939. }
  22940. switch v1 {
  22941. case int32(_BT_QUOT):
  22942. goto _2
  22943. case int32(_BT_APOS):
  22944. goto _3
  22945. case int32(_BT_LT):
  22946. goto _4
  22947. case int32(_BT_CR):
  22948. goto _5
  22949. case int32(_BT_LF):
  22950. goto _6
  22951. case int32(_BT_S):
  22952. goto _7
  22953. case int32(_BT_PERCNT):
  22954. goto _8
  22955. case int32(_BT_COMMA):
  22956. goto _9
  22957. case int32(_BT_LSQB):
  22958. goto _10
  22959. case int32(_BT_RSQB):
  22960. goto _11
  22961. case int32(_BT_LPAR):
  22962. goto _12
  22963. case int32(_BT_RPAR):
  22964. goto _13
  22965. case int32(_BT_VERBAR):
  22966. goto _14
  22967. case int32(_BT_GT):
  22968. goto _15
  22969. case int32(_BT_NUM):
  22970. goto _16
  22971. case int32(_BT_LEAD2):
  22972. goto _17
  22973. case int32(_BT_LEAD3):
  22974. goto _18
  22975. case int32(_BT_LEAD4):
  22976. goto _19
  22977. case int32(_BT_HEX):
  22978. goto _20
  22979. case int32(_BT_NMSTRT):
  22980. goto _21
  22981. case int32(_BT_COLON):
  22982. goto _22
  22983. case int32(_BT_MINUS):
  22984. goto _23
  22985. case int32(_BT_NAME):
  22986. goto _24
  22987. case int32(_BT_DIGIT):
  22988. goto _25
  22989. case int32(_BT_NONASCII):
  22990. goto _26
  22991. default:
  22992. goto _27
  22993. }
  22994. goto _28
  22995. _2:
  22996. ;
  22997. return _little2_scanLit(tls, int32(_BT_QUOT), enc, ptr+uintptr(2), end, nextTokPtr)
  22998. _3:
  22999. ;
  23000. return _little2_scanLit(tls, int32(_BT_APOS), enc, ptr+uintptr(2), end, nextTokPtr)
  23001. _4:
  23002. ;
  23003. ptr += uintptr(2)
  23004. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23005. return -int32(1)
  23006. }
  23007. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  23008. v29 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  23009. } else {
  23010. v29 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  23011. }
  23012. switch v29 {
  23013. case int32(_BT_EXCL):
  23014. return _little2_scanDecl(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  23015. case int32(_BT_QUEST):
  23016. return _little2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  23017. case int32(_BT_NMSTRT):
  23018. fallthrough
  23019. case int32(_BT_HEX):
  23020. fallthrough
  23021. case int32(_BT_NONASCII):
  23022. fallthrough
  23023. case int32(_BT_LEAD2):
  23024. fallthrough
  23025. case int32(_BT_LEAD3):
  23026. fallthrough
  23027. case int32(_BT_LEAD4):
  23028. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr - uintptr(2)
  23029. return int32(m_XML_TOK_INSTANCE_START)
  23030. }
  23031. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23032. return m_XML_TOK_INVALID
  23033. _5:
  23034. ;
  23035. if ptr+uintptr(2) == end {
  23036. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = end
  23037. /* indicate that this might be part of a CR/LF pair */
  23038. return -int32(m_XML_TOK_PROLOG_S)
  23039. }
  23040. /* fall through */
  23041. _7:
  23042. ;
  23043. _6:
  23044. ;
  23045. _32:
  23046. ;
  23047. ptr += uintptr(2)
  23048. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23049. goto _30
  23050. }
  23051. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  23052. v33 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  23053. } else {
  23054. v33 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  23055. }
  23056. switch v33 {
  23057. case int32(_BT_S):
  23058. fallthrough
  23059. case int32(_BT_LF):
  23060. case int32(_BT_CR):
  23061. /* don't split CR/LF pair */
  23062. if ptr+uintptr(2) != end {
  23063. break
  23064. }
  23065. /* fall through */
  23066. fallthrough
  23067. default:
  23068. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23069. return int32(m_XML_TOK_PROLOG_S)
  23070. }
  23071. goto _31
  23072. _31:
  23073. ;
  23074. goto _32
  23075. goto _30
  23076. _30:
  23077. ;
  23078. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23079. return int32(m_XML_TOK_PROLOG_S)
  23080. _8:
  23081. ;
  23082. return _little2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  23083. _9:
  23084. ;
  23085. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23086. return int32(m_XML_TOK_COMMA)
  23087. _10:
  23088. ;
  23089. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23090. return int32(m_XML_TOK_OPEN_BRACKET)
  23091. _11:
  23092. ;
  23093. ptr += uintptr(2)
  23094. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23095. return -int32(m_XML_TOK_CLOSE_BRACKET)
  23096. }
  23097. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  23098. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  23099. return -int32(1)
  23100. }
  23101. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == int32(m_ASCII_GT1) {
  23102. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  23103. return int32(m_XML_TOK_COND_SECT_CLOSE)
  23104. }
  23105. }
  23106. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23107. return int32(m_XML_TOK_CLOSE_BRACKET)
  23108. _12:
  23109. ;
  23110. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23111. return int32(m_XML_TOK_OPEN_PAREN)
  23112. _13:
  23113. ;
  23114. ptr += uintptr(2)
  23115. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23116. return -int32(m_XML_TOK_CLOSE_PAREN)
  23117. }
  23118. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  23119. v34 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  23120. } else {
  23121. v34 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  23122. }
  23123. switch v34 {
  23124. case int32(_BT_AST):
  23125. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23126. return int32(m_XML_TOK_CLOSE_PAREN_ASTERISK)
  23127. case int32(_BT_QUEST):
  23128. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23129. return int32(m_XML_TOK_CLOSE_PAREN_QUESTION)
  23130. case int32(_BT_PLUS):
  23131. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23132. return int32(m_XML_TOK_CLOSE_PAREN_PLUS)
  23133. case int32(_BT_CR):
  23134. fallthrough
  23135. case int32(_BT_LF):
  23136. fallthrough
  23137. case int32(_BT_S):
  23138. fallthrough
  23139. case int32(_BT_GT):
  23140. fallthrough
  23141. case int32(_BT_COMMA):
  23142. fallthrough
  23143. case int32(_BT_VERBAR):
  23144. fallthrough
  23145. case int32(_BT_RPAR):
  23146. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23147. return int32(m_XML_TOK_CLOSE_PAREN)
  23148. }
  23149. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23150. return m_XML_TOK_INVALID
  23151. _14:
  23152. ;
  23153. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23154. return int32(m_XML_TOK_OR)
  23155. _15:
  23156. ;
  23157. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23158. return int32(m_XML_TOK_DECL_CLOSE)
  23159. _16:
  23160. ;
  23161. return _little2_scanPoundName(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  23162. _17:
  23163. ;
  23164. if int64(end)-int64(ptr) < int64(2) {
  23165. return -int32(2)
  23166. }
  23167. if 0 != 0 {
  23168. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23169. return m_XML_TOK_INVALID
  23170. }
  23171. if 0 != 0 {
  23172. ptr += uintptr(2)
  23173. tok = int32(m_XML_TOK_NAME)
  23174. goto _28
  23175. }
  23176. if 0 != 0 {
  23177. ptr += uintptr(2)
  23178. tok = int32(m_XML_TOK_NMTOKEN)
  23179. goto _28
  23180. }
  23181. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23182. return m_XML_TOK_INVALID
  23183. _18:
  23184. ;
  23185. if int64(end)-int64(ptr) < int64(3) {
  23186. return -int32(2)
  23187. }
  23188. if 0 != 0 {
  23189. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23190. return m_XML_TOK_INVALID
  23191. }
  23192. if 0 != 0 {
  23193. ptr += uintptr(3)
  23194. tok = int32(m_XML_TOK_NAME)
  23195. goto _28
  23196. }
  23197. if 0 != 0 {
  23198. ptr += uintptr(3)
  23199. tok = int32(m_XML_TOK_NMTOKEN)
  23200. goto _28
  23201. }
  23202. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23203. return m_XML_TOK_INVALID
  23204. _19:
  23205. ;
  23206. if int64(end)-int64(ptr) < int64(4) {
  23207. return -int32(2)
  23208. }
  23209. if 0 != 0 {
  23210. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23211. return m_XML_TOK_INVALID
  23212. }
  23213. if 0 != 0 {
  23214. ptr += uintptr(4)
  23215. tok = int32(m_XML_TOK_NAME)
  23216. goto _28
  23217. }
  23218. if 0 != 0 {
  23219. ptr += uintptr(4)
  23220. tok = int32(m_XML_TOK_NMTOKEN)
  23221. goto _28
  23222. }
  23223. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23224. return m_XML_TOK_INVALID
  23225. _21:
  23226. ;
  23227. _20:
  23228. ;
  23229. tok = int32(m_XML_TOK_NAME)
  23230. ptr += uintptr(2)
  23231. goto _28
  23232. _25:
  23233. ;
  23234. _24:
  23235. ;
  23236. _23:
  23237. ;
  23238. _22:
  23239. ;
  23240. tok = int32(m_XML_TOK_NMTOKEN)
  23241. ptr += uintptr(2)
  23242. goto _28
  23243. _26:
  23244. ;
  23245. if _namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&int32(0x1F))) != 0 {
  23246. ptr += uintptr(2)
  23247. tok = int32(m_XML_TOK_NAME)
  23248. goto _28
  23249. }
  23250. if _namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&int32(0x1F))) != 0 {
  23251. ptr += uintptr(2)
  23252. tok = int32(m_XML_TOK_NMTOKEN)
  23253. goto _28
  23254. }
  23255. /* fall through */
  23256. _27:
  23257. ;
  23258. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23259. return m_XML_TOK_INVALID
  23260. _28:
  23261. ;
  23262. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23263. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  23264. v35 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  23265. } else {
  23266. v35 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  23267. }
  23268. switch v35 {
  23269. case int32(_BT_NONASCII):
  23270. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  23271. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23272. return m_XML_TOK_INVALID
  23273. } /* fall through */
  23274. fallthrough
  23275. case int32(_BT_NMSTRT):
  23276. fallthrough
  23277. case int32(_BT_HEX):
  23278. fallthrough
  23279. case int32(_BT_DIGIT):
  23280. fallthrough
  23281. case int32(_BT_NAME):
  23282. fallthrough
  23283. case int32(_BT_MINUS):
  23284. ptr += uintptr(2)
  23285. case int32(_BT_LEAD2):
  23286. if int64(end)-int64(ptr) < int64(2) {
  23287. return -int32(2)
  23288. }
  23289. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23290. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23291. return m_XML_TOK_INVALID
  23292. }
  23293. ptr += uintptr(2)
  23294. case int32(_BT_LEAD3):
  23295. if int64(end)-int64(ptr) < int64(3) {
  23296. return -int32(2)
  23297. }
  23298. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23299. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23300. return m_XML_TOK_INVALID
  23301. }
  23302. ptr += uintptr(3)
  23303. case int32(_BT_LEAD4):
  23304. if int64(end)-int64(ptr) < int64(4) {
  23305. return -int32(2)
  23306. }
  23307. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23308. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23309. return m_XML_TOK_INVALID
  23310. }
  23311. ptr += uintptr(4)
  23312. case int32(_BT_GT):
  23313. fallthrough
  23314. case int32(_BT_RPAR):
  23315. fallthrough
  23316. case int32(_BT_COMMA):
  23317. fallthrough
  23318. case int32(_BT_VERBAR):
  23319. fallthrough
  23320. case int32(_BT_LSQB):
  23321. fallthrough
  23322. case int32(_BT_PERCNT):
  23323. fallthrough
  23324. case int32(_BT_S):
  23325. fallthrough
  23326. case int32(_BT_CR):
  23327. fallthrough
  23328. case int32(_BT_LF):
  23329. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23330. return tok
  23331. case int32(_BT_COLON):
  23332. ptr += uintptr(2)
  23333. switch tok {
  23334. case int32(m_XML_TOK_NAME):
  23335. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23336. return -int32(1)
  23337. }
  23338. tok = int32(m_XML_TOK_PREFIXED_NAME)
  23339. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  23340. v36 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  23341. } else {
  23342. v36 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  23343. }
  23344. switch v36 {
  23345. case int32(_BT_NONASCII):
  23346. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  23347. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23348. return m_XML_TOK_INVALID
  23349. } /* fall through */
  23350. fallthrough
  23351. case int32(_BT_NMSTRT):
  23352. fallthrough
  23353. case int32(_BT_HEX):
  23354. fallthrough
  23355. case int32(_BT_DIGIT):
  23356. fallthrough
  23357. case int32(_BT_NAME):
  23358. fallthrough
  23359. case int32(_BT_MINUS):
  23360. ptr += uintptr(2)
  23361. case int32(_BT_LEAD2):
  23362. if int64(end)-int64(ptr) < int64(2) {
  23363. return -int32(2)
  23364. }
  23365. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23366. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23367. return m_XML_TOK_INVALID
  23368. }
  23369. ptr += uintptr(2)
  23370. case int32(_BT_LEAD3):
  23371. if int64(end)-int64(ptr) < int64(3) {
  23372. return -int32(2)
  23373. }
  23374. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23375. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23376. return m_XML_TOK_INVALID
  23377. }
  23378. ptr += uintptr(3)
  23379. case int32(_BT_LEAD4):
  23380. if int64(end)-int64(ptr) < int64(4) {
  23381. return -int32(2)
  23382. }
  23383. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23384. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23385. return m_XML_TOK_INVALID
  23386. }
  23387. ptr += uintptr(4)
  23388. default:
  23389. tok = int32(m_XML_TOK_NMTOKEN)
  23390. break
  23391. }
  23392. case int32(m_XML_TOK_PREFIXED_NAME):
  23393. tok = int32(m_XML_TOK_NMTOKEN)
  23394. break
  23395. }
  23396. case int32(_BT_PLUS):
  23397. if tok == int32(m_XML_TOK_NMTOKEN) {
  23398. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23399. return m_XML_TOK_INVALID
  23400. }
  23401. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23402. return int32(m_XML_TOK_NAME_PLUS)
  23403. case int32(_BT_AST):
  23404. if tok == int32(m_XML_TOK_NMTOKEN) {
  23405. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23406. return m_XML_TOK_INVALID
  23407. }
  23408. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23409. return int32(m_XML_TOK_NAME_ASTERISK)
  23410. case int32(_BT_QUEST):
  23411. if tok == int32(m_XML_TOK_NMTOKEN) {
  23412. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23413. return m_XML_TOK_INVALID
  23414. }
  23415. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23416. return int32(m_XML_TOK_NAME_QUESTION)
  23417. default:
  23418. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23419. return m_XML_TOK_INVALID
  23420. }
  23421. }
  23422. return -tok
  23423. }
  23424. func _little2_attributeValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23425. var start uintptr
  23426. var v1, v2 int32
  23427. _, _, _ = start, v1, v2
  23428. if ptr >= end {
  23429. return -int32(4)
  23430. } else {
  23431. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23432. /* This line cannot be executed. The incoming data has already
  23433. * been tokenized once, so incomplete characters like this have
  23434. * already been eliminated from the input. Retaining the paranoia
  23435. * check is still valuable, however.
  23436. */
  23437. return -int32(1) /* LCOV_EXCL_LINE */
  23438. }
  23439. }
  23440. start = ptr
  23441. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23442. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  23443. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  23444. } else {
  23445. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  23446. }
  23447. switch v1 {
  23448. case int32(_BT_LEAD2):
  23449. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  23450. case int32(_BT_LEAD3):
  23451. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  23452. case int32(_BT_LEAD4):
  23453. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  23454. case int32(_BT_AMP):
  23455. if ptr == start {
  23456. return _little2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  23457. }
  23458. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23459. return int32(m_XML_TOK_DATA_CHARS)
  23460. case int32(_BT_LT):
  23461. /* this is for inside entity references */
  23462. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23463. return m_XML_TOK_INVALID
  23464. case int32(_BT_LF):
  23465. if ptr == start {
  23466. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23467. return int32(m_XML_TOK_DATA_NEWLINE)
  23468. }
  23469. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23470. return int32(m_XML_TOK_DATA_CHARS)
  23471. case int32(_BT_CR):
  23472. if ptr == start {
  23473. ptr += uintptr(2)
  23474. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23475. return -int32(3)
  23476. }
  23477. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  23478. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  23479. } else {
  23480. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  23481. }
  23482. if v2 == int32(_BT_LF) {
  23483. ptr += uintptr(2)
  23484. }
  23485. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23486. return int32(m_XML_TOK_DATA_NEWLINE)
  23487. }
  23488. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23489. return int32(m_XML_TOK_DATA_CHARS)
  23490. case int32(_BT_S):
  23491. if ptr == start {
  23492. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23493. return int32(m_XML_TOK_ATTRIBUTE_VALUE_S)
  23494. }
  23495. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23496. return int32(m_XML_TOK_DATA_CHARS)
  23497. default:
  23498. ptr += uintptr(2)
  23499. break
  23500. }
  23501. }
  23502. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23503. return int32(m_XML_TOK_DATA_CHARS)
  23504. }
  23505. func _little2_entityValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23506. var start uintptr
  23507. var tok, v1, v2, v3 int32
  23508. _, _, _, _, _ = start, tok, v1, v2, v3
  23509. if ptr >= end {
  23510. return -int32(4)
  23511. } else {
  23512. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23513. /* This line cannot be executed. The incoming data has already
  23514. * been tokenized once, so incomplete characters like this have
  23515. * already been eliminated from the input. Retaining the paranoia
  23516. * check is still valuable, however.
  23517. */
  23518. return -int32(1) /* LCOV_EXCL_LINE */
  23519. }
  23520. }
  23521. start = ptr
  23522. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23523. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  23524. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  23525. } else {
  23526. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  23527. }
  23528. switch v1 {
  23529. case int32(_BT_LEAD2):
  23530. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  23531. case int32(_BT_LEAD3):
  23532. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  23533. case int32(_BT_LEAD4):
  23534. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  23535. case int32(_BT_AMP):
  23536. if ptr == start {
  23537. return _little2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  23538. }
  23539. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23540. return int32(m_XML_TOK_DATA_CHARS)
  23541. case int32(_BT_PERCNT):
  23542. if ptr == start {
  23543. tok = _little2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  23544. if tok == int32(m_XML_TOK_PERCENT) {
  23545. v2 = m_XML_TOK_INVALID
  23546. } else {
  23547. v2 = tok
  23548. }
  23549. return v2
  23550. }
  23551. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23552. return int32(m_XML_TOK_DATA_CHARS)
  23553. case int32(_BT_LF):
  23554. if ptr == start {
  23555. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23556. return int32(m_XML_TOK_DATA_NEWLINE)
  23557. }
  23558. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23559. return int32(m_XML_TOK_DATA_CHARS)
  23560. case int32(_BT_CR):
  23561. if ptr == start {
  23562. ptr += uintptr(2)
  23563. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23564. return -int32(3)
  23565. }
  23566. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  23567. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  23568. } else {
  23569. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  23570. }
  23571. if v3 == int32(_BT_LF) {
  23572. ptr += uintptr(2)
  23573. }
  23574. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23575. return int32(m_XML_TOK_DATA_NEWLINE)
  23576. }
  23577. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23578. return int32(m_XML_TOK_DATA_CHARS)
  23579. default:
  23580. ptr += uintptr(2)
  23581. break
  23582. }
  23583. }
  23584. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23585. return int32(m_XML_TOK_DATA_CHARS)
  23586. }
  23587. func _little2_ignoreSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23588. var level, v1 int32
  23589. var n Tsize_t
  23590. _, _, _ = level, n, v1
  23591. level = 0
  23592. if int32(2) > int32(1) {
  23593. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  23594. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  23595. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  23596. end = ptr + uintptr(n)
  23597. }
  23598. }
  23599. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23600. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  23601. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  23602. } else {
  23603. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  23604. }
  23605. switch v1 {
  23606. case int32(_BT_LEAD2):
  23607. if int64(end)-int64(ptr) < int64(2) {
  23608. return -int32(2)
  23609. }
  23610. if 0 != 0 {
  23611. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23612. return m_XML_TOK_INVALID
  23613. }
  23614. ptr += uintptr(2)
  23615. case int32(_BT_LEAD3):
  23616. if int64(end)-int64(ptr) < int64(3) {
  23617. return -int32(2)
  23618. }
  23619. if 0 != 0 {
  23620. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23621. return m_XML_TOK_INVALID
  23622. }
  23623. ptr += uintptr(3)
  23624. case int32(_BT_LEAD4):
  23625. if int64(end)-int64(ptr) < int64(4) {
  23626. return -int32(2)
  23627. }
  23628. if 0 != 0 {
  23629. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23630. return m_XML_TOK_INVALID
  23631. }
  23632. ptr += uintptr(4)
  23633. case int32(_BT_NONXML):
  23634. fallthrough
  23635. case int32(_BT_MALFORM):
  23636. fallthrough
  23637. case int32(_BT_TRAIL):
  23638. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23639. return m_XML_TOK_INVALID
  23640. case int32(_BT_LT):
  23641. ptr += uintptr(2)
  23642. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23643. return -int32(1)
  23644. }
  23645. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_EXCL2) {
  23646. ptr += uintptr(2)
  23647. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23648. return -int32(1)
  23649. }
  23650. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_LSQB1) {
  23651. level++
  23652. ptr += uintptr(2)
  23653. }
  23654. }
  23655. case int32(_BT_RSQB):
  23656. ptr += uintptr(2)
  23657. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23658. return -int32(1)
  23659. }
  23660. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  23661. ptr += uintptr(2)
  23662. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23663. return -int32(1)
  23664. }
  23665. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  23666. ptr += uintptr(2)
  23667. if level == 0 {
  23668. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23669. return int32(m_XML_TOK_IGNORE_SECT)
  23670. }
  23671. level--
  23672. }
  23673. }
  23674. default:
  23675. ptr += uintptr(2)
  23676. break
  23677. }
  23678. }
  23679. return -int32(1)
  23680. }
  23681. func _little2_isPublicId(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr) (r int32) {
  23682. var v2, v3, v4 int32
  23683. _, _, _ = v2, v3, v4
  23684. ptr += uintptr(2)
  23685. end -= uintptr(2)
  23686. for {
  23687. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23688. break
  23689. }
  23690. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  23691. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  23692. } else {
  23693. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  23694. }
  23695. switch v2 {
  23696. case int32(_BT_DIGIT):
  23697. fallthrough
  23698. case int32(_BT_HEX):
  23699. fallthrough
  23700. case int32(_BT_MINUS):
  23701. fallthrough
  23702. case int32(_BT_APOS):
  23703. fallthrough
  23704. case int32(_BT_LPAR):
  23705. fallthrough
  23706. case int32(_BT_RPAR):
  23707. fallthrough
  23708. case int32(_BT_PLUS):
  23709. fallthrough
  23710. case int32(_BT_COMMA):
  23711. fallthrough
  23712. case int32(_BT_SOL):
  23713. fallthrough
  23714. case int32(_BT_EQUALS):
  23715. fallthrough
  23716. case int32(_BT_QUEST):
  23717. fallthrough
  23718. case int32(_BT_CR):
  23719. fallthrough
  23720. case int32(_BT_LF):
  23721. fallthrough
  23722. case int32(_BT_SEMI):
  23723. fallthrough
  23724. case int32(_BT_EXCL):
  23725. fallthrough
  23726. case int32(_BT_AST):
  23727. fallthrough
  23728. case int32(_BT_PERCNT):
  23729. fallthrough
  23730. case int32(_BT_NUM):
  23731. fallthrough
  23732. case int32(_BT_COLON):
  23733. case int32(_BT_S):
  23734. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_TAB1) {
  23735. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  23736. return 0
  23737. }
  23738. case int32(_BT_NAME):
  23739. fallthrough
  23740. case int32(_BT_NMSTRT):
  23741. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  23742. v3 = int32(*(*int8)(unsafe.Pointer(ptr)))
  23743. } else {
  23744. v3 = -int32(1)
  23745. }
  23746. if !(v3 & ^libc.Int32FromInt32(0x7f) != 0) {
  23747. break
  23748. }
  23749. /* fall through */
  23750. fallthrough
  23751. default:
  23752. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  23753. v4 = int32(*(*int8)(unsafe.Pointer(ptr)))
  23754. } else {
  23755. v4 = -int32(1)
  23756. }
  23757. switch v4 {
  23758. case int32(0x24): /* $ */
  23759. fallthrough
  23760. case int32(0x40): /* @ */
  23761. default:
  23762. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  23763. return 0
  23764. }
  23765. break
  23766. }
  23767. goto _1
  23768. _1:
  23769. ;
  23770. ptr += uintptr(2)
  23771. }
  23772. return int32(1)
  23773. }
  23774. /* This must only be called for a well-formed start-tag or empty
  23775. element tag. Returns the number of attributes. Pointers to the
  23776. first attsMax attributes are stored in atts.
  23777. */
  23778. func _little2_getAtts(tls *libc.TLS, enc uintptr, ptr uintptr, attsMax int32, atts uintptr) (r int32) {
  23779. var nAtts, open, state, v2, v3, v5, v7 int32
  23780. var v4, v6, v8, v9 bool
  23781. _, _, _, _, _, _, _, _, _, _, _ = nAtts, open, state, v2, v3, v4, v5, v6, v7, v8, v9
  23782. state = 1
  23783. nAtts = 0
  23784. open = 0 /* defined when state == inValue;
  23785. initialization just to shut up compilers */
  23786. ptr += uintptr(2)
  23787. for {
  23788. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  23789. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  23790. } else {
  23791. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  23792. }
  23793. switch v2 {
  23794. case int32(_BT_LEAD2):
  23795. if state == 0 {
  23796. if nAtts < attsMax {
  23797. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  23798. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  23799. }
  23800. state = 1
  23801. }
  23802. ptr += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(2))
  23803. case int32(_BT_LEAD3):
  23804. if state == 0 {
  23805. if nAtts < attsMax {
  23806. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  23807. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  23808. }
  23809. state = 1
  23810. }
  23811. ptr += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(2))
  23812. case int32(_BT_LEAD4):
  23813. if state == 0 {
  23814. if nAtts < attsMax {
  23815. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  23816. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  23817. }
  23818. state = 1
  23819. }
  23820. ptr += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(2))
  23821. case int32(_BT_NONASCII):
  23822. fallthrough
  23823. case int32(_BT_NMSTRT):
  23824. fallthrough
  23825. case int32(_BT_HEX):
  23826. if state == 0 {
  23827. if nAtts < attsMax {
  23828. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  23829. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  23830. }
  23831. state = 1
  23832. }
  23833. case int32(_BT_QUOT):
  23834. if state != 2 {
  23835. if nAtts < attsMax {
  23836. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  23837. }
  23838. state = 2
  23839. open = int32(_BT_QUOT)
  23840. } else {
  23841. if open == int32(_BT_QUOT) {
  23842. state = 0
  23843. if nAtts < attsMax {
  23844. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  23845. }
  23846. nAtts++
  23847. }
  23848. }
  23849. case int32(_BT_APOS):
  23850. if state != 2 {
  23851. if nAtts < attsMax {
  23852. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  23853. }
  23854. state = 2
  23855. open = int32(_BT_APOS)
  23856. } else {
  23857. if open == int32(_BT_APOS) {
  23858. state = 0
  23859. if nAtts < attsMax {
  23860. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  23861. }
  23862. nAtts++
  23863. }
  23864. }
  23865. case int32(_BT_AMP):
  23866. if nAtts < attsMax {
  23867. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  23868. }
  23869. case int32(_BT_S):
  23870. if state == 1 {
  23871. state = 0
  23872. } else {
  23873. if v9 = state == 2 && nAtts < attsMax && (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized != 0; v9 {
  23874. if v4 = ptr == (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr; !v4 {
  23875. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  23876. v3 = int32(*(*int8)(unsafe.Pointer(ptr)))
  23877. } else {
  23878. v3 = -int32(1)
  23879. }
  23880. }
  23881. if v6 = v4 || v3 != int32(m_ASCII_SPACE1); !v6 {
  23882. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 {
  23883. v5 = int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))
  23884. } else {
  23885. v5 = -int32(1)
  23886. }
  23887. }
  23888. if v8 = v6 || v5 == int32(m_ASCII_SPACE1); !v8 {
  23889. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 {
  23890. v7 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))))))
  23891. } else {
  23892. v7 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)), *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))
  23893. }
  23894. }
  23895. }
  23896. if v9 && (v8 || v7 == open) {
  23897. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  23898. }
  23899. }
  23900. case int32(_BT_CR):
  23901. fallthrough
  23902. case int32(_BT_LF):
  23903. /* This case ensures that the first attribute name is counted
  23904. Apart from that we could just change state on the quote. */
  23905. if state == 1 {
  23906. state = 0
  23907. } else {
  23908. if state == 2 && nAtts < attsMax {
  23909. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  23910. }
  23911. }
  23912. case int32(_BT_GT):
  23913. fallthrough
  23914. case int32(_BT_SOL):
  23915. if state != 2 {
  23916. return nAtts
  23917. }
  23918. default:
  23919. break
  23920. }
  23921. goto _1
  23922. _1:
  23923. ;
  23924. ptr += uintptr(2)
  23925. }
  23926. /* not reached */
  23927. return r
  23928. }
  23929. func _little2_charRefNumber(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  23930. var c, c1, result, v2, v4 int32
  23931. _, _, _, _, _ = c, c1, result, v2, v4
  23932. result = 0
  23933. /* skip &# */
  23934. _ = enc
  23935. ptr += uintptr(libc.Int32FromInt32(2) * libc.Int32FromInt32(2))
  23936. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  23937. ptr += uintptr(2)
  23938. for {
  23939. if !!(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_SEMI1)) {
  23940. break
  23941. }
  23942. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  23943. v2 = int32(*(*int8)(unsafe.Pointer(ptr)))
  23944. } else {
  23945. v2 = -int32(1)
  23946. }
  23947. c = v2
  23948. switch c {
  23949. case int32(m_ASCII_02):
  23950. fallthrough
  23951. case int32(m_ASCII_12):
  23952. fallthrough
  23953. case int32(m_ASCII_22):
  23954. fallthrough
  23955. case int32(m_ASCII_32):
  23956. fallthrough
  23957. case int32(m_ASCII_41):
  23958. fallthrough
  23959. case int32(m_ASCII_51):
  23960. fallthrough
  23961. case int32(m_ASCII_61):
  23962. fallthrough
  23963. case int32(m_ASCII_71):
  23964. fallthrough
  23965. case int32(m_ASCII_82):
  23966. fallthrough
  23967. case int32(m_ASCII_92):
  23968. result <<= int32(4)
  23969. result |= c - int32(m_ASCII_02)
  23970. case int32(m_ASCII_A):
  23971. fallthrough
  23972. case int32(m_ASCII_B1):
  23973. fallthrough
  23974. case int32(m_ASCII_C):
  23975. fallthrough
  23976. case int32(m_ASCII_D):
  23977. fallthrough
  23978. case int32(m_ASCII_E):
  23979. fallthrough
  23980. case int32(m_ASCII_F):
  23981. result <<= int32(4)
  23982. result += int32(10) + (c - int32(m_ASCII_A))
  23983. case int32(m_ASCII_a2):
  23984. fallthrough
  23985. case int32(m_ASCII_b1):
  23986. fallthrough
  23987. case int32(m_ASCII_c2):
  23988. fallthrough
  23989. case int32(m_ASCII_d1):
  23990. fallthrough
  23991. case int32(m_ASCII_e2):
  23992. fallthrough
  23993. case int32(m_ASCII_f1):
  23994. result <<= int32(4)
  23995. result += int32(10) + (c - int32(m_ASCII_a2))
  23996. break
  23997. }
  23998. if result >= int32(0x110000) {
  23999. return -int32(1)
  24000. }
  24001. goto _1
  24002. _1:
  24003. ;
  24004. ptr += uintptr(2)
  24005. }
  24006. } else {
  24007. for {
  24008. if !!(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_SEMI1)) {
  24009. break
  24010. }
  24011. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  24012. v4 = int32(*(*int8)(unsafe.Pointer(ptr)))
  24013. } else {
  24014. v4 = -int32(1)
  24015. }
  24016. c1 = v4
  24017. result *= int32(10)
  24018. result += c1 - int32(m_ASCII_02)
  24019. if result >= int32(0x110000) {
  24020. return -int32(1)
  24021. }
  24022. goto _3
  24023. _3:
  24024. ;
  24025. ptr += uintptr(2)
  24026. }
  24027. }
  24028. return _checkCharRefNumber(tls, result)
  24029. }
  24030. func _little2_predefinedEntityName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr) (r int32) {
  24031. var v1, v2 int32
  24032. _, _ = v1, v2
  24033. _ = enc
  24034. switch (int64(end) - int64(ptr)) / libc.Int64FromInt32(2) {
  24035. case int64(2):
  24036. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == int32(m_ASCII_t2) {
  24037. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  24038. v1 = int32(*(*int8)(unsafe.Pointer(ptr)))
  24039. } else {
  24040. v1 = -int32(1)
  24041. }
  24042. switch v1 {
  24043. case int32(m_ASCII_l2):
  24044. return int32(m_ASCII_LT1)
  24045. case int32(m_ASCII_g2):
  24046. return int32(m_ASCII_GT1)
  24047. }
  24048. }
  24049. case int64(3):
  24050. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_a2) {
  24051. ptr += uintptr(2)
  24052. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_m2) {
  24053. ptr += uintptr(2)
  24054. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  24055. return int32(m_ASCII_AMP1)
  24056. }
  24057. }
  24058. }
  24059. case int64(4):
  24060. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  24061. v2 = int32(*(*int8)(unsafe.Pointer(ptr)))
  24062. } else {
  24063. v2 = -int32(1)
  24064. }
  24065. switch v2 {
  24066. case int32(m_ASCII_q1):
  24067. ptr += uintptr(2)
  24068. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_u1) {
  24069. ptr += uintptr(2)
  24070. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  24071. ptr += uintptr(2)
  24072. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_t2) {
  24073. return int32(m_ASCII_QUOT1)
  24074. }
  24075. }
  24076. }
  24077. case int32(m_ASCII_a2):
  24078. ptr += uintptr(2)
  24079. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  24080. ptr += uintptr(2)
  24081. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  24082. ptr += uintptr(2)
  24083. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_s2) {
  24084. return int32(m_ASCII_APOS1)
  24085. }
  24086. }
  24087. }
  24088. break
  24089. }
  24090. }
  24091. return 0
  24092. }
  24093. func _little2_nameMatchesAscii(tls *libc.TLS, enc uintptr, ptr1 uintptr, end1 uintptr, ptr2 uintptr) (r int32) {
  24094. _ = enc
  24095. for {
  24096. if !(*(*int8)(unsafe.Pointer(ptr2)) != 0) {
  24097. break
  24098. }
  24099. if int64(end1)-int64(ptr1) < int64(2) {
  24100. /* This line cannot be executed. The incoming data has already
  24101. * been tokenized once, so incomplete characters like this have
  24102. * already been eliminated from the input. Retaining the
  24103. * paranoia check is still valuable, however.
  24104. */
  24105. return 0 /* LCOV_EXCL_LINE */
  24106. }
  24107. if !(int32(*(*int8)(unsafe.Pointer(ptr1 + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr1))) == int32(*(*int8)(unsafe.Pointer(ptr2)))) {
  24108. return 0
  24109. }
  24110. goto _1
  24111. _1:
  24112. ;
  24113. ptr1 += uintptr(2)
  24114. ptr2++
  24115. }
  24116. return libc.BoolInt32(ptr1 == end1)
  24117. }
  24118. func _little2_nameLength(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  24119. var start uintptr
  24120. var v2 int32
  24121. _, _ = start, v2
  24122. start = ptr
  24123. for {
  24124. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  24125. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  24126. } else {
  24127. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  24128. }
  24129. switch v2 {
  24130. case int32(_BT_LEAD2):
  24131. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  24132. case int32(_BT_LEAD3):
  24133. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  24134. case int32(_BT_LEAD4):
  24135. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  24136. case int32(_BT_NONASCII):
  24137. fallthrough
  24138. case int32(_BT_NMSTRT):
  24139. fallthrough
  24140. case int32(_BT_COLON):
  24141. fallthrough
  24142. case int32(_BT_HEX):
  24143. fallthrough
  24144. case int32(_BT_DIGIT):
  24145. fallthrough
  24146. case int32(_BT_NAME):
  24147. fallthrough
  24148. case int32(_BT_MINUS):
  24149. ptr += uintptr(2)
  24150. default:
  24151. return int32(int64(ptr) - int64(start))
  24152. }
  24153. goto _1
  24154. _1:
  24155. }
  24156. return r
  24157. }
  24158. func _little2_skipS(tls *libc.TLS, enc uintptr, ptr uintptr) (r uintptr) {
  24159. var v2 int32
  24160. _ = v2
  24161. for {
  24162. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  24163. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  24164. } else {
  24165. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  24166. }
  24167. switch v2 {
  24168. case int32(_BT_LF):
  24169. fallthrough
  24170. case int32(_BT_CR):
  24171. fallthrough
  24172. case int32(_BT_S):
  24173. ptr += uintptr(2)
  24174. default:
  24175. return ptr
  24176. }
  24177. goto _1
  24178. _1:
  24179. }
  24180. return r
  24181. }
  24182. func _little2_updatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  24183. var v1, v2 int32
  24184. var v3 bool
  24185. _, _, _ = v1, v2, v3
  24186. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24187. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  24188. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  24189. } else {
  24190. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  24191. }
  24192. switch v1 {
  24193. case int32(_BT_LEAD2):
  24194. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  24195. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  24196. case int32(_BT_LEAD3):
  24197. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  24198. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  24199. case int32(_BT_LEAD4):
  24200. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  24201. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  24202. case int32(_BT_LF):
  24203. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  24204. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  24205. ptr += uintptr(2)
  24206. case int32(_BT_CR):
  24207. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  24208. ptr += uintptr(2)
  24209. if v3 = int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)); v3 {
  24210. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  24211. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  24212. } else {
  24213. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  24214. }
  24215. }
  24216. if v3 && v2 == int32(_BT_LF) {
  24217. ptr += uintptr(2)
  24218. }
  24219. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  24220. default:
  24221. ptr += uintptr(2)
  24222. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  24223. break
  24224. }
  24225. }
  24226. }
  24227. var _little2_encoding_ns = Tnormal_encoding{
  24228. Fenc: TENCODING{
  24229. Fscanners: [4]TSCANNER{},
  24230. FliteralScanners: [2]TSCANNER{},
  24231. FminBytesPerChar: int32(2),
  24232. FisUtf16: int8(1),
  24233. },
  24234. Ftype1: [256]uint8{
  24235. 9: uint8(_BT_S),
  24236. 10: uint8(_BT_LF),
  24237. 13: uint8(_BT_CR),
  24238. 32: uint8(_BT_S),
  24239. 33: uint8(_BT_EXCL),
  24240. 34: uint8(_BT_QUOT),
  24241. 35: uint8(_BT_NUM),
  24242. 36: uint8(_BT_OTHER),
  24243. 37: uint8(_BT_PERCNT),
  24244. 38: uint8(_BT_AMP),
  24245. 39: uint8(_BT_APOS),
  24246. 40: uint8(_BT_LPAR),
  24247. 41: uint8(_BT_RPAR),
  24248. 42: uint8(_BT_AST),
  24249. 43: uint8(_BT_PLUS),
  24250. 44: uint8(_BT_COMMA),
  24251. 45: uint8(_BT_MINUS),
  24252. 46: uint8(_BT_NAME),
  24253. 47: uint8(_BT_SOL),
  24254. 48: uint8(_BT_DIGIT),
  24255. 49: uint8(_BT_DIGIT),
  24256. 50: uint8(_BT_DIGIT),
  24257. 51: uint8(_BT_DIGIT),
  24258. 52: uint8(_BT_DIGIT),
  24259. 53: uint8(_BT_DIGIT),
  24260. 54: uint8(_BT_DIGIT),
  24261. 55: uint8(_BT_DIGIT),
  24262. 56: uint8(_BT_DIGIT),
  24263. 57: uint8(_BT_DIGIT),
  24264. 58: uint8(_BT_COLON),
  24265. 59: uint8(_BT_SEMI),
  24266. 60: uint8(_BT_LT),
  24267. 61: uint8(_BT_EQUALS),
  24268. 62: uint8(_BT_GT),
  24269. 63: uint8(_BT_QUEST),
  24270. 64: uint8(_BT_OTHER),
  24271. 65: uint8(_BT_HEX),
  24272. 66: uint8(_BT_HEX),
  24273. 67: uint8(_BT_HEX),
  24274. 68: uint8(_BT_HEX),
  24275. 69: uint8(_BT_HEX),
  24276. 70: uint8(_BT_HEX),
  24277. 71: uint8(_BT_NMSTRT),
  24278. 72: uint8(_BT_NMSTRT),
  24279. 73: uint8(_BT_NMSTRT),
  24280. 74: uint8(_BT_NMSTRT),
  24281. 75: uint8(_BT_NMSTRT),
  24282. 76: uint8(_BT_NMSTRT),
  24283. 77: uint8(_BT_NMSTRT),
  24284. 78: uint8(_BT_NMSTRT),
  24285. 79: uint8(_BT_NMSTRT),
  24286. 80: uint8(_BT_NMSTRT),
  24287. 81: uint8(_BT_NMSTRT),
  24288. 82: uint8(_BT_NMSTRT),
  24289. 83: uint8(_BT_NMSTRT),
  24290. 84: uint8(_BT_NMSTRT),
  24291. 85: uint8(_BT_NMSTRT),
  24292. 86: uint8(_BT_NMSTRT),
  24293. 87: uint8(_BT_NMSTRT),
  24294. 88: uint8(_BT_NMSTRT),
  24295. 89: uint8(_BT_NMSTRT),
  24296. 90: uint8(_BT_NMSTRT),
  24297. 91: uint8(_BT_LSQB),
  24298. 92: uint8(_BT_OTHER),
  24299. 93: uint8(_BT_RSQB),
  24300. 94: uint8(_BT_OTHER),
  24301. 95: uint8(_BT_NMSTRT),
  24302. 96: uint8(_BT_OTHER),
  24303. 97: uint8(_BT_HEX),
  24304. 98: uint8(_BT_HEX),
  24305. 99: uint8(_BT_HEX),
  24306. 100: uint8(_BT_HEX),
  24307. 101: uint8(_BT_HEX),
  24308. 102: uint8(_BT_HEX),
  24309. 103: uint8(_BT_NMSTRT),
  24310. 104: uint8(_BT_NMSTRT),
  24311. 105: uint8(_BT_NMSTRT),
  24312. 106: uint8(_BT_NMSTRT),
  24313. 107: uint8(_BT_NMSTRT),
  24314. 108: uint8(_BT_NMSTRT),
  24315. 109: uint8(_BT_NMSTRT),
  24316. 110: uint8(_BT_NMSTRT),
  24317. 111: uint8(_BT_NMSTRT),
  24318. 112: uint8(_BT_NMSTRT),
  24319. 113: uint8(_BT_NMSTRT),
  24320. 114: uint8(_BT_NMSTRT),
  24321. 115: uint8(_BT_NMSTRT),
  24322. 116: uint8(_BT_NMSTRT),
  24323. 117: uint8(_BT_NMSTRT),
  24324. 118: uint8(_BT_NMSTRT),
  24325. 119: uint8(_BT_NMSTRT),
  24326. 120: uint8(_BT_NMSTRT),
  24327. 121: uint8(_BT_NMSTRT),
  24328. 122: uint8(_BT_NMSTRT),
  24329. 123: uint8(_BT_OTHER),
  24330. 124: uint8(_BT_VERBAR),
  24331. 125: uint8(_BT_OTHER),
  24332. 126: uint8(_BT_OTHER),
  24333. 127: uint8(_BT_OTHER),
  24334. 128: uint8(_BT_OTHER),
  24335. 129: uint8(_BT_OTHER),
  24336. 130: uint8(_BT_OTHER),
  24337. 131: uint8(_BT_OTHER),
  24338. 132: uint8(_BT_OTHER),
  24339. 133: uint8(_BT_OTHER),
  24340. 134: uint8(_BT_OTHER),
  24341. 135: uint8(_BT_OTHER),
  24342. 136: uint8(_BT_OTHER),
  24343. 137: uint8(_BT_OTHER),
  24344. 138: uint8(_BT_OTHER),
  24345. 139: uint8(_BT_OTHER),
  24346. 140: uint8(_BT_OTHER),
  24347. 141: uint8(_BT_OTHER),
  24348. 142: uint8(_BT_OTHER),
  24349. 143: uint8(_BT_OTHER),
  24350. 144: uint8(_BT_OTHER),
  24351. 145: uint8(_BT_OTHER),
  24352. 146: uint8(_BT_OTHER),
  24353. 147: uint8(_BT_OTHER),
  24354. 148: uint8(_BT_OTHER),
  24355. 149: uint8(_BT_OTHER),
  24356. 150: uint8(_BT_OTHER),
  24357. 151: uint8(_BT_OTHER),
  24358. 152: uint8(_BT_OTHER),
  24359. 153: uint8(_BT_OTHER),
  24360. 154: uint8(_BT_OTHER),
  24361. 155: uint8(_BT_OTHER),
  24362. 156: uint8(_BT_OTHER),
  24363. 157: uint8(_BT_OTHER),
  24364. 158: uint8(_BT_OTHER),
  24365. 159: uint8(_BT_OTHER),
  24366. 160: uint8(_BT_OTHER),
  24367. 161: uint8(_BT_OTHER),
  24368. 162: uint8(_BT_OTHER),
  24369. 163: uint8(_BT_OTHER),
  24370. 164: uint8(_BT_OTHER),
  24371. 165: uint8(_BT_OTHER),
  24372. 166: uint8(_BT_OTHER),
  24373. 167: uint8(_BT_OTHER),
  24374. 168: uint8(_BT_OTHER),
  24375. 169: uint8(_BT_OTHER),
  24376. 170: uint8(_BT_NMSTRT),
  24377. 171: uint8(_BT_OTHER),
  24378. 172: uint8(_BT_OTHER),
  24379. 173: uint8(_BT_OTHER),
  24380. 174: uint8(_BT_OTHER),
  24381. 175: uint8(_BT_OTHER),
  24382. 176: uint8(_BT_OTHER),
  24383. 177: uint8(_BT_OTHER),
  24384. 178: uint8(_BT_OTHER),
  24385. 179: uint8(_BT_OTHER),
  24386. 180: uint8(_BT_OTHER),
  24387. 181: uint8(_BT_NMSTRT),
  24388. 182: uint8(_BT_OTHER),
  24389. 183: uint8(_BT_NAME),
  24390. 184: uint8(_BT_OTHER),
  24391. 185: uint8(_BT_OTHER),
  24392. 186: uint8(_BT_NMSTRT),
  24393. 187: uint8(_BT_OTHER),
  24394. 188: uint8(_BT_OTHER),
  24395. 189: uint8(_BT_OTHER),
  24396. 190: uint8(_BT_OTHER),
  24397. 191: uint8(_BT_OTHER),
  24398. 192: uint8(_BT_NMSTRT),
  24399. 193: uint8(_BT_NMSTRT),
  24400. 194: uint8(_BT_NMSTRT),
  24401. 195: uint8(_BT_NMSTRT),
  24402. 196: uint8(_BT_NMSTRT),
  24403. 197: uint8(_BT_NMSTRT),
  24404. 198: uint8(_BT_NMSTRT),
  24405. 199: uint8(_BT_NMSTRT),
  24406. 200: uint8(_BT_NMSTRT),
  24407. 201: uint8(_BT_NMSTRT),
  24408. 202: uint8(_BT_NMSTRT),
  24409. 203: uint8(_BT_NMSTRT),
  24410. 204: uint8(_BT_NMSTRT),
  24411. 205: uint8(_BT_NMSTRT),
  24412. 206: uint8(_BT_NMSTRT),
  24413. 207: uint8(_BT_NMSTRT),
  24414. 208: uint8(_BT_NMSTRT),
  24415. 209: uint8(_BT_NMSTRT),
  24416. 210: uint8(_BT_NMSTRT),
  24417. 211: uint8(_BT_NMSTRT),
  24418. 212: uint8(_BT_NMSTRT),
  24419. 213: uint8(_BT_NMSTRT),
  24420. 214: uint8(_BT_NMSTRT),
  24421. 215: uint8(_BT_OTHER),
  24422. 216: uint8(_BT_NMSTRT),
  24423. 217: uint8(_BT_NMSTRT),
  24424. 218: uint8(_BT_NMSTRT),
  24425. 219: uint8(_BT_NMSTRT),
  24426. 220: uint8(_BT_NMSTRT),
  24427. 221: uint8(_BT_NMSTRT),
  24428. 222: uint8(_BT_NMSTRT),
  24429. 223: uint8(_BT_NMSTRT),
  24430. 224: uint8(_BT_NMSTRT),
  24431. 225: uint8(_BT_NMSTRT),
  24432. 226: uint8(_BT_NMSTRT),
  24433. 227: uint8(_BT_NMSTRT),
  24434. 228: uint8(_BT_NMSTRT),
  24435. 229: uint8(_BT_NMSTRT),
  24436. 230: uint8(_BT_NMSTRT),
  24437. 231: uint8(_BT_NMSTRT),
  24438. 232: uint8(_BT_NMSTRT),
  24439. 233: uint8(_BT_NMSTRT),
  24440. 234: uint8(_BT_NMSTRT),
  24441. 235: uint8(_BT_NMSTRT),
  24442. 236: uint8(_BT_NMSTRT),
  24443. 237: uint8(_BT_NMSTRT),
  24444. 238: uint8(_BT_NMSTRT),
  24445. 239: uint8(_BT_NMSTRT),
  24446. 240: uint8(_BT_NMSTRT),
  24447. 241: uint8(_BT_NMSTRT),
  24448. 242: uint8(_BT_NMSTRT),
  24449. 243: uint8(_BT_NMSTRT),
  24450. 244: uint8(_BT_NMSTRT),
  24451. 245: uint8(_BT_NMSTRT),
  24452. 246: uint8(_BT_NMSTRT),
  24453. 247: uint8(_BT_OTHER),
  24454. 248: uint8(_BT_NMSTRT),
  24455. 249: uint8(_BT_NMSTRT),
  24456. 250: uint8(_BT_NMSTRT),
  24457. 251: uint8(_BT_NMSTRT),
  24458. 252: uint8(_BT_NMSTRT),
  24459. 253: uint8(_BT_NMSTRT),
  24460. 254: uint8(_BT_NMSTRT),
  24461. 255: uint8(_BT_NMSTRT),
  24462. },
  24463. }
  24464. func init() {
  24465. p := unsafe.Pointer(&_little2_encoding_ns)
  24466. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  24467. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_contentTok)
  24468. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_cdataSectionTok)
  24469. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_ignoreSectionTok)
  24470. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_attributeValueTok)
  24471. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_entityValueTok)
  24472. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_nameMatchesAscii)
  24473. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_nameLength)
  24474. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_little2_skipS)
  24475. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_little2_getAtts)
  24476. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_little2_charRefNumber)
  24477. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_little2_predefinedEntityName)
  24478. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_little2_updatePosition)
  24479. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_little2_isPublicId)
  24480. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_little2_toUtf8)
  24481. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_little2_toUtf16)
  24482. }
  24483. var _little2_encoding = Tnormal_encoding{
  24484. Fenc: TENCODING{
  24485. Fscanners: [4]TSCANNER{},
  24486. FliteralScanners: [2]TSCANNER{},
  24487. FminBytesPerChar: int32(2),
  24488. FisUtf16: int8(1),
  24489. },
  24490. Ftype1: [256]uint8{
  24491. 9: uint8(_BT_S),
  24492. 10: uint8(_BT_LF),
  24493. 13: uint8(_BT_CR),
  24494. 32: uint8(_BT_S),
  24495. 33: uint8(_BT_EXCL),
  24496. 34: uint8(_BT_QUOT),
  24497. 35: uint8(_BT_NUM),
  24498. 36: uint8(_BT_OTHER),
  24499. 37: uint8(_BT_PERCNT),
  24500. 38: uint8(_BT_AMP),
  24501. 39: uint8(_BT_APOS),
  24502. 40: uint8(_BT_LPAR),
  24503. 41: uint8(_BT_RPAR),
  24504. 42: uint8(_BT_AST),
  24505. 43: uint8(_BT_PLUS),
  24506. 44: uint8(_BT_COMMA),
  24507. 45: uint8(_BT_MINUS),
  24508. 46: uint8(_BT_NAME),
  24509. 47: uint8(_BT_SOL),
  24510. 48: uint8(_BT_DIGIT),
  24511. 49: uint8(_BT_DIGIT),
  24512. 50: uint8(_BT_DIGIT),
  24513. 51: uint8(_BT_DIGIT),
  24514. 52: uint8(_BT_DIGIT),
  24515. 53: uint8(_BT_DIGIT),
  24516. 54: uint8(_BT_DIGIT),
  24517. 55: uint8(_BT_DIGIT),
  24518. 56: uint8(_BT_DIGIT),
  24519. 57: uint8(_BT_DIGIT),
  24520. 58: uint8(_BT_NMSTRT),
  24521. 59: uint8(_BT_SEMI),
  24522. 60: uint8(_BT_LT),
  24523. 61: uint8(_BT_EQUALS),
  24524. 62: uint8(_BT_GT),
  24525. 63: uint8(_BT_QUEST),
  24526. 64: uint8(_BT_OTHER),
  24527. 65: uint8(_BT_HEX),
  24528. 66: uint8(_BT_HEX),
  24529. 67: uint8(_BT_HEX),
  24530. 68: uint8(_BT_HEX),
  24531. 69: uint8(_BT_HEX),
  24532. 70: uint8(_BT_HEX),
  24533. 71: uint8(_BT_NMSTRT),
  24534. 72: uint8(_BT_NMSTRT),
  24535. 73: uint8(_BT_NMSTRT),
  24536. 74: uint8(_BT_NMSTRT),
  24537. 75: uint8(_BT_NMSTRT),
  24538. 76: uint8(_BT_NMSTRT),
  24539. 77: uint8(_BT_NMSTRT),
  24540. 78: uint8(_BT_NMSTRT),
  24541. 79: uint8(_BT_NMSTRT),
  24542. 80: uint8(_BT_NMSTRT),
  24543. 81: uint8(_BT_NMSTRT),
  24544. 82: uint8(_BT_NMSTRT),
  24545. 83: uint8(_BT_NMSTRT),
  24546. 84: uint8(_BT_NMSTRT),
  24547. 85: uint8(_BT_NMSTRT),
  24548. 86: uint8(_BT_NMSTRT),
  24549. 87: uint8(_BT_NMSTRT),
  24550. 88: uint8(_BT_NMSTRT),
  24551. 89: uint8(_BT_NMSTRT),
  24552. 90: uint8(_BT_NMSTRT),
  24553. 91: uint8(_BT_LSQB),
  24554. 92: uint8(_BT_OTHER),
  24555. 93: uint8(_BT_RSQB),
  24556. 94: uint8(_BT_OTHER),
  24557. 95: uint8(_BT_NMSTRT),
  24558. 96: uint8(_BT_OTHER),
  24559. 97: uint8(_BT_HEX),
  24560. 98: uint8(_BT_HEX),
  24561. 99: uint8(_BT_HEX),
  24562. 100: uint8(_BT_HEX),
  24563. 101: uint8(_BT_HEX),
  24564. 102: uint8(_BT_HEX),
  24565. 103: uint8(_BT_NMSTRT),
  24566. 104: uint8(_BT_NMSTRT),
  24567. 105: uint8(_BT_NMSTRT),
  24568. 106: uint8(_BT_NMSTRT),
  24569. 107: uint8(_BT_NMSTRT),
  24570. 108: uint8(_BT_NMSTRT),
  24571. 109: uint8(_BT_NMSTRT),
  24572. 110: uint8(_BT_NMSTRT),
  24573. 111: uint8(_BT_NMSTRT),
  24574. 112: uint8(_BT_NMSTRT),
  24575. 113: uint8(_BT_NMSTRT),
  24576. 114: uint8(_BT_NMSTRT),
  24577. 115: uint8(_BT_NMSTRT),
  24578. 116: uint8(_BT_NMSTRT),
  24579. 117: uint8(_BT_NMSTRT),
  24580. 118: uint8(_BT_NMSTRT),
  24581. 119: uint8(_BT_NMSTRT),
  24582. 120: uint8(_BT_NMSTRT),
  24583. 121: uint8(_BT_NMSTRT),
  24584. 122: uint8(_BT_NMSTRT),
  24585. 123: uint8(_BT_OTHER),
  24586. 124: uint8(_BT_VERBAR),
  24587. 125: uint8(_BT_OTHER),
  24588. 126: uint8(_BT_OTHER),
  24589. 127: uint8(_BT_OTHER),
  24590. 128: uint8(_BT_OTHER),
  24591. 129: uint8(_BT_OTHER),
  24592. 130: uint8(_BT_OTHER),
  24593. 131: uint8(_BT_OTHER),
  24594. 132: uint8(_BT_OTHER),
  24595. 133: uint8(_BT_OTHER),
  24596. 134: uint8(_BT_OTHER),
  24597. 135: uint8(_BT_OTHER),
  24598. 136: uint8(_BT_OTHER),
  24599. 137: uint8(_BT_OTHER),
  24600. 138: uint8(_BT_OTHER),
  24601. 139: uint8(_BT_OTHER),
  24602. 140: uint8(_BT_OTHER),
  24603. 141: uint8(_BT_OTHER),
  24604. 142: uint8(_BT_OTHER),
  24605. 143: uint8(_BT_OTHER),
  24606. 144: uint8(_BT_OTHER),
  24607. 145: uint8(_BT_OTHER),
  24608. 146: uint8(_BT_OTHER),
  24609. 147: uint8(_BT_OTHER),
  24610. 148: uint8(_BT_OTHER),
  24611. 149: uint8(_BT_OTHER),
  24612. 150: uint8(_BT_OTHER),
  24613. 151: uint8(_BT_OTHER),
  24614. 152: uint8(_BT_OTHER),
  24615. 153: uint8(_BT_OTHER),
  24616. 154: uint8(_BT_OTHER),
  24617. 155: uint8(_BT_OTHER),
  24618. 156: uint8(_BT_OTHER),
  24619. 157: uint8(_BT_OTHER),
  24620. 158: uint8(_BT_OTHER),
  24621. 159: uint8(_BT_OTHER),
  24622. 160: uint8(_BT_OTHER),
  24623. 161: uint8(_BT_OTHER),
  24624. 162: uint8(_BT_OTHER),
  24625. 163: uint8(_BT_OTHER),
  24626. 164: uint8(_BT_OTHER),
  24627. 165: uint8(_BT_OTHER),
  24628. 166: uint8(_BT_OTHER),
  24629. 167: uint8(_BT_OTHER),
  24630. 168: uint8(_BT_OTHER),
  24631. 169: uint8(_BT_OTHER),
  24632. 170: uint8(_BT_NMSTRT),
  24633. 171: uint8(_BT_OTHER),
  24634. 172: uint8(_BT_OTHER),
  24635. 173: uint8(_BT_OTHER),
  24636. 174: uint8(_BT_OTHER),
  24637. 175: uint8(_BT_OTHER),
  24638. 176: uint8(_BT_OTHER),
  24639. 177: uint8(_BT_OTHER),
  24640. 178: uint8(_BT_OTHER),
  24641. 179: uint8(_BT_OTHER),
  24642. 180: uint8(_BT_OTHER),
  24643. 181: uint8(_BT_NMSTRT),
  24644. 182: uint8(_BT_OTHER),
  24645. 183: uint8(_BT_NAME),
  24646. 184: uint8(_BT_OTHER),
  24647. 185: uint8(_BT_OTHER),
  24648. 186: uint8(_BT_NMSTRT),
  24649. 187: uint8(_BT_OTHER),
  24650. 188: uint8(_BT_OTHER),
  24651. 189: uint8(_BT_OTHER),
  24652. 190: uint8(_BT_OTHER),
  24653. 191: uint8(_BT_OTHER),
  24654. 192: uint8(_BT_NMSTRT),
  24655. 193: uint8(_BT_NMSTRT),
  24656. 194: uint8(_BT_NMSTRT),
  24657. 195: uint8(_BT_NMSTRT),
  24658. 196: uint8(_BT_NMSTRT),
  24659. 197: uint8(_BT_NMSTRT),
  24660. 198: uint8(_BT_NMSTRT),
  24661. 199: uint8(_BT_NMSTRT),
  24662. 200: uint8(_BT_NMSTRT),
  24663. 201: uint8(_BT_NMSTRT),
  24664. 202: uint8(_BT_NMSTRT),
  24665. 203: uint8(_BT_NMSTRT),
  24666. 204: uint8(_BT_NMSTRT),
  24667. 205: uint8(_BT_NMSTRT),
  24668. 206: uint8(_BT_NMSTRT),
  24669. 207: uint8(_BT_NMSTRT),
  24670. 208: uint8(_BT_NMSTRT),
  24671. 209: uint8(_BT_NMSTRT),
  24672. 210: uint8(_BT_NMSTRT),
  24673. 211: uint8(_BT_NMSTRT),
  24674. 212: uint8(_BT_NMSTRT),
  24675. 213: uint8(_BT_NMSTRT),
  24676. 214: uint8(_BT_NMSTRT),
  24677. 215: uint8(_BT_OTHER),
  24678. 216: uint8(_BT_NMSTRT),
  24679. 217: uint8(_BT_NMSTRT),
  24680. 218: uint8(_BT_NMSTRT),
  24681. 219: uint8(_BT_NMSTRT),
  24682. 220: uint8(_BT_NMSTRT),
  24683. 221: uint8(_BT_NMSTRT),
  24684. 222: uint8(_BT_NMSTRT),
  24685. 223: uint8(_BT_NMSTRT),
  24686. 224: uint8(_BT_NMSTRT),
  24687. 225: uint8(_BT_NMSTRT),
  24688. 226: uint8(_BT_NMSTRT),
  24689. 227: uint8(_BT_NMSTRT),
  24690. 228: uint8(_BT_NMSTRT),
  24691. 229: uint8(_BT_NMSTRT),
  24692. 230: uint8(_BT_NMSTRT),
  24693. 231: uint8(_BT_NMSTRT),
  24694. 232: uint8(_BT_NMSTRT),
  24695. 233: uint8(_BT_NMSTRT),
  24696. 234: uint8(_BT_NMSTRT),
  24697. 235: uint8(_BT_NMSTRT),
  24698. 236: uint8(_BT_NMSTRT),
  24699. 237: uint8(_BT_NMSTRT),
  24700. 238: uint8(_BT_NMSTRT),
  24701. 239: uint8(_BT_NMSTRT),
  24702. 240: uint8(_BT_NMSTRT),
  24703. 241: uint8(_BT_NMSTRT),
  24704. 242: uint8(_BT_NMSTRT),
  24705. 243: uint8(_BT_NMSTRT),
  24706. 244: uint8(_BT_NMSTRT),
  24707. 245: uint8(_BT_NMSTRT),
  24708. 246: uint8(_BT_NMSTRT),
  24709. 247: uint8(_BT_OTHER),
  24710. 248: uint8(_BT_NMSTRT),
  24711. 249: uint8(_BT_NMSTRT),
  24712. 250: uint8(_BT_NMSTRT),
  24713. 251: uint8(_BT_NMSTRT),
  24714. 252: uint8(_BT_NMSTRT),
  24715. 253: uint8(_BT_NMSTRT),
  24716. 254: uint8(_BT_NMSTRT),
  24717. 255: uint8(_BT_NMSTRT),
  24718. },
  24719. }
  24720. func init() {
  24721. p := unsafe.Pointer(&_little2_encoding)
  24722. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  24723. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_contentTok)
  24724. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_cdataSectionTok)
  24725. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_ignoreSectionTok)
  24726. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_attributeValueTok)
  24727. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_entityValueTok)
  24728. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_nameMatchesAscii)
  24729. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_nameLength)
  24730. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_little2_skipS)
  24731. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_little2_getAtts)
  24732. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_little2_charRefNumber)
  24733. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_little2_predefinedEntityName)
  24734. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_little2_updatePosition)
  24735. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_little2_isPublicId)
  24736. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_little2_toUtf8)
  24737. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_little2_toUtf16)
  24738. }
  24739. var _internal_little2_encoding_ns = Tnormal_encoding{
  24740. Fenc: TENCODING{
  24741. Fscanners: [4]TSCANNER{},
  24742. FliteralScanners: [2]TSCANNER{},
  24743. FminBytesPerChar: int32(2),
  24744. FisUtf16: int8(1),
  24745. },
  24746. Ftype1: [256]uint8{
  24747. 9: uint8(_BT_S),
  24748. 10: uint8(_BT_LF),
  24749. 13: uint8(_BT_S),
  24750. 32: uint8(_BT_S),
  24751. 33: uint8(_BT_EXCL),
  24752. 34: uint8(_BT_QUOT),
  24753. 35: uint8(_BT_NUM),
  24754. 36: uint8(_BT_OTHER),
  24755. 37: uint8(_BT_PERCNT),
  24756. 38: uint8(_BT_AMP),
  24757. 39: uint8(_BT_APOS),
  24758. 40: uint8(_BT_LPAR),
  24759. 41: uint8(_BT_RPAR),
  24760. 42: uint8(_BT_AST),
  24761. 43: uint8(_BT_PLUS),
  24762. 44: uint8(_BT_COMMA),
  24763. 45: uint8(_BT_MINUS),
  24764. 46: uint8(_BT_NAME),
  24765. 47: uint8(_BT_SOL),
  24766. 48: uint8(_BT_DIGIT),
  24767. 49: uint8(_BT_DIGIT),
  24768. 50: uint8(_BT_DIGIT),
  24769. 51: uint8(_BT_DIGIT),
  24770. 52: uint8(_BT_DIGIT),
  24771. 53: uint8(_BT_DIGIT),
  24772. 54: uint8(_BT_DIGIT),
  24773. 55: uint8(_BT_DIGIT),
  24774. 56: uint8(_BT_DIGIT),
  24775. 57: uint8(_BT_DIGIT),
  24776. 58: uint8(_BT_COLON),
  24777. 59: uint8(_BT_SEMI),
  24778. 60: uint8(_BT_LT),
  24779. 61: uint8(_BT_EQUALS),
  24780. 62: uint8(_BT_GT),
  24781. 63: uint8(_BT_QUEST),
  24782. 64: uint8(_BT_OTHER),
  24783. 65: uint8(_BT_HEX),
  24784. 66: uint8(_BT_HEX),
  24785. 67: uint8(_BT_HEX),
  24786. 68: uint8(_BT_HEX),
  24787. 69: uint8(_BT_HEX),
  24788. 70: uint8(_BT_HEX),
  24789. 71: uint8(_BT_NMSTRT),
  24790. 72: uint8(_BT_NMSTRT),
  24791. 73: uint8(_BT_NMSTRT),
  24792. 74: uint8(_BT_NMSTRT),
  24793. 75: uint8(_BT_NMSTRT),
  24794. 76: uint8(_BT_NMSTRT),
  24795. 77: uint8(_BT_NMSTRT),
  24796. 78: uint8(_BT_NMSTRT),
  24797. 79: uint8(_BT_NMSTRT),
  24798. 80: uint8(_BT_NMSTRT),
  24799. 81: uint8(_BT_NMSTRT),
  24800. 82: uint8(_BT_NMSTRT),
  24801. 83: uint8(_BT_NMSTRT),
  24802. 84: uint8(_BT_NMSTRT),
  24803. 85: uint8(_BT_NMSTRT),
  24804. 86: uint8(_BT_NMSTRT),
  24805. 87: uint8(_BT_NMSTRT),
  24806. 88: uint8(_BT_NMSTRT),
  24807. 89: uint8(_BT_NMSTRT),
  24808. 90: uint8(_BT_NMSTRT),
  24809. 91: uint8(_BT_LSQB),
  24810. 92: uint8(_BT_OTHER),
  24811. 93: uint8(_BT_RSQB),
  24812. 94: uint8(_BT_OTHER),
  24813. 95: uint8(_BT_NMSTRT),
  24814. 96: uint8(_BT_OTHER),
  24815. 97: uint8(_BT_HEX),
  24816. 98: uint8(_BT_HEX),
  24817. 99: uint8(_BT_HEX),
  24818. 100: uint8(_BT_HEX),
  24819. 101: uint8(_BT_HEX),
  24820. 102: uint8(_BT_HEX),
  24821. 103: uint8(_BT_NMSTRT),
  24822. 104: uint8(_BT_NMSTRT),
  24823. 105: uint8(_BT_NMSTRT),
  24824. 106: uint8(_BT_NMSTRT),
  24825. 107: uint8(_BT_NMSTRT),
  24826. 108: uint8(_BT_NMSTRT),
  24827. 109: uint8(_BT_NMSTRT),
  24828. 110: uint8(_BT_NMSTRT),
  24829. 111: uint8(_BT_NMSTRT),
  24830. 112: uint8(_BT_NMSTRT),
  24831. 113: uint8(_BT_NMSTRT),
  24832. 114: uint8(_BT_NMSTRT),
  24833. 115: uint8(_BT_NMSTRT),
  24834. 116: uint8(_BT_NMSTRT),
  24835. 117: uint8(_BT_NMSTRT),
  24836. 118: uint8(_BT_NMSTRT),
  24837. 119: uint8(_BT_NMSTRT),
  24838. 120: uint8(_BT_NMSTRT),
  24839. 121: uint8(_BT_NMSTRT),
  24840. 122: uint8(_BT_NMSTRT),
  24841. 123: uint8(_BT_OTHER),
  24842. 124: uint8(_BT_VERBAR),
  24843. 125: uint8(_BT_OTHER),
  24844. 126: uint8(_BT_OTHER),
  24845. 127: uint8(_BT_OTHER),
  24846. 128: uint8(_BT_OTHER),
  24847. 129: uint8(_BT_OTHER),
  24848. 130: uint8(_BT_OTHER),
  24849. 131: uint8(_BT_OTHER),
  24850. 132: uint8(_BT_OTHER),
  24851. 133: uint8(_BT_OTHER),
  24852. 134: uint8(_BT_OTHER),
  24853. 135: uint8(_BT_OTHER),
  24854. 136: uint8(_BT_OTHER),
  24855. 137: uint8(_BT_OTHER),
  24856. 138: uint8(_BT_OTHER),
  24857. 139: uint8(_BT_OTHER),
  24858. 140: uint8(_BT_OTHER),
  24859. 141: uint8(_BT_OTHER),
  24860. 142: uint8(_BT_OTHER),
  24861. 143: uint8(_BT_OTHER),
  24862. 144: uint8(_BT_OTHER),
  24863. 145: uint8(_BT_OTHER),
  24864. 146: uint8(_BT_OTHER),
  24865. 147: uint8(_BT_OTHER),
  24866. 148: uint8(_BT_OTHER),
  24867. 149: uint8(_BT_OTHER),
  24868. 150: uint8(_BT_OTHER),
  24869. 151: uint8(_BT_OTHER),
  24870. 152: uint8(_BT_OTHER),
  24871. 153: uint8(_BT_OTHER),
  24872. 154: uint8(_BT_OTHER),
  24873. 155: uint8(_BT_OTHER),
  24874. 156: uint8(_BT_OTHER),
  24875. 157: uint8(_BT_OTHER),
  24876. 158: uint8(_BT_OTHER),
  24877. 159: uint8(_BT_OTHER),
  24878. 160: uint8(_BT_OTHER),
  24879. 161: uint8(_BT_OTHER),
  24880. 162: uint8(_BT_OTHER),
  24881. 163: uint8(_BT_OTHER),
  24882. 164: uint8(_BT_OTHER),
  24883. 165: uint8(_BT_OTHER),
  24884. 166: uint8(_BT_OTHER),
  24885. 167: uint8(_BT_OTHER),
  24886. 168: uint8(_BT_OTHER),
  24887. 169: uint8(_BT_OTHER),
  24888. 170: uint8(_BT_NMSTRT),
  24889. 171: uint8(_BT_OTHER),
  24890. 172: uint8(_BT_OTHER),
  24891. 173: uint8(_BT_OTHER),
  24892. 174: uint8(_BT_OTHER),
  24893. 175: uint8(_BT_OTHER),
  24894. 176: uint8(_BT_OTHER),
  24895. 177: uint8(_BT_OTHER),
  24896. 178: uint8(_BT_OTHER),
  24897. 179: uint8(_BT_OTHER),
  24898. 180: uint8(_BT_OTHER),
  24899. 181: uint8(_BT_NMSTRT),
  24900. 182: uint8(_BT_OTHER),
  24901. 183: uint8(_BT_NAME),
  24902. 184: uint8(_BT_OTHER),
  24903. 185: uint8(_BT_OTHER),
  24904. 186: uint8(_BT_NMSTRT),
  24905. 187: uint8(_BT_OTHER),
  24906. 188: uint8(_BT_OTHER),
  24907. 189: uint8(_BT_OTHER),
  24908. 190: uint8(_BT_OTHER),
  24909. 191: uint8(_BT_OTHER),
  24910. 192: uint8(_BT_NMSTRT),
  24911. 193: uint8(_BT_NMSTRT),
  24912. 194: uint8(_BT_NMSTRT),
  24913. 195: uint8(_BT_NMSTRT),
  24914. 196: uint8(_BT_NMSTRT),
  24915. 197: uint8(_BT_NMSTRT),
  24916. 198: uint8(_BT_NMSTRT),
  24917. 199: uint8(_BT_NMSTRT),
  24918. 200: uint8(_BT_NMSTRT),
  24919. 201: uint8(_BT_NMSTRT),
  24920. 202: uint8(_BT_NMSTRT),
  24921. 203: uint8(_BT_NMSTRT),
  24922. 204: uint8(_BT_NMSTRT),
  24923. 205: uint8(_BT_NMSTRT),
  24924. 206: uint8(_BT_NMSTRT),
  24925. 207: uint8(_BT_NMSTRT),
  24926. 208: uint8(_BT_NMSTRT),
  24927. 209: uint8(_BT_NMSTRT),
  24928. 210: uint8(_BT_NMSTRT),
  24929. 211: uint8(_BT_NMSTRT),
  24930. 212: uint8(_BT_NMSTRT),
  24931. 213: uint8(_BT_NMSTRT),
  24932. 214: uint8(_BT_NMSTRT),
  24933. 215: uint8(_BT_OTHER),
  24934. 216: uint8(_BT_NMSTRT),
  24935. 217: uint8(_BT_NMSTRT),
  24936. 218: uint8(_BT_NMSTRT),
  24937. 219: uint8(_BT_NMSTRT),
  24938. 220: uint8(_BT_NMSTRT),
  24939. 221: uint8(_BT_NMSTRT),
  24940. 222: uint8(_BT_NMSTRT),
  24941. 223: uint8(_BT_NMSTRT),
  24942. 224: uint8(_BT_NMSTRT),
  24943. 225: uint8(_BT_NMSTRT),
  24944. 226: uint8(_BT_NMSTRT),
  24945. 227: uint8(_BT_NMSTRT),
  24946. 228: uint8(_BT_NMSTRT),
  24947. 229: uint8(_BT_NMSTRT),
  24948. 230: uint8(_BT_NMSTRT),
  24949. 231: uint8(_BT_NMSTRT),
  24950. 232: uint8(_BT_NMSTRT),
  24951. 233: uint8(_BT_NMSTRT),
  24952. 234: uint8(_BT_NMSTRT),
  24953. 235: uint8(_BT_NMSTRT),
  24954. 236: uint8(_BT_NMSTRT),
  24955. 237: uint8(_BT_NMSTRT),
  24956. 238: uint8(_BT_NMSTRT),
  24957. 239: uint8(_BT_NMSTRT),
  24958. 240: uint8(_BT_NMSTRT),
  24959. 241: uint8(_BT_NMSTRT),
  24960. 242: uint8(_BT_NMSTRT),
  24961. 243: uint8(_BT_NMSTRT),
  24962. 244: uint8(_BT_NMSTRT),
  24963. 245: uint8(_BT_NMSTRT),
  24964. 246: uint8(_BT_NMSTRT),
  24965. 247: uint8(_BT_OTHER),
  24966. 248: uint8(_BT_NMSTRT),
  24967. 249: uint8(_BT_NMSTRT),
  24968. 250: uint8(_BT_NMSTRT),
  24969. 251: uint8(_BT_NMSTRT),
  24970. 252: uint8(_BT_NMSTRT),
  24971. 253: uint8(_BT_NMSTRT),
  24972. 254: uint8(_BT_NMSTRT),
  24973. 255: uint8(_BT_NMSTRT),
  24974. },
  24975. }
  24976. func init() {
  24977. p := unsafe.Pointer(&_internal_little2_encoding_ns)
  24978. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  24979. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_contentTok)
  24980. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_cdataSectionTok)
  24981. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_ignoreSectionTok)
  24982. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_attributeValueTok)
  24983. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_entityValueTok)
  24984. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_nameMatchesAscii)
  24985. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_nameLength)
  24986. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_little2_skipS)
  24987. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_little2_getAtts)
  24988. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_little2_charRefNumber)
  24989. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_little2_predefinedEntityName)
  24990. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_little2_updatePosition)
  24991. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_little2_isPublicId)
  24992. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_little2_toUtf8)
  24993. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_little2_toUtf16)
  24994. }
  24995. var _internal_little2_encoding = Tnormal_encoding{
  24996. Fenc: TENCODING{
  24997. Fscanners: [4]TSCANNER{},
  24998. FliteralScanners: [2]TSCANNER{},
  24999. FminBytesPerChar: int32(2),
  25000. FisUtf16: int8(1),
  25001. },
  25002. Ftype1: [256]uint8{
  25003. 9: uint8(_BT_S),
  25004. 10: uint8(_BT_LF),
  25005. 13: uint8(_BT_S),
  25006. 32: uint8(_BT_S),
  25007. 33: uint8(_BT_EXCL),
  25008. 34: uint8(_BT_QUOT),
  25009. 35: uint8(_BT_NUM),
  25010. 36: uint8(_BT_OTHER),
  25011. 37: uint8(_BT_PERCNT),
  25012. 38: uint8(_BT_AMP),
  25013. 39: uint8(_BT_APOS),
  25014. 40: uint8(_BT_LPAR),
  25015. 41: uint8(_BT_RPAR),
  25016. 42: uint8(_BT_AST),
  25017. 43: uint8(_BT_PLUS),
  25018. 44: uint8(_BT_COMMA),
  25019. 45: uint8(_BT_MINUS),
  25020. 46: uint8(_BT_NAME),
  25021. 47: uint8(_BT_SOL),
  25022. 48: uint8(_BT_DIGIT),
  25023. 49: uint8(_BT_DIGIT),
  25024. 50: uint8(_BT_DIGIT),
  25025. 51: uint8(_BT_DIGIT),
  25026. 52: uint8(_BT_DIGIT),
  25027. 53: uint8(_BT_DIGIT),
  25028. 54: uint8(_BT_DIGIT),
  25029. 55: uint8(_BT_DIGIT),
  25030. 56: uint8(_BT_DIGIT),
  25031. 57: uint8(_BT_DIGIT),
  25032. 58: uint8(_BT_NMSTRT),
  25033. 59: uint8(_BT_SEMI),
  25034. 60: uint8(_BT_LT),
  25035. 61: uint8(_BT_EQUALS),
  25036. 62: uint8(_BT_GT),
  25037. 63: uint8(_BT_QUEST),
  25038. 64: uint8(_BT_OTHER),
  25039. 65: uint8(_BT_HEX),
  25040. 66: uint8(_BT_HEX),
  25041. 67: uint8(_BT_HEX),
  25042. 68: uint8(_BT_HEX),
  25043. 69: uint8(_BT_HEX),
  25044. 70: uint8(_BT_HEX),
  25045. 71: uint8(_BT_NMSTRT),
  25046. 72: uint8(_BT_NMSTRT),
  25047. 73: uint8(_BT_NMSTRT),
  25048. 74: uint8(_BT_NMSTRT),
  25049. 75: uint8(_BT_NMSTRT),
  25050. 76: uint8(_BT_NMSTRT),
  25051. 77: uint8(_BT_NMSTRT),
  25052. 78: uint8(_BT_NMSTRT),
  25053. 79: uint8(_BT_NMSTRT),
  25054. 80: uint8(_BT_NMSTRT),
  25055. 81: uint8(_BT_NMSTRT),
  25056. 82: uint8(_BT_NMSTRT),
  25057. 83: uint8(_BT_NMSTRT),
  25058. 84: uint8(_BT_NMSTRT),
  25059. 85: uint8(_BT_NMSTRT),
  25060. 86: uint8(_BT_NMSTRT),
  25061. 87: uint8(_BT_NMSTRT),
  25062. 88: uint8(_BT_NMSTRT),
  25063. 89: uint8(_BT_NMSTRT),
  25064. 90: uint8(_BT_NMSTRT),
  25065. 91: uint8(_BT_LSQB),
  25066. 92: uint8(_BT_OTHER),
  25067. 93: uint8(_BT_RSQB),
  25068. 94: uint8(_BT_OTHER),
  25069. 95: uint8(_BT_NMSTRT),
  25070. 96: uint8(_BT_OTHER),
  25071. 97: uint8(_BT_HEX),
  25072. 98: uint8(_BT_HEX),
  25073. 99: uint8(_BT_HEX),
  25074. 100: uint8(_BT_HEX),
  25075. 101: uint8(_BT_HEX),
  25076. 102: uint8(_BT_HEX),
  25077. 103: uint8(_BT_NMSTRT),
  25078. 104: uint8(_BT_NMSTRT),
  25079. 105: uint8(_BT_NMSTRT),
  25080. 106: uint8(_BT_NMSTRT),
  25081. 107: uint8(_BT_NMSTRT),
  25082. 108: uint8(_BT_NMSTRT),
  25083. 109: uint8(_BT_NMSTRT),
  25084. 110: uint8(_BT_NMSTRT),
  25085. 111: uint8(_BT_NMSTRT),
  25086. 112: uint8(_BT_NMSTRT),
  25087. 113: uint8(_BT_NMSTRT),
  25088. 114: uint8(_BT_NMSTRT),
  25089. 115: uint8(_BT_NMSTRT),
  25090. 116: uint8(_BT_NMSTRT),
  25091. 117: uint8(_BT_NMSTRT),
  25092. 118: uint8(_BT_NMSTRT),
  25093. 119: uint8(_BT_NMSTRT),
  25094. 120: uint8(_BT_NMSTRT),
  25095. 121: uint8(_BT_NMSTRT),
  25096. 122: uint8(_BT_NMSTRT),
  25097. 123: uint8(_BT_OTHER),
  25098. 124: uint8(_BT_VERBAR),
  25099. 125: uint8(_BT_OTHER),
  25100. 126: uint8(_BT_OTHER),
  25101. 127: uint8(_BT_OTHER),
  25102. 128: uint8(_BT_OTHER),
  25103. 129: uint8(_BT_OTHER),
  25104. 130: uint8(_BT_OTHER),
  25105. 131: uint8(_BT_OTHER),
  25106. 132: uint8(_BT_OTHER),
  25107. 133: uint8(_BT_OTHER),
  25108. 134: uint8(_BT_OTHER),
  25109. 135: uint8(_BT_OTHER),
  25110. 136: uint8(_BT_OTHER),
  25111. 137: uint8(_BT_OTHER),
  25112. 138: uint8(_BT_OTHER),
  25113. 139: uint8(_BT_OTHER),
  25114. 140: uint8(_BT_OTHER),
  25115. 141: uint8(_BT_OTHER),
  25116. 142: uint8(_BT_OTHER),
  25117. 143: uint8(_BT_OTHER),
  25118. 144: uint8(_BT_OTHER),
  25119. 145: uint8(_BT_OTHER),
  25120. 146: uint8(_BT_OTHER),
  25121. 147: uint8(_BT_OTHER),
  25122. 148: uint8(_BT_OTHER),
  25123. 149: uint8(_BT_OTHER),
  25124. 150: uint8(_BT_OTHER),
  25125. 151: uint8(_BT_OTHER),
  25126. 152: uint8(_BT_OTHER),
  25127. 153: uint8(_BT_OTHER),
  25128. 154: uint8(_BT_OTHER),
  25129. 155: uint8(_BT_OTHER),
  25130. 156: uint8(_BT_OTHER),
  25131. 157: uint8(_BT_OTHER),
  25132. 158: uint8(_BT_OTHER),
  25133. 159: uint8(_BT_OTHER),
  25134. 160: uint8(_BT_OTHER),
  25135. 161: uint8(_BT_OTHER),
  25136. 162: uint8(_BT_OTHER),
  25137. 163: uint8(_BT_OTHER),
  25138. 164: uint8(_BT_OTHER),
  25139. 165: uint8(_BT_OTHER),
  25140. 166: uint8(_BT_OTHER),
  25141. 167: uint8(_BT_OTHER),
  25142. 168: uint8(_BT_OTHER),
  25143. 169: uint8(_BT_OTHER),
  25144. 170: uint8(_BT_NMSTRT),
  25145. 171: uint8(_BT_OTHER),
  25146. 172: uint8(_BT_OTHER),
  25147. 173: uint8(_BT_OTHER),
  25148. 174: uint8(_BT_OTHER),
  25149. 175: uint8(_BT_OTHER),
  25150. 176: uint8(_BT_OTHER),
  25151. 177: uint8(_BT_OTHER),
  25152. 178: uint8(_BT_OTHER),
  25153. 179: uint8(_BT_OTHER),
  25154. 180: uint8(_BT_OTHER),
  25155. 181: uint8(_BT_NMSTRT),
  25156. 182: uint8(_BT_OTHER),
  25157. 183: uint8(_BT_NAME),
  25158. 184: uint8(_BT_OTHER),
  25159. 185: uint8(_BT_OTHER),
  25160. 186: uint8(_BT_NMSTRT),
  25161. 187: uint8(_BT_OTHER),
  25162. 188: uint8(_BT_OTHER),
  25163. 189: uint8(_BT_OTHER),
  25164. 190: uint8(_BT_OTHER),
  25165. 191: uint8(_BT_OTHER),
  25166. 192: uint8(_BT_NMSTRT),
  25167. 193: uint8(_BT_NMSTRT),
  25168. 194: uint8(_BT_NMSTRT),
  25169. 195: uint8(_BT_NMSTRT),
  25170. 196: uint8(_BT_NMSTRT),
  25171. 197: uint8(_BT_NMSTRT),
  25172. 198: uint8(_BT_NMSTRT),
  25173. 199: uint8(_BT_NMSTRT),
  25174. 200: uint8(_BT_NMSTRT),
  25175. 201: uint8(_BT_NMSTRT),
  25176. 202: uint8(_BT_NMSTRT),
  25177. 203: uint8(_BT_NMSTRT),
  25178. 204: uint8(_BT_NMSTRT),
  25179. 205: uint8(_BT_NMSTRT),
  25180. 206: uint8(_BT_NMSTRT),
  25181. 207: uint8(_BT_NMSTRT),
  25182. 208: uint8(_BT_NMSTRT),
  25183. 209: uint8(_BT_NMSTRT),
  25184. 210: uint8(_BT_NMSTRT),
  25185. 211: uint8(_BT_NMSTRT),
  25186. 212: uint8(_BT_NMSTRT),
  25187. 213: uint8(_BT_NMSTRT),
  25188. 214: uint8(_BT_NMSTRT),
  25189. 215: uint8(_BT_OTHER),
  25190. 216: uint8(_BT_NMSTRT),
  25191. 217: uint8(_BT_NMSTRT),
  25192. 218: uint8(_BT_NMSTRT),
  25193. 219: uint8(_BT_NMSTRT),
  25194. 220: uint8(_BT_NMSTRT),
  25195. 221: uint8(_BT_NMSTRT),
  25196. 222: uint8(_BT_NMSTRT),
  25197. 223: uint8(_BT_NMSTRT),
  25198. 224: uint8(_BT_NMSTRT),
  25199. 225: uint8(_BT_NMSTRT),
  25200. 226: uint8(_BT_NMSTRT),
  25201. 227: uint8(_BT_NMSTRT),
  25202. 228: uint8(_BT_NMSTRT),
  25203. 229: uint8(_BT_NMSTRT),
  25204. 230: uint8(_BT_NMSTRT),
  25205. 231: uint8(_BT_NMSTRT),
  25206. 232: uint8(_BT_NMSTRT),
  25207. 233: uint8(_BT_NMSTRT),
  25208. 234: uint8(_BT_NMSTRT),
  25209. 235: uint8(_BT_NMSTRT),
  25210. 236: uint8(_BT_NMSTRT),
  25211. 237: uint8(_BT_NMSTRT),
  25212. 238: uint8(_BT_NMSTRT),
  25213. 239: uint8(_BT_NMSTRT),
  25214. 240: uint8(_BT_NMSTRT),
  25215. 241: uint8(_BT_NMSTRT),
  25216. 242: uint8(_BT_NMSTRT),
  25217. 243: uint8(_BT_NMSTRT),
  25218. 244: uint8(_BT_NMSTRT),
  25219. 245: uint8(_BT_NMSTRT),
  25220. 246: uint8(_BT_NMSTRT),
  25221. 247: uint8(_BT_OTHER),
  25222. 248: uint8(_BT_NMSTRT),
  25223. 249: uint8(_BT_NMSTRT),
  25224. 250: uint8(_BT_NMSTRT),
  25225. 251: uint8(_BT_NMSTRT),
  25226. 252: uint8(_BT_NMSTRT),
  25227. 253: uint8(_BT_NMSTRT),
  25228. 254: uint8(_BT_NMSTRT),
  25229. 255: uint8(_BT_NMSTRT),
  25230. },
  25231. }
  25232. func init() {
  25233. p := unsafe.Pointer(&_internal_little2_encoding)
  25234. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  25235. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_contentTok)
  25236. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_cdataSectionTok)
  25237. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_ignoreSectionTok)
  25238. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_attributeValueTok)
  25239. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_entityValueTok)
  25240. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_nameMatchesAscii)
  25241. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_nameLength)
  25242. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_little2_skipS)
  25243. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_little2_getAtts)
  25244. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_little2_charRefNumber)
  25245. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_little2_predefinedEntityName)
  25246. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_little2_updatePosition)
  25247. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_little2_isPublicId)
  25248. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_little2_toUtf8)
  25249. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_little2_toUtf16)
  25250. }
  25251. /* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
  25252. /* This file is included (from xmltok.c, 1-3 times depending on XML_MIN_SIZE)!
  25253. __ __ _
  25254. ___\ \/ /_ __ __ _| |_
  25255. / _ \\ /| '_ \ / _` | __|
  25256. | __// \| |_) | (_| | |_
  25257. \___/_/\_\ .__/ \__,_|\__|
  25258. |_| XML parser
  25259. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  25260. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  25261. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  25262. Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
  25263. Copyright (c) 2016-2022 Sebastian Pipping <sebastian@pipping.org>
  25264. Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
  25265. Copyright (c) 2018 Benjamin Peterson <benjamin@python.org>
  25266. Copyright (c) 2018 Anton Maklakov <antmak.pub@gmail.com>
  25267. Copyright (c) 2019 David Loffredo <loffredo@steptools.com>
  25268. Copyright (c) 2020 Boris Kolpackov <boris@codesynthesis.com>
  25269. Copyright (c) 2022 Martin Ettl <ettl.martin78@googlemail.com>
  25270. Licensed under the MIT license:
  25271. Permission is hereby granted, free of charge, to any person obtaining
  25272. a copy of this software and associated documentation files (the
  25273. "Software"), to deal in the Software without restriction, including
  25274. without limitation the rights to use, copy, modify, merge, publish,
  25275. distribute, sublicense, and/or sell copies of the Software, and to permit
  25276. persons to whom the Software is furnished to do so, subject to the
  25277. following conditions:
  25278. The above copyright notice and this permission notice shall be included
  25279. in all copies or substantial portions of the Software.
  25280. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  25281. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25282. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  25283. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  25284. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  25285. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  25286. USE OR OTHER DEALINGS IN THE SOFTWARE.
  25287. */
  25288. /* ptr points to character following "<!-" */
  25289. func _big2_scanComment(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25290. var v1 int32
  25291. _ = v1
  25292. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25293. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_MINUS1)) {
  25294. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25295. return m_XML_TOK_INVALID
  25296. }
  25297. ptr += uintptr(2)
  25298. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25299. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25300. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25301. } else {
  25302. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25303. }
  25304. switch v1 {
  25305. case int32(_BT_LEAD2):
  25306. if int64(end)-int64(ptr) < int64(2) {
  25307. return -int32(2)
  25308. }
  25309. if 0 != 0 {
  25310. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25311. return m_XML_TOK_INVALID
  25312. }
  25313. ptr += uintptr(2)
  25314. case int32(_BT_LEAD3):
  25315. if int64(end)-int64(ptr) < int64(3) {
  25316. return -int32(2)
  25317. }
  25318. if 0 != 0 {
  25319. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25320. return m_XML_TOK_INVALID
  25321. }
  25322. ptr += uintptr(3)
  25323. case int32(_BT_LEAD4):
  25324. if int64(end)-int64(ptr) < int64(4) {
  25325. return -int32(2)
  25326. }
  25327. if 0 != 0 {
  25328. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25329. return m_XML_TOK_INVALID
  25330. }
  25331. ptr += uintptr(4)
  25332. case int32(_BT_NONXML):
  25333. fallthrough
  25334. case int32(_BT_MALFORM):
  25335. fallthrough
  25336. case int32(_BT_TRAIL):
  25337. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25338. return m_XML_TOK_INVALID
  25339. case int32(_BT_MINUS):
  25340. ptr += uintptr(2)
  25341. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25342. return -int32(1)
  25343. }
  25344. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_MINUS1) {
  25345. ptr += uintptr(2)
  25346. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25347. return -int32(1)
  25348. }
  25349. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  25350. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25351. return m_XML_TOK_INVALID
  25352. }
  25353. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25354. return int32(m_XML_TOK_COMMENT)
  25355. }
  25356. default:
  25357. ptr += uintptr(2)
  25358. break
  25359. }
  25360. }
  25361. }
  25362. return -int32(1)
  25363. }
  25364. /* ptr points to character following "<!" */
  25365. func _big2_scanDecl(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25366. var v1, v2, v3 int32
  25367. _, _, _ = v1, v2, v3
  25368. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25369. return -int32(1)
  25370. }
  25371. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25372. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25373. } else {
  25374. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25375. }
  25376. switch v1 {
  25377. case int32(_BT_MINUS):
  25378. return _big2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25379. case int32(_BT_LSQB):
  25380. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25381. return int32(m_XML_TOK_COND_SECT_OPEN)
  25382. case int32(_BT_NMSTRT):
  25383. fallthrough
  25384. case int32(_BT_HEX):
  25385. ptr += uintptr(2)
  25386. default:
  25387. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25388. return m_XML_TOK_INVALID
  25389. }
  25390. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25391. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25392. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25393. } else {
  25394. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25395. }
  25396. switch v2 {
  25397. case int32(_BT_PERCNT):
  25398. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  25399. return -int32(1)
  25400. }
  25401. /* don't allow <!ENTITY% foo "whatever"> */
  25402. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 {
  25403. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))))))
  25404. } else {
  25405. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))), *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))
  25406. }
  25407. switch v3 {
  25408. case int32(_BT_S):
  25409. fallthrough
  25410. case int32(_BT_CR):
  25411. fallthrough
  25412. case int32(_BT_LF):
  25413. fallthrough
  25414. case int32(_BT_PERCNT):
  25415. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25416. return m_XML_TOK_INVALID
  25417. }
  25418. /* fall through */
  25419. fallthrough
  25420. case int32(_BT_S):
  25421. fallthrough
  25422. case int32(_BT_CR):
  25423. fallthrough
  25424. case int32(_BT_LF):
  25425. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25426. return int32(m_XML_TOK_DECL_OPEN)
  25427. case int32(_BT_NMSTRT):
  25428. fallthrough
  25429. case int32(_BT_HEX):
  25430. ptr += uintptr(2)
  25431. default:
  25432. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25433. return m_XML_TOK_INVALID
  25434. }
  25435. }
  25436. return -int32(1)
  25437. }
  25438. func _big2_checkPiTarget(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, tokPtr uintptr) (r int32) {
  25439. var upper, v1, v2, v3 int32
  25440. _, _, _, _ = upper, v1, v2, v3
  25441. upper = 0
  25442. _ = enc
  25443. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_PI)
  25444. if int64(end)-int64(ptr) != int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(3)) {
  25445. return int32(1)
  25446. }
  25447. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25448. v1 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  25449. } else {
  25450. v1 = -int32(1)
  25451. }
  25452. switch v1 {
  25453. case int32(m_ASCII_x2):
  25454. case int32(m_ASCII_X):
  25455. upper = int32(1)
  25456. default:
  25457. return int32(1)
  25458. }
  25459. ptr += uintptr(2)
  25460. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25461. v2 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  25462. } else {
  25463. v2 = -int32(1)
  25464. }
  25465. switch v2 {
  25466. case int32(m_ASCII_m2):
  25467. case int32(m_ASCII_M):
  25468. upper = int32(1)
  25469. default:
  25470. return int32(1)
  25471. }
  25472. ptr += uintptr(2)
  25473. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25474. v3 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  25475. } else {
  25476. v3 = -int32(1)
  25477. }
  25478. switch v3 {
  25479. case int32(m_ASCII_l2):
  25480. case int32(m_ASCII_L):
  25481. upper = int32(1)
  25482. default:
  25483. return int32(1)
  25484. }
  25485. if upper != 0 {
  25486. return 0
  25487. }
  25488. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_XML_DECL)
  25489. return int32(1)
  25490. }
  25491. /* ptr points to character following "<?" */
  25492. func _big2_scanPi(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25493. bp := tls.Alloc(16)
  25494. defer tls.Free(16)
  25495. var target uintptr
  25496. var v1, v2, v3 int32
  25497. var _ /* tok at bp+0 */ int32
  25498. _, _, _, _ = target, v1, v2, v3
  25499. target = ptr
  25500. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25501. return -int32(1)
  25502. }
  25503. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25504. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25505. } else {
  25506. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25507. }
  25508. switch v1 {
  25509. case int32(_BT_NONASCII):
  25510. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  25511. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25512. return m_XML_TOK_INVALID
  25513. } /* fall through */
  25514. fallthrough
  25515. case int32(_BT_NMSTRT):
  25516. fallthrough
  25517. case int32(_BT_HEX):
  25518. ptr += uintptr(2)
  25519. case int32(_BT_LEAD2):
  25520. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  25521. return -int32(2)
  25522. }
  25523. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25524. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25525. return m_XML_TOK_INVALID
  25526. }
  25527. ptr += uintptr(2)
  25528. case int32(_BT_LEAD3):
  25529. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  25530. return -int32(2)
  25531. }
  25532. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25533. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25534. return m_XML_TOK_INVALID
  25535. }
  25536. ptr += uintptr(3)
  25537. case int32(_BT_LEAD4):
  25538. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  25539. return -int32(2)
  25540. }
  25541. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25542. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25543. return m_XML_TOK_INVALID
  25544. }
  25545. ptr += uintptr(4)
  25546. default:
  25547. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25548. return m_XML_TOK_INVALID
  25549. }
  25550. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25551. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25552. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25553. } else {
  25554. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25555. }
  25556. switch v2 {
  25557. case int32(_BT_NONASCII):
  25558. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  25559. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25560. return m_XML_TOK_INVALID
  25561. } /* fall through */
  25562. fallthrough
  25563. case int32(_BT_NMSTRT):
  25564. fallthrough
  25565. case int32(_BT_HEX):
  25566. fallthrough
  25567. case int32(_BT_DIGIT):
  25568. fallthrough
  25569. case int32(_BT_NAME):
  25570. fallthrough
  25571. case int32(_BT_MINUS):
  25572. ptr += uintptr(2)
  25573. case int32(_BT_LEAD2):
  25574. if int64(end)-int64(ptr) < int64(2) {
  25575. return -int32(2)
  25576. }
  25577. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25578. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25579. return m_XML_TOK_INVALID
  25580. }
  25581. ptr += uintptr(2)
  25582. case int32(_BT_LEAD3):
  25583. if int64(end)-int64(ptr) < int64(3) {
  25584. return -int32(2)
  25585. }
  25586. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25587. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25588. return m_XML_TOK_INVALID
  25589. }
  25590. ptr += uintptr(3)
  25591. case int32(_BT_LEAD4):
  25592. if int64(end)-int64(ptr) < int64(4) {
  25593. return -int32(2)
  25594. }
  25595. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25596. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25597. return m_XML_TOK_INVALID
  25598. }
  25599. ptr += uintptr(4)
  25600. case int32(_BT_S):
  25601. fallthrough
  25602. case int32(_BT_CR):
  25603. fallthrough
  25604. case int32(_BT_LF):
  25605. if !(_big2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  25606. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25607. return m_XML_TOK_INVALID
  25608. }
  25609. ptr += uintptr(2)
  25610. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25611. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25612. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25613. } else {
  25614. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25615. }
  25616. switch v3 {
  25617. case int32(_BT_LEAD2):
  25618. if int64(end)-int64(ptr) < int64(2) {
  25619. return -int32(2)
  25620. }
  25621. if 0 != 0 {
  25622. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25623. return m_XML_TOK_INVALID
  25624. }
  25625. ptr += uintptr(2)
  25626. case int32(_BT_LEAD3):
  25627. if int64(end)-int64(ptr) < int64(3) {
  25628. return -int32(2)
  25629. }
  25630. if 0 != 0 {
  25631. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25632. return m_XML_TOK_INVALID
  25633. }
  25634. ptr += uintptr(3)
  25635. case int32(_BT_LEAD4):
  25636. if int64(end)-int64(ptr) < int64(4) {
  25637. return -int32(2)
  25638. }
  25639. if 0 != 0 {
  25640. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25641. return m_XML_TOK_INVALID
  25642. }
  25643. ptr += uintptr(4)
  25644. case int32(_BT_NONXML):
  25645. fallthrough
  25646. case int32(_BT_MALFORM):
  25647. fallthrough
  25648. case int32(_BT_TRAIL):
  25649. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25650. return m_XML_TOK_INVALID
  25651. case int32(_BT_QUEST):
  25652. ptr += uintptr(2)
  25653. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25654. return -int32(1)
  25655. }
  25656. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1) {
  25657. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25658. return *(*int32)(unsafe.Pointer(bp))
  25659. }
  25660. default:
  25661. ptr += uintptr(2)
  25662. break
  25663. }
  25664. }
  25665. return -int32(1)
  25666. case int32(_BT_QUEST):
  25667. if !(_big2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  25668. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25669. return m_XML_TOK_INVALID
  25670. }
  25671. ptr += uintptr(2)
  25672. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25673. return -int32(1)
  25674. }
  25675. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1) {
  25676. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25677. return *(*int32)(unsafe.Pointer(bp))
  25678. }
  25679. /* fall through */
  25680. fallthrough
  25681. default:
  25682. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25683. return m_XML_TOK_INVALID
  25684. }
  25685. }
  25686. return -int32(1)
  25687. }
  25688. func _big2_scanCdataSection(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25689. var i int32
  25690. _ = i
  25691. _ = enc
  25692. /* CDATA[ */
  25693. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(6)*libc.Int32FromInt32(2))) {
  25694. return -int32(1)
  25695. }
  25696. i = 0
  25697. for {
  25698. if !(i < int32(6)) {
  25699. break
  25700. }
  25701. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(_CDATA_LSQB2[i])) {
  25702. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25703. return m_XML_TOK_INVALID
  25704. }
  25705. goto _1
  25706. _1:
  25707. ;
  25708. i++
  25709. ptr += uintptr(2)
  25710. }
  25711. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25712. return int32(m_XML_TOK_CDATA_SECT_OPEN)
  25713. }
  25714. var _CDATA_LSQB2 = [6]int8{
  25715. 0: int8(m_ASCII_C),
  25716. 1: int8(m_ASCII_D),
  25717. 2: int8(m_ASCII_A),
  25718. 3: int8(m_ASCII_T),
  25719. 4: int8(m_ASCII_A),
  25720. 5: int8(m_ASCII_LSQB1),
  25721. }
  25722. func _big2_cdataSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25723. var n Tsize_t
  25724. var v1, v2, v3 int32
  25725. _, _, _, _ = n, v1, v2, v3
  25726. if ptr >= end {
  25727. return -int32(4)
  25728. }
  25729. if int32(2) > int32(1) {
  25730. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  25731. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  25732. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  25733. if n == uint64(0) {
  25734. return -int32(1)
  25735. }
  25736. end = ptr + uintptr(n)
  25737. }
  25738. }
  25739. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25740. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25741. } else {
  25742. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25743. }
  25744. switch v1 {
  25745. case int32(_BT_RSQB):
  25746. ptr += uintptr(2)
  25747. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25748. return -int32(1)
  25749. }
  25750. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1)) {
  25751. break
  25752. }
  25753. ptr += uintptr(2)
  25754. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25755. return -int32(1)
  25756. }
  25757. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  25758. ptr -= uintptr(2)
  25759. break
  25760. }
  25761. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25762. return int32(m_XML_TOK_CDATA_SECT_CLOSE)
  25763. case int32(_BT_CR):
  25764. ptr += uintptr(2)
  25765. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25766. return -int32(1)
  25767. }
  25768. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25769. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25770. } else {
  25771. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25772. }
  25773. if v2 == int32(_BT_LF) {
  25774. ptr += uintptr(2)
  25775. }
  25776. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25777. return int32(m_XML_TOK_DATA_NEWLINE)
  25778. case int32(_BT_LF):
  25779. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25780. return int32(m_XML_TOK_DATA_NEWLINE)
  25781. case int32(_BT_LEAD2):
  25782. if int64(end)-int64(ptr) < int64(2) {
  25783. return -int32(2)
  25784. }
  25785. if 0 != 0 {
  25786. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25787. return m_XML_TOK_INVALID
  25788. }
  25789. ptr += uintptr(2)
  25790. case int32(_BT_LEAD3):
  25791. if int64(end)-int64(ptr) < int64(3) {
  25792. return -int32(2)
  25793. }
  25794. if 0 != 0 {
  25795. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25796. return m_XML_TOK_INVALID
  25797. }
  25798. ptr += uintptr(3)
  25799. case int32(_BT_LEAD4):
  25800. if int64(end)-int64(ptr) < int64(4) {
  25801. return -int32(2)
  25802. }
  25803. if 0 != 0 {
  25804. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25805. return m_XML_TOK_INVALID
  25806. }
  25807. ptr += uintptr(4)
  25808. case int32(_BT_NONXML):
  25809. fallthrough
  25810. case int32(_BT_MALFORM):
  25811. fallthrough
  25812. case int32(_BT_TRAIL):
  25813. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25814. return m_XML_TOK_INVALID
  25815. default:
  25816. ptr += uintptr(2)
  25817. break
  25818. }
  25819. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25820. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25821. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25822. } else {
  25823. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25824. }
  25825. switch v3 {
  25826. case int32(_BT_LEAD2):
  25827. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  25828. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25829. return int32(m_XML_TOK_DATA_CHARS)
  25830. }
  25831. ptr += uintptr(2)
  25832. case int32(_BT_LEAD3):
  25833. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  25834. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25835. return int32(m_XML_TOK_DATA_CHARS)
  25836. }
  25837. ptr += uintptr(3)
  25838. case int32(_BT_LEAD4):
  25839. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  25840. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25841. return int32(m_XML_TOK_DATA_CHARS)
  25842. }
  25843. ptr += uintptr(4)
  25844. case int32(_BT_NONXML):
  25845. fallthrough
  25846. case int32(_BT_MALFORM):
  25847. fallthrough
  25848. case int32(_BT_TRAIL):
  25849. fallthrough
  25850. case int32(_BT_CR):
  25851. fallthrough
  25852. case int32(_BT_LF):
  25853. fallthrough
  25854. case int32(_BT_RSQB):
  25855. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25856. return int32(m_XML_TOK_DATA_CHARS)
  25857. default:
  25858. ptr += uintptr(2)
  25859. break
  25860. }
  25861. }
  25862. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25863. return int32(m_XML_TOK_DATA_CHARS)
  25864. }
  25865. /* ptr points to character following "</" */
  25866. func _big2_scanEndTag(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25867. var v1, v2, v22 int32
  25868. _, _, _ = v1, v2, v22
  25869. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25870. return -int32(1)
  25871. }
  25872. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25873. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25874. } else {
  25875. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25876. }
  25877. switch v1 {
  25878. case int32(_BT_NONASCII):
  25879. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  25880. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25881. return m_XML_TOK_INVALID
  25882. } /* fall through */
  25883. fallthrough
  25884. case int32(_BT_NMSTRT):
  25885. fallthrough
  25886. case int32(_BT_HEX):
  25887. ptr += uintptr(2)
  25888. case int32(_BT_LEAD2):
  25889. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  25890. return -int32(2)
  25891. }
  25892. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25893. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25894. return m_XML_TOK_INVALID
  25895. }
  25896. ptr += uintptr(2)
  25897. case int32(_BT_LEAD3):
  25898. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  25899. return -int32(2)
  25900. }
  25901. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25902. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25903. return m_XML_TOK_INVALID
  25904. }
  25905. ptr += uintptr(3)
  25906. case int32(_BT_LEAD4):
  25907. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  25908. return -int32(2)
  25909. }
  25910. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25911. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25912. return m_XML_TOK_INVALID
  25913. }
  25914. ptr += uintptr(4)
  25915. default:
  25916. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25917. return m_XML_TOK_INVALID
  25918. }
  25919. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25920. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25921. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25922. } else {
  25923. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25924. }
  25925. switch v2 {
  25926. case int32(_BT_NONASCII):
  25927. goto _3
  25928. case int32(_BT_MINUS):
  25929. goto _4
  25930. case int32(_BT_NAME):
  25931. goto _5
  25932. case int32(_BT_DIGIT):
  25933. goto _6
  25934. case int32(_BT_HEX):
  25935. goto _7
  25936. case int32(_BT_NMSTRT):
  25937. goto _8
  25938. case int32(_BT_LEAD2):
  25939. goto _9
  25940. case int32(_BT_LEAD3):
  25941. goto _10
  25942. case int32(_BT_LEAD4):
  25943. goto _11
  25944. case int32(_BT_LF):
  25945. goto _12
  25946. case int32(_BT_CR):
  25947. goto _13
  25948. case int32(_BT_S):
  25949. goto _14
  25950. case int32(_BT_COLON):
  25951. goto _15
  25952. case int32(_BT_GT):
  25953. goto _16
  25954. default:
  25955. goto _17
  25956. }
  25957. goto _18
  25958. _3:
  25959. ;
  25960. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  25961. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25962. return m_XML_TOK_INVALID
  25963. } /* fall through */
  25964. _8:
  25965. ;
  25966. _7:
  25967. ;
  25968. _6:
  25969. ;
  25970. _5:
  25971. ;
  25972. _4:
  25973. ;
  25974. ptr += uintptr(2)
  25975. goto _18
  25976. _9:
  25977. ;
  25978. if int64(end)-int64(ptr) < int64(2) {
  25979. return -int32(2)
  25980. }
  25981. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25982. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25983. return m_XML_TOK_INVALID
  25984. }
  25985. ptr += uintptr(2)
  25986. goto _18
  25987. _10:
  25988. ;
  25989. if int64(end)-int64(ptr) < int64(3) {
  25990. return -int32(2)
  25991. }
  25992. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25993. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25994. return m_XML_TOK_INVALID
  25995. }
  25996. ptr += uintptr(3)
  25997. goto _18
  25998. _11:
  25999. ;
  26000. if int64(end)-int64(ptr) < int64(4) {
  26001. return -int32(2)
  26002. }
  26003. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26004. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26005. return m_XML_TOK_INVALID
  26006. }
  26007. ptr += uintptr(4)
  26008. goto _18
  26009. _14:
  26010. ;
  26011. _13:
  26012. ;
  26013. _12:
  26014. ;
  26015. ptr += uintptr(2)
  26016. _21:
  26017. ;
  26018. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26019. goto _19
  26020. }
  26021. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26022. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26023. } else {
  26024. v22 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26025. }
  26026. switch v22 {
  26027. case int32(_BT_S):
  26028. fallthrough
  26029. case int32(_BT_CR):
  26030. fallthrough
  26031. case int32(_BT_LF):
  26032. case int32(_BT_GT):
  26033. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26034. return int32(m_XML_TOK_END_TAG)
  26035. default:
  26036. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26037. return m_XML_TOK_INVALID
  26038. }
  26039. goto _20
  26040. _20:
  26041. ;
  26042. ptr += uintptr(2)
  26043. goto _21
  26044. goto _19
  26045. _19:
  26046. ;
  26047. return -int32(1)
  26048. _15:
  26049. ;
  26050. /* no need to check qname syntax here,
  26051. since end-tag must match exactly */
  26052. ptr += uintptr(2)
  26053. goto _18
  26054. _16:
  26055. ;
  26056. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26057. return int32(m_XML_TOK_END_TAG)
  26058. _17:
  26059. ;
  26060. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26061. return m_XML_TOK_INVALID
  26062. _18:
  26063. }
  26064. return -int32(1)
  26065. }
  26066. /* ptr points to character following "&#X" */
  26067. func _big2_scanHexCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  26068. var v1, v3 int32
  26069. _, _ = v1, v3
  26070. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26071. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26072. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26073. } else {
  26074. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26075. }
  26076. switch v1 {
  26077. case int32(_BT_DIGIT):
  26078. fallthrough
  26079. case int32(_BT_HEX):
  26080. default:
  26081. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26082. return m_XML_TOK_INVALID
  26083. }
  26084. ptr += uintptr(2)
  26085. for {
  26086. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26087. break
  26088. }
  26089. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26090. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26091. } else {
  26092. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26093. }
  26094. switch v3 {
  26095. case int32(_BT_DIGIT):
  26096. fallthrough
  26097. case int32(_BT_HEX):
  26098. case int32(_BT_SEMI):
  26099. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26100. return int32(m_XML_TOK_CHAR_REF)
  26101. default:
  26102. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26103. return m_XML_TOK_INVALID
  26104. }
  26105. goto _2
  26106. _2:
  26107. ;
  26108. ptr += uintptr(2)
  26109. }
  26110. }
  26111. return -int32(1)
  26112. }
  26113. /* ptr points to character following "&#" */
  26114. func _big2_scanCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  26115. var v1, v3 int32
  26116. _, _ = v1, v3
  26117. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26118. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_x2) {
  26119. return _big2_scanHexCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  26120. }
  26121. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26122. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26123. } else {
  26124. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26125. }
  26126. switch v1 {
  26127. case int32(_BT_DIGIT):
  26128. default:
  26129. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26130. return m_XML_TOK_INVALID
  26131. }
  26132. ptr += uintptr(2)
  26133. for {
  26134. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26135. break
  26136. }
  26137. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26138. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26139. } else {
  26140. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26141. }
  26142. switch v3 {
  26143. case int32(_BT_DIGIT):
  26144. case int32(_BT_SEMI):
  26145. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26146. return int32(m_XML_TOK_CHAR_REF)
  26147. default:
  26148. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26149. return m_XML_TOK_INVALID
  26150. }
  26151. goto _2
  26152. _2:
  26153. ;
  26154. ptr += uintptr(2)
  26155. }
  26156. }
  26157. return -int32(1)
  26158. }
  26159. /* ptr points to character following "&" */
  26160. func _big2_scanRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  26161. var v1, v2 int32
  26162. _, _ = v1, v2
  26163. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26164. return -int32(1)
  26165. }
  26166. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26167. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26168. } else {
  26169. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26170. }
  26171. switch v1 {
  26172. case int32(_BT_NONASCII):
  26173. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  26174. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26175. return m_XML_TOK_INVALID
  26176. } /* fall through */
  26177. fallthrough
  26178. case int32(_BT_NMSTRT):
  26179. fallthrough
  26180. case int32(_BT_HEX):
  26181. ptr += uintptr(2)
  26182. case int32(_BT_LEAD2):
  26183. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  26184. return -int32(2)
  26185. }
  26186. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26187. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26188. return m_XML_TOK_INVALID
  26189. }
  26190. ptr += uintptr(2)
  26191. case int32(_BT_LEAD3):
  26192. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  26193. return -int32(2)
  26194. }
  26195. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26196. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26197. return m_XML_TOK_INVALID
  26198. }
  26199. ptr += uintptr(3)
  26200. case int32(_BT_LEAD4):
  26201. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  26202. return -int32(2)
  26203. }
  26204. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26205. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26206. return m_XML_TOK_INVALID
  26207. }
  26208. ptr += uintptr(4)
  26209. case int32(_BT_NUM):
  26210. return _big2_scanCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  26211. default:
  26212. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26213. return m_XML_TOK_INVALID
  26214. }
  26215. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26216. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26217. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26218. } else {
  26219. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26220. }
  26221. switch v2 {
  26222. case int32(_BT_NONASCII):
  26223. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  26224. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26225. return m_XML_TOK_INVALID
  26226. } /* fall through */
  26227. fallthrough
  26228. case int32(_BT_NMSTRT):
  26229. fallthrough
  26230. case int32(_BT_HEX):
  26231. fallthrough
  26232. case int32(_BT_DIGIT):
  26233. fallthrough
  26234. case int32(_BT_NAME):
  26235. fallthrough
  26236. case int32(_BT_MINUS):
  26237. ptr += uintptr(2)
  26238. case int32(_BT_LEAD2):
  26239. if int64(end)-int64(ptr) < int64(2) {
  26240. return -int32(2)
  26241. }
  26242. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26243. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26244. return m_XML_TOK_INVALID
  26245. }
  26246. ptr += uintptr(2)
  26247. case int32(_BT_LEAD3):
  26248. if int64(end)-int64(ptr) < int64(3) {
  26249. return -int32(2)
  26250. }
  26251. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26252. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26253. return m_XML_TOK_INVALID
  26254. }
  26255. ptr += uintptr(3)
  26256. case int32(_BT_LEAD4):
  26257. if int64(end)-int64(ptr) < int64(4) {
  26258. return -int32(2)
  26259. }
  26260. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26261. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26262. return m_XML_TOK_INVALID
  26263. }
  26264. ptr += uintptr(4)
  26265. case int32(_BT_SEMI):
  26266. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26267. return int32(m_XML_TOK_ENTITY_REF)
  26268. default:
  26269. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26270. return m_XML_TOK_INVALID
  26271. }
  26272. }
  26273. return -int32(1)
  26274. }
  26275. /* ptr points to character following first character of attribute name */
  26276. func _big2_scanAtts(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  26277. bp := tls.Alloc(16)
  26278. defer tls.Free(16)
  26279. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  26280. var hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31 int32
  26281. _, _, _, _, _, _, _, _, _, _, _, _ = hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31
  26282. hadColon = 0
  26283. for int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26284. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  26285. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  26286. } else {
  26287. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  26288. }
  26289. switch v1 {
  26290. case int32(_BT_NONASCII):
  26291. goto _2
  26292. case int32(_BT_MINUS):
  26293. goto _3
  26294. case int32(_BT_NAME):
  26295. goto _4
  26296. case int32(_BT_DIGIT):
  26297. goto _5
  26298. case int32(_BT_HEX):
  26299. goto _6
  26300. case int32(_BT_NMSTRT):
  26301. goto _7
  26302. case int32(_BT_LEAD2):
  26303. goto _8
  26304. case int32(_BT_LEAD3):
  26305. goto _9
  26306. case int32(_BT_LEAD4):
  26307. goto _10
  26308. case int32(_BT_COLON):
  26309. goto _11
  26310. case int32(_BT_LF):
  26311. goto _12
  26312. case int32(_BT_CR):
  26313. goto _13
  26314. case int32(_BT_S):
  26315. goto _14
  26316. case int32(_BT_EQUALS):
  26317. goto _15
  26318. default:
  26319. goto _16
  26320. }
  26321. goto _17
  26322. _2:
  26323. ;
  26324. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  26325. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  26326. return m_XML_TOK_INVALID
  26327. } /* fall through */
  26328. _7:
  26329. ;
  26330. _6:
  26331. ;
  26332. _5:
  26333. ;
  26334. _4:
  26335. ;
  26336. _3:
  26337. ;
  26338. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  26339. goto _17
  26340. _8:
  26341. ;
  26342. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  26343. return -int32(2)
  26344. }
  26345. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26346. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  26347. return m_XML_TOK_INVALID
  26348. }
  26349. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  26350. goto _17
  26351. _9:
  26352. ;
  26353. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  26354. return -int32(2)
  26355. }
  26356. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26357. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  26358. return m_XML_TOK_INVALID
  26359. }
  26360. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  26361. goto _17
  26362. _10:
  26363. ;
  26364. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  26365. return -int32(2)
  26366. }
  26367. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26368. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  26369. return m_XML_TOK_INVALID
  26370. }
  26371. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  26372. goto _17
  26373. _11:
  26374. ;
  26375. if hadColon != 0 {
  26376. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  26377. return m_XML_TOK_INVALID
  26378. }
  26379. hadColon = int32(1)
  26380. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  26381. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26382. return -int32(1)
  26383. }
  26384. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  26385. v18 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  26386. } else {
  26387. v18 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  26388. }
  26389. switch v18 {
  26390. case int32(_BT_NONASCII):
  26391. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  26392. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  26393. return m_XML_TOK_INVALID
  26394. } /* fall through */
  26395. fallthrough
  26396. case int32(_BT_NMSTRT):
  26397. fallthrough
  26398. case int32(_BT_HEX):
  26399. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  26400. case int32(_BT_LEAD2):
  26401. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  26402. return -int32(2)
  26403. }
  26404. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26405. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  26406. return m_XML_TOK_INVALID
  26407. }
  26408. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  26409. case int32(_BT_LEAD3):
  26410. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  26411. return -int32(2)
  26412. }
  26413. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26414. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  26415. return m_XML_TOK_INVALID
  26416. }
  26417. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  26418. case int32(_BT_LEAD4):
  26419. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  26420. return -int32(2)
  26421. }
  26422. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26423. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  26424. return m_XML_TOK_INVALID
  26425. }
  26426. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  26427. default:
  26428. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  26429. return m_XML_TOK_INVALID
  26430. }
  26431. goto _17
  26432. _14:
  26433. ;
  26434. _13:
  26435. ;
  26436. _12:
  26437. ;
  26438. _21:
  26439. ;
  26440. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  26441. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26442. return -int32(1)
  26443. }
  26444. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  26445. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  26446. } else {
  26447. v22 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  26448. }
  26449. t = v22
  26450. if t == int32(_BT_EQUALS) {
  26451. goto _19
  26452. }
  26453. switch t {
  26454. case int32(_BT_S):
  26455. fallthrough
  26456. case int32(_BT_LF):
  26457. fallthrough
  26458. case int32(_BT_CR):
  26459. default:
  26460. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  26461. return m_XML_TOK_INVALID
  26462. }
  26463. goto _20
  26464. _20:
  26465. ;
  26466. goto _21
  26467. goto _19
  26468. _19:
  26469. ;
  26470. /* fall through */
  26471. _15:
  26472. ;
  26473. hadColon = 0
  26474. for {
  26475. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  26476. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26477. return -int32(1)
  26478. }
  26479. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  26480. v24 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  26481. } else {
  26482. v24 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  26483. }
  26484. open = v24
  26485. if open == int32(_BT_QUOT) || open == int32(_BT_APOS) {
  26486. break
  26487. }
  26488. switch open {
  26489. case int32(_BT_S):
  26490. fallthrough
  26491. case int32(_BT_LF):
  26492. fallthrough
  26493. case int32(_BT_CR):
  26494. default:
  26495. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  26496. return m_XML_TOK_INVALID
  26497. }
  26498. goto _23
  26499. _23:
  26500. }
  26501. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  26502. /* in attribute value */
  26503. for {
  26504. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26505. return -int32(1)
  26506. }
  26507. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  26508. v26 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  26509. } else {
  26510. v26 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  26511. }
  26512. t1 = v26
  26513. if t1 == open {
  26514. break
  26515. }
  26516. switch t1 {
  26517. case int32(_BT_LEAD2):
  26518. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  26519. return -int32(2)
  26520. }
  26521. if 0 != 0 {
  26522. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  26523. return m_XML_TOK_INVALID
  26524. }
  26525. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  26526. case int32(_BT_LEAD3):
  26527. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  26528. return -int32(2)
  26529. }
  26530. if 0 != 0 {
  26531. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  26532. return m_XML_TOK_INVALID
  26533. }
  26534. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  26535. case int32(_BT_LEAD4):
  26536. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  26537. return -int32(2)
  26538. }
  26539. if 0 != 0 {
  26540. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  26541. return m_XML_TOK_INVALID
  26542. }
  26543. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  26544. case int32(_BT_NONXML):
  26545. fallthrough
  26546. case int32(_BT_MALFORM):
  26547. fallthrough
  26548. case int32(_BT_TRAIL):
  26549. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  26550. return m_XML_TOK_INVALID
  26551. case int32(_BT_AMP):
  26552. tok = _big2_scanRef(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr(2), end, bp)
  26553. if tok <= 0 {
  26554. if tok == m_XML_TOK_INVALID {
  26555. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  26556. }
  26557. return tok
  26558. }
  26559. case int32(_BT_LT):
  26560. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  26561. return m_XML_TOK_INVALID
  26562. default:
  26563. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  26564. break
  26565. }
  26566. goto _25
  26567. _25:
  26568. }
  26569. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  26570. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26571. return -int32(1)
  26572. }
  26573. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  26574. v27 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  26575. } else {
  26576. v27 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  26577. }
  26578. switch v27 {
  26579. case int32(_BT_S):
  26580. fallthrough
  26581. case int32(_BT_CR):
  26582. fallthrough
  26583. case int32(_BT_LF):
  26584. case int32(_BT_SOL):
  26585. goto sol
  26586. case int32(_BT_GT):
  26587. goto gt
  26588. default:
  26589. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  26590. return m_XML_TOK_INVALID
  26591. }
  26592. /* ptr points to closing quote */
  26593. _30:
  26594. ;
  26595. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  26596. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26597. return -int32(1)
  26598. }
  26599. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  26600. v31 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  26601. } else {
  26602. v31 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  26603. }
  26604. switch v31 {
  26605. case int32(_BT_NONASCII):
  26606. goto _32
  26607. case int32(_BT_HEX):
  26608. goto _33
  26609. case int32(_BT_NMSTRT):
  26610. goto _34
  26611. case int32(_BT_LEAD2):
  26612. goto _35
  26613. case int32(_BT_LEAD3):
  26614. goto _36
  26615. case int32(_BT_LEAD4):
  26616. goto _37
  26617. case int32(_BT_LF):
  26618. goto _38
  26619. case int32(_BT_CR):
  26620. goto _39
  26621. case int32(_BT_S):
  26622. goto _40
  26623. case int32(_BT_GT):
  26624. goto _41
  26625. case int32(_BT_SOL):
  26626. goto _42
  26627. default:
  26628. goto _43
  26629. }
  26630. goto _44
  26631. _32:
  26632. ;
  26633. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  26634. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  26635. return m_XML_TOK_INVALID
  26636. } /* fall through */
  26637. _34:
  26638. ;
  26639. _33:
  26640. ;
  26641. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  26642. goto _44
  26643. _35:
  26644. ;
  26645. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  26646. return -int32(2)
  26647. }
  26648. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26649. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  26650. return m_XML_TOK_INVALID
  26651. }
  26652. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  26653. goto _44
  26654. _36:
  26655. ;
  26656. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  26657. return -int32(2)
  26658. }
  26659. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26660. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  26661. return m_XML_TOK_INVALID
  26662. }
  26663. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  26664. goto _44
  26665. _37:
  26666. ;
  26667. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  26668. return -int32(2)
  26669. }
  26670. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26671. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  26672. return m_XML_TOK_INVALID
  26673. }
  26674. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  26675. goto _44
  26676. _40:
  26677. ;
  26678. _39:
  26679. ;
  26680. _38:
  26681. ;
  26682. goto _29
  26683. _41:
  26684. ;
  26685. goto gt
  26686. gt:
  26687. ;
  26688. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  26689. return int32(m_XML_TOK_START_TAG_WITH_ATTS)
  26690. _42:
  26691. ;
  26692. goto sol
  26693. sol:
  26694. ;
  26695. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  26696. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26697. return -int32(1)
  26698. }
  26699. if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 && int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == int32(m_ASCII_GT1)) {
  26700. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  26701. return m_XML_TOK_INVALID
  26702. }
  26703. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  26704. return int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS)
  26705. _43:
  26706. ;
  26707. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  26708. return m_XML_TOK_INVALID
  26709. _44:
  26710. ;
  26711. goto _28
  26712. goto _29
  26713. _29:
  26714. ;
  26715. goto _30
  26716. goto _28
  26717. _28:
  26718. ;
  26719. goto _17
  26720. _16:
  26721. ;
  26722. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  26723. return m_XML_TOK_INVALID
  26724. _17:
  26725. }
  26726. return -int32(1)
  26727. }
  26728. /* ptr points to character following "<" */
  26729. func _big2_scanLt(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  26730. var hadColon, v1, v2, v21, v22, v3 int32
  26731. _, _, _, _, _, _ = hadColon, v1, v2, v21, v22, v3
  26732. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26733. return -int32(1)
  26734. }
  26735. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26736. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26737. } else {
  26738. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26739. }
  26740. switch v1 {
  26741. case int32(_BT_NONASCII):
  26742. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  26743. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26744. return m_XML_TOK_INVALID
  26745. } /* fall through */
  26746. fallthrough
  26747. case int32(_BT_NMSTRT):
  26748. fallthrough
  26749. case int32(_BT_HEX):
  26750. ptr += uintptr(2)
  26751. case int32(_BT_LEAD2):
  26752. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  26753. return -int32(2)
  26754. }
  26755. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26756. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26757. return m_XML_TOK_INVALID
  26758. }
  26759. ptr += uintptr(2)
  26760. case int32(_BT_LEAD3):
  26761. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  26762. return -int32(2)
  26763. }
  26764. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26765. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26766. return m_XML_TOK_INVALID
  26767. }
  26768. ptr += uintptr(3)
  26769. case int32(_BT_LEAD4):
  26770. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  26771. return -int32(2)
  26772. }
  26773. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26774. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26775. return m_XML_TOK_INVALID
  26776. }
  26777. ptr += uintptr(4)
  26778. case int32(_BT_EXCL):
  26779. ptr += uintptr(2)
  26780. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26781. return -int32(1)
  26782. }
  26783. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26784. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26785. } else {
  26786. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26787. }
  26788. switch v2 {
  26789. case int32(_BT_MINUS):
  26790. return _big2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  26791. case int32(_BT_LSQB):
  26792. return _big2_scanCdataSection(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  26793. }
  26794. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26795. return m_XML_TOK_INVALID
  26796. case int32(_BT_QUEST):
  26797. return _big2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  26798. case int32(_BT_SOL):
  26799. return _big2_scanEndTag(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  26800. default:
  26801. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26802. return m_XML_TOK_INVALID
  26803. }
  26804. hadColon = 0
  26805. /* we have a start-tag */
  26806. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26807. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26808. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26809. } else {
  26810. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26811. }
  26812. switch v3 {
  26813. case int32(_BT_NONASCII):
  26814. goto _4
  26815. case int32(_BT_MINUS):
  26816. goto _5
  26817. case int32(_BT_NAME):
  26818. goto _6
  26819. case int32(_BT_DIGIT):
  26820. goto _7
  26821. case int32(_BT_HEX):
  26822. goto _8
  26823. case int32(_BT_NMSTRT):
  26824. goto _9
  26825. case int32(_BT_LEAD2):
  26826. goto _10
  26827. case int32(_BT_LEAD3):
  26828. goto _11
  26829. case int32(_BT_LEAD4):
  26830. goto _12
  26831. case int32(_BT_COLON):
  26832. goto _13
  26833. case int32(_BT_LF):
  26834. goto _14
  26835. case int32(_BT_CR):
  26836. goto _15
  26837. case int32(_BT_S):
  26838. goto _16
  26839. case int32(_BT_GT):
  26840. goto _17
  26841. case int32(_BT_SOL):
  26842. goto _18
  26843. default:
  26844. goto _19
  26845. }
  26846. goto _20
  26847. _4:
  26848. ;
  26849. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  26850. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26851. return m_XML_TOK_INVALID
  26852. } /* fall through */
  26853. _9:
  26854. ;
  26855. _8:
  26856. ;
  26857. _7:
  26858. ;
  26859. _6:
  26860. ;
  26861. _5:
  26862. ;
  26863. ptr += uintptr(2)
  26864. goto _20
  26865. _10:
  26866. ;
  26867. if int64(end)-int64(ptr) < int64(2) {
  26868. return -int32(2)
  26869. }
  26870. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26871. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26872. return m_XML_TOK_INVALID
  26873. }
  26874. ptr += uintptr(2)
  26875. goto _20
  26876. _11:
  26877. ;
  26878. if int64(end)-int64(ptr) < int64(3) {
  26879. return -int32(2)
  26880. }
  26881. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26882. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26883. return m_XML_TOK_INVALID
  26884. }
  26885. ptr += uintptr(3)
  26886. goto _20
  26887. _12:
  26888. ;
  26889. if int64(end)-int64(ptr) < int64(4) {
  26890. return -int32(2)
  26891. }
  26892. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26893. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26894. return m_XML_TOK_INVALID
  26895. }
  26896. ptr += uintptr(4)
  26897. goto _20
  26898. _13:
  26899. ;
  26900. if hadColon != 0 {
  26901. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26902. return m_XML_TOK_INVALID
  26903. }
  26904. hadColon = int32(1)
  26905. ptr += uintptr(2)
  26906. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26907. return -int32(1)
  26908. }
  26909. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26910. v21 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26911. } else {
  26912. v21 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26913. }
  26914. switch v21 {
  26915. case int32(_BT_NONASCII):
  26916. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  26917. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26918. return m_XML_TOK_INVALID
  26919. } /* fall through */
  26920. fallthrough
  26921. case int32(_BT_NMSTRT):
  26922. fallthrough
  26923. case int32(_BT_HEX):
  26924. ptr += uintptr(2)
  26925. case int32(_BT_LEAD2):
  26926. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  26927. return -int32(2)
  26928. }
  26929. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26930. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26931. return m_XML_TOK_INVALID
  26932. }
  26933. ptr += uintptr(2)
  26934. case int32(_BT_LEAD3):
  26935. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  26936. return -int32(2)
  26937. }
  26938. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26939. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26940. return m_XML_TOK_INVALID
  26941. }
  26942. ptr += uintptr(3)
  26943. case int32(_BT_LEAD4):
  26944. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  26945. return -int32(2)
  26946. }
  26947. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26948. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26949. return m_XML_TOK_INVALID
  26950. }
  26951. ptr += uintptr(4)
  26952. default:
  26953. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26954. return m_XML_TOK_INVALID
  26955. }
  26956. goto _20
  26957. _16:
  26958. ;
  26959. _15:
  26960. ;
  26961. _14:
  26962. ;
  26963. ptr += uintptr(2)
  26964. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26965. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26966. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26967. } else {
  26968. v22 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26969. }
  26970. switch v22 {
  26971. case int32(_BT_NONASCII):
  26972. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  26973. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26974. return m_XML_TOK_INVALID
  26975. } /* fall through */
  26976. fallthrough
  26977. case int32(_BT_NMSTRT):
  26978. fallthrough
  26979. case int32(_BT_HEX):
  26980. ptr += uintptr(2)
  26981. case int32(_BT_LEAD2):
  26982. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  26983. return -int32(2)
  26984. }
  26985. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26986. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26987. return m_XML_TOK_INVALID
  26988. }
  26989. ptr += uintptr(2)
  26990. case int32(_BT_LEAD3):
  26991. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  26992. return -int32(2)
  26993. }
  26994. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26995. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26996. return m_XML_TOK_INVALID
  26997. }
  26998. ptr += uintptr(3)
  26999. case int32(_BT_LEAD4):
  27000. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  27001. return -int32(2)
  27002. }
  27003. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  27004. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27005. return m_XML_TOK_INVALID
  27006. }
  27007. ptr += uintptr(4)
  27008. case int32(_BT_GT):
  27009. goto gt
  27010. case int32(_BT_SOL):
  27011. goto sol
  27012. case int32(_BT_S):
  27013. fallthrough
  27014. case int32(_BT_CR):
  27015. fallthrough
  27016. case int32(_BT_LF):
  27017. ptr += uintptr(2)
  27018. continue
  27019. default:
  27020. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27021. return m_XML_TOK_INVALID
  27022. }
  27023. return _big2_scanAtts(tls, enc, ptr, end, nextTokPtr)
  27024. }
  27025. return -int32(1)
  27026. _17:
  27027. ;
  27028. goto gt
  27029. gt:
  27030. ;
  27031. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  27032. return int32(m_XML_TOK_START_TAG_NO_ATTS)
  27033. _18:
  27034. ;
  27035. goto sol
  27036. sol:
  27037. ;
  27038. ptr += uintptr(2)
  27039. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  27040. return -int32(1)
  27041. }
  27042. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  27043. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27044. return m_XML_TOK_INVALID
  27045. }
  27046. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  27047. return int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS)
  27048. _19:
  27049. ;
  27050. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27051. return m_XML_TOK_INVALID
  27052. _20:
  27053. }
  27054. return -int32(1)
  27055. }
  27056. func _big2_contentTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  27057. var n Tsize_t
  27058. var v1, v2, v3 int32
  27059. _, _, _, _ = n, v1, v2, v3
  27060. if ptr >= end {
  27061. return -int32(4)
  27062. }
  27063. if int32(2) > int32(1) {
  27064. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  27065. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  27066. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  27067. if n == uint64(0) {
  27068. return -int32(1)
  27069. }
  27070. end = ptr + uintptr(n)
  27071. }
  27072. }
  27073. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  27074. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  27075. } else {
  27076. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  27077. }
  27078. switch v1 {
  27079. case int32(_BT_LT):
  27080. return _big2_scanLt(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  27081. case int32(_BT_AMP):
  27082. return _big2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  27083. case int32(_BT_CR):
  27084. ptr += uintptr(2)
  27085. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  27086. return -int32(3)
  27087. }
  27088. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  27089. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  27090. } else {
  27091. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  27092. }
  27093. if v2 == int32(_BT_LF) {
  27094. ptr += uintptr(2)
  27095. }
  27096. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27097. return int32(m_XML_TOK_DATA_NEWLINE)
  27098. case int32(_BT_LF):
  27099. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  27100. return int32(m_XML_TOK_DATA_NEWLINE)
  27101. case int32(_BT_RSQB):
  27102. ptr += uintptr(2)
  27103. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  27104. return -int32(5)
  27105. }
  27106. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1)) {
  27107. break
  27108. }
  27109. ptr += uintptr(2)
  27110. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  27111. return -int32(5)
  27112. }
  27113. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  27114. ptr -= uintptr(2)
  27115. break
  27116. }
  27117. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27118. return m_XML_TOK_INVALID
  27119. case int32(_BT_LEAD2):
  27120. if int64(end)-int64(ptr) < int64(2) {
  27121. return -int32(2)
  27122. }
  27123. if 0 != 0 {
  27124. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27125. return m_XML_TOK_INVALID
  27126. }
  27127. ptr += uintptr(2)
  27128. case int32(_BT_LEAD3):
  27129. if int64(end)-int64(ptr) < int64(3) {
  27130. return -int32(2)
  27131. }
  27132. if 0 != 0 {
  27133. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27134. return m_XML_TOK_INVALID
  27135. }
  27136. ptr += uintptr(3)
  27137. case int32(_BT_LEAD4):
  27138. if int64(end)-int64(ptr) < int64(4) {
  27139. return -int32(2)
  27140. }
  27141. if 0 != 0 {
  27142. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27143. return m_XML_TOK_INVALID
  27144. }
  27145. ptr += uintptr(4)
  27146. case int32(_BT_NONXML):
  27147. fallthrough
  27148. case int32(_BT_MALFORM):
  27149. fallthrough
  27150. case int32(_BT_TRAIL):
  27151. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27152. return m_XML_TOK_INVALID
  27153. default:
  27154. ptr += uintptr(2)
  27155. break
  27156. }
  27157. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  27158. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  27159. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  27160. } else {
  27161. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  27162. }
  27163. switch v3 {
  27164. case int32(_BT_LEAD2):
  27165. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  27166. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27167. return int32(m_XML_TOK_DATA_CHARS)
  27168. }
  27169. ptr += uintptr(2)
  27170. case int32(_BT_LEAD3):
  27171. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  27172. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27173. return int32(m_XML_TOK_DATA_CHARS)
  27174. }
  27175. ptr += uintptr(3)
  27176. case int32(_BT_LEAD4):
  27177. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  27178. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27179. return int32(m_XML_TOK_DATA_CHARS)
  27180. }
  27181. ptr += uintptr(4)
  27182. case int32(_BT_RSQB):
  27183. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) {
  27184. if !(int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == int32(m_ASCII_RSQB1)) {
  27185. ptr += uintptr(2)
  27186. break
  27187. }
  27188. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(3)*libc.Int32FromInt32(2)) {
  27189. if !(int32(*(*int8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) + 1))) == int32(m_ASCII_GT1)) {
  27190. ptr += uintptr(2)
  27191. break
  27192. }
  27193. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  27194. return m_XML_TOK_INVALID
  27195. }
  27196. }
  27197. /* fall through */
  27198. fallthrough
  27199. case int32(_BT_AMP):
  27200. fallthrough
  27201. case int32(_BT_LT):
  27202. fallthrough
  27203. case int32(_BT_NONXML):
  27204. fallthrough
  27205. case int32(_BT_MALFORM):
  27206. fallthrough
  27207. case int32(_BT_TRAIL):
  27208. fallthrough
  27209. case int32(_BT_CR):
  27210. fallthrough
  27211. case int32(_BT_LF):
  27212. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27213. return int32(m_XML_TOK_DATA_CHARS)
  27214. default:
  27215. ptr += uintptr(2)
  27216. break
  27217. }
  27218. }
  27219. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27220. return int32(m_XML_TOK_DATA_CHARS)
  27221. }
  27222. /* ptr points to character following "%" */
  27223. func _big2_scanPercent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  27224. var v1, v2 int32
  27225. _, _ = v1, v2
  27226. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  27227. return -int32(1)
  27228. }
  27229. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  27230. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  27231. } else {
  27232. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  27233. }
  27234. switch v1 {
  27235. case int32(_BT_NONASCII):
  27236. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  27237. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27238. return m_XML_TOK_INVALID
  27239. } /* fall through */
  27240. fallthrough
  27241. case int32(_BT_NMSTRT):
  27242. fallthrough
  27243. case int32(_BT_HEX):
  27244. ptr += uintptr(2)
  27245. case int32(_BT_LEAD2):
  27246. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  27247. return -int32(2)
  27248. }
  27249. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  27250. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27251. return m_XML_TOK_INVALID
  27252. }
  27253. ptr += uintptr(2)
  27254. case int32(_BT_LEAD3):
  27255. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  27256. return -int32(2)
  27257. }
  27258. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  27259. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27260. return m_XML_TOK_INVALID
  27261. }
  27262. ptr += uintptr(3)
  27263. case int32(_BT_LEAD4):
  27264. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  27265. return -int32(2)
  27266. }
  27267. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  27268. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27269. return m_XML_TOK_INVALID
  27270. }
  27271. ptr += uintptr(4)
  27272. case int32(_BT_S):
  27273. fallthrough
  27274. case int32(_BT_LF):
  27275. fallthrough
  27276. case int32(_BT_CR):
  27277. fallthrough
  27278. case int32(_BT_PERCNT):
  27279. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27280. return int32(m_XML_TOK_PERCENT)
  27281. default:
  27282. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27283. return m_XML_TOK_INVALID
  27284. }
  27285. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  27286. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  27287. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  27288. } else {
  27289. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  27290. }
  27291. switch v2 {
  27292. case int32(_BT_NONASCII):
  27293. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  27294. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27295. return m_XML_TOK_INVALID
  27296. } /* fall through */
  27297. fallthrough
  27298. case int32(_BT_NMSTRT):
  27299. fallthrough
  27300. case int32(_BT_HEX):
  27301. fallthrough
  27302. case int32(_BT_DIGIT):
  27303. fallthrough
  27304. case int32(_BT_NAME):
  27305. fallthrough
  27306. case int32(_BT_MINUS):
  27307. ptr += uintptr(2)
  27308. case int32(_BT_LEAD2):
  27309. if int64(end)-int64(ptr) < int64(2) {
  27310. return -int32(2)
  27311. }
  27312. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  27313. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27314. return m_XML_TOK_INVALID
  27315. }
  27316. ptr += uintptr(2)
  27317. case int32(_BT_LEAD3):
  27318. if int64(end)-int64(ptr) < int64(3) {
  27319. return -int32(2)
  27320. }
  27321. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  27322. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27323. return m_XML_TOK_INVALID
  27324. }
  27325. ptr += uintptr(3)
  27326. case int32(_BT_LEAD4):
  27327. if int64(end)-int64(ptr) < int64(4) {
  27328. return -int32(2)
  27329. }
  27330. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  27331. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27332. return m_XML_TOK_INVALID
  27333. }
  27334. ptr += uintptr(4)
  27335. case int32(_BT_SEMI):
  27336. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  27337. return int32(m_XML_TOK_PARAM_ENTITY_REF)
  27338. default:
  27339. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27340. return m_XML_TOK_INVALID
  27341. }
  27342. }
  27343. return -int32(1)
  27344. }
  27345. func _big2_scanPoundName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  27346. var v1, v2 int32
  27347. _, _ = v1, v2
  27348. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  27349. return -int32(1)
  27350. }
  27351. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  27352. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  27353. } else {
  27354. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  27355. }
  27356. switch v1 {
  27357. case int32(_BT_NONASCII):
  27358. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  27359. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27360. return m_XML_TOK_INVALID
  27361. } /* fall through */
  27362. fallthrough
  27363. case int32(_BT_NMSTRT):
  27364. fallthrough
  27365. case int32(_BT_HEX):
  27366. ptr += uintptr(2)
  27367. case int32(_BT_LEAD2):
  27368. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  27369. return -int32(2)
  27370. }
  27371. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  27372. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27373. return m_XML_TOK_INVALID
  27374. }
  27375. ptr += uintptr(2)
  27376. case int32(_BT_LEAD3):
  27377. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  27378. return -int32(2)
  27379. }
  27380. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  27381. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27382. return m_XML_TOK_INVALID
  27383. }
  27384. ptr += uintptr(3)
  27385. case int32(_BT_LEAD4):
  27386. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  27387. return -int32(2)
  27388. }
  27389. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  27390. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27391. return m_XML_TOK_INVALID
  27392. }
  27393. ptr += uintptr(4)
  27394. default:
  27395. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27396. return m_XML_TOK_INVALID
  27397. }
  27398. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  27399. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  27400. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  27401. } else {
  27402. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  27403. }
  27404. switch v2 {
  27405. case int32(_BT_NONASCII):
  27406. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  27407. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27408. return m_XML_TOK_INVALID
  27409. } /* fall through */
  27410. fallthrough
  27411. case int32(_BT_NMSTRT):
  27412. fallthrough
  27413. case int32(_BT_HEX):
  27414. fallthrough
  27415. case int32(_BT_DIGIT):
  27416. fallthrough
  27417. case int32(_BT_NAME):
  27418. fallthrough
  27419. case int32(_BT_MINUS):
  27420. ptr += uintptr(2)
  27421. case int32(_BT_LEAD2):
  27422. if int64(end)-int64(ptr) < int64(2) {
  27423. return -int32(2)
  27424. }
  27425. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  27426. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27427. return m_XML_TOK_INVALID
  27428. }
  27429. ptr += uintptr(2)
  27430. case int32(_BT_LEAD3):
  27431. if int64(end)-int64(ptr) < int64(3) {
  27432. return -int32(2)
  27433. }
  27434. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  27435. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27436. return m_XML_TOK_INVALID
  27437. }
  27438. ptr += uintptr(3)
  27439. case int32(_BT_LEAD4):
  27440. if int64(end)-int64(ptr) < int64(4) {
  27441. return -int32(2)
  27442. }
  27443. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  27444. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27445. return m_XML_TOK_INVALID
  27446. }
  27447. ptr += uintptr(4)
  27448. case int32(_BT_CR):
  27449. fallthrough
  27450. case int32(_BT_LF):
  27451. fallthrough
  27452. case int32(_BT_S):
  27453. fallthrough
  27454. case int32(_BT_RPAR):
  27455. fallthrough
  27456. case int32(_BT_GT):
  27457. fallthrough
  27458. case int32(_BT_PERCNT):
  27459. fallthrough
  27460. case int32(_BT_VERBAR):
  27461. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27462. return int32(m_XML_TOK_POUND_NAME)
  27463. default:
  27464. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27465. return m_XML_TOK_INVALID
  27466. }
  27467. }
  27468. return -int32(m_XML_TOK_POUND_NAME)
  27469. }
  27470. func _big2_scanLit(tls *libc.TLS, open int32, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  27471. var t, v1, v2 int32
  27472. _, _, _ = t, v1, v2
  27473. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  27474. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  27475. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  27476. } else {
  27477. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  27478. }
  27479. t = v1
  27480. switch t {
  27481. case int32(_BT_LEAD2):
  27482. if int64(end)-int64(ptr) < int64(2) {
  27483. return -int32(2)
  27484. }
  27485. if 0 != 0 {
  27486. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27487. return m_XML_TOK_INVALID
  27488. }
  27489. ptr += uintptr(2)
  27490. case int32(_BT_LEAD3):
  27491. if int64(end)-int64(ptr) < int64(3) {
  27492. return -int32(2)
  27493. }
  27494. if 0 != 0 {
  27495. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27496. return m_XML_TOK_INVALID
  27497. }
  27498. ptr += uintptr(3)
  27499. case int32(_BT_LEAD4):
  27500. if int64(end)-int64(ptr) < int64(4) {
  27501. return -int32(2)
  27502. }
  27503. if 0 != 0 {
  27504. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27505. return m_XML_TOK_INVALID
  27506. }
  27507. ptr += uintptr(4)
  27508. case int32(_BT_NONXML):
  27509. fallthrough
  27510. case int32(_BT_MALFORM):
  27511. fallthrough
  27512. case int32(_BT_TRAIL):
  27513. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27514. return m_XML_TOK_INVALID
  27515. case int32(_BT_QUOT):
  27516. fallthrough
  27517. case int32(_BT_APOS):
  27518. ptr += uintptr(2)
  27519. if t != open {
  27520. break
  27521. }
  27522. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  27523. return -int32(m_XML_TOK_LITERAL)
  27524. }
  27525. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27526. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  27527. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  27528. } else {
  27529. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  27530. }
  27531. switch v2 {
  27532. case int32(_BT_S):
  27533. fallthrough
  27534. case int32(_BT_CR):
  27535. fallthrough
  27536. case int32(_BT_LF):
  27537. fallthrough
  27538. case int32(_BT_GT):
  27539. fallthrough
  27540. case int32(_BT_PERCNT):
  27541. fallthrough
  27542. case int32(_BT_LSQB):
  27543. return int32(m_XML_TOK_LITERAL)
  27544. default:
  27545. return m_XML_TOK_INVALID
  27546. }
  27547. fallthrough
  27548. default:
  27549. ptr += uintptr(2)
  27550. break
  27551. }
  27552. }
  27553. return -int32(1)
  27554. }
  27555. func _big2_prologTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  27556. var n Tsize_t
  27557. var tok, v1, v29, v33, v34, v35, v36 int32
  27558. _, _, _, _, _, _, _, _ = n, tok, v1, v29, v33, v34, v35, v36
  27559. if ptr >= end {
  27560. return -int32(4)
  27561. }
  27562. if int32(2) > int32(1) {
  27563. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  27564. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  27565. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  27566. if n == uint64(0) {
  27567. return -int32(1)
  27568. }
  27569. end = ptr + uintptr(n)
  27570. }
  27571. }
  27572. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  27573. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  27574. } else {
  27575. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  27576. }
  27577. switch v1 {
  27578. case int32(_BT_QUOT):
  27579. goto _2
  27580. case int32(_BT_APOS):
  27581. goto _3
  27582. case int32(_BT_LT):
  27583. goto _4
  27584. case int32(_BT_CR):
  27585. goto _5
  27586. case int32(_BT_LF):
  27587. goto _6
  27588. case int32(_BT_S):
  27589. goto _7
  27590. case int32(_BT_PERCNT):
  27591. goto _8
  27592. case int32(_BT_COMMA):
  27593. goto _9
  27594. case int32(_BT_LSQB):
  27595. goto _10
  27596. case int32(_BT_RSQB):
  27597. goto _11
  27598. case int32(_BT_LPAR):
  27599. goto _12
  27600. case int32(_BT_RPAR):
  27601. goto _13
  27602. case int32(_BT_VERBAR):
  27603. goto _14
  27604. case int32(_BT_GT):
  27605. goto _15
  27606. case int32(_BT_NUM):
  27607. goto _16
  27608. case int32(_BT_LEAD2):
  27609. goto _17
  27610. case int32(_BT_LEAD3):
  27611. goto _18
  27612. case int32(_BT_LEAD4):
  27613. goto _19
  27614. case int32(_BT_HEX):
  27615. goto _20
  27616. case int32(_BT_NMSTRT):
  27617. goto _21
  27618. case int32(_BT_COLON):
  27619. goto _22
  27620. case int32(_BT_MINUS):
  27621. goto _23
  27622. case int32(_BT_NAME):
  27623. goto _24
  27624. case int32(_BT_DIGIT):
  27625. goto _25
  27626. case int32(_BT_NONASCII):
  27627. goto _26
  27628. default:
  27629. goto _27
  27630. }
  27631. goto _28
  27632. _2:
  27633. ;
  27634. return _big2_scanLit(tls, int32(_BT_QUOT), enc, ptr+uintptr(2), end, nextTokPtr)
  27635. _3:
  27636. ;
  27637. return _big2_scanLit(tls, int32(_BT_APOS), enc, ptr+uintptr(2), end, nextTokPtr)
  27638. _4:
  27639. ;
  27640. ptr += uintptr(2)
  27641. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  27642. return -int32(1)
  27643. }
  27644. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  27645. v29 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  27646. } else {
  27647. v29 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  27648. }
  27649. switch v29 {
  27650. case int32(_BT_EXCL):
  27651. return _big2_scanDecl(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  27652. case int32(_BT_QUEST):
  27653. return _big2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  27654. case int32(_BT_NMSTRT):
  27655. fallthrough
  27656. case int32(_BT_HEX):
  27657. fallthrough
  27658. case int32(_BT_NONASCII):
  27659. fallthrough
  27660. case int32(_BT_LEAD2):
  27661. fallthrough
  27662. case int32(_BT_LEAD3):
  27663. fallthrough
  27664. case int32(_BT_LEAD4):
  27665. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr - uintptr(2)
  27666. return int32(m_XML_TOK_INSTANCE_START)
  27667. }
  27668. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27669. return m_XML_TOK_INVALID
  27670. _5:
  27671. ;
  27672. if ptr+uintptr(2) == end {
  27673. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = end
  27674. /* indicate that this might be part of a CR/LF pair */
  27675. return -int32(m_XML_TOK_PROLOG_S)
  27676. }
  27677. /* fall through */
  27678. _7:
  27679. ;
  27680. _6:
  27681. ;
  27682. _32:
  27683. ;
  27684. ptr += uintptr(2)
  27685. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  27686. goto _30
  27687. }
  27688. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  27689. v33 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  27690. } else {
  27691. v33 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  27692. }
  27693. switch v33 {
  27694. case int32(_BT_S):
  27695. fallthrough
  27696. case int32(_BT_LF):
  27697. case int32(_BT_CR):
  27698. /* don't split CR/LF pair */
  27699. if ptr+uintptr(2) != end {
  27700. break
  27701. }
  27702. /* fall through */
  27703. fallthrough
  27704. default:
  27705. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27706. return int32(m_XML_TOK_PROLOG_S)
  27707. }
  27708. goto _31
  27709. _31:
  27710. ;
  27711. goto _32
  27712. goto _30
  27713. _30:
  27714. ;
  27715. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27716. return int32(m_XML_TOK_PROLOG_S)
  27717. _8:
  27718. ;
  27719. return _big2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  27720. _9:
  27721. ;
  27722. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  27723. return int32(m_XML_TOK_COMMA)
  27724. _10:
  27725. ;
  27726. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  27727. return int32(m_XML_TOK_OPEN_BRACKET)
  27728. _11:
  27729. ;
  27730. ptr += uintptr(2)
  27731. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  27732. return -int32(m_XML_TOK_CLOSE_BRACKET)
  27733. }
  27734. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1) {
  27735. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  27736. return -int32(1)
  27737. }
  27738. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == int32(m_ASCII_GT1) {
  27739. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  27740. return int32(m_XML_TOK_COND_SECT_CLOSE)
  27741. }
  27742. }
  27743. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27744. return int32(m_XML_TOK_CLOSE_BRACKET)
  27745. _12:
  27746. ;
  27747. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  27748. return int32(m_XML_TOK_OPEN_PAREN)
  27749. _13:
  27750. ;
  27751. ptr += uintptr(2)
  27752. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  27753. return -int32(m_XML_TOK_CLOSE_PAREN)
  27754. }
  27755. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  27756. v34 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  27757. } else {
  27758. v34 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  27759. }
  27760. switch v34 {
  27761. case int32(_BT_AST):
  27762. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  27763. return int32(m_XML_TOK_CLOSE_PAREN_ASTERISK)
  27764. case int32(_BT_QUEST):
  27765. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  27766. return int32(m_XML_TOK_CLOSE_PAREN_QUESTION)
  27767. case int32(_BT_PLUS):
  27768. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  27769. return int32(m_XML_TOK_CLOSE_PAREN_PLUS)
  27770. case int32(_BT_CR):
  27771. fallthrough
  27772. case int32(_BT_LF):
  27773. fallthrough
  27774. case int32(_BT_S):
  27775. fallthrough
  27776. case int32(_BT_GT):
  27777. fallthrough
  27778. case int32(_BT_COMMA):
  27779. fallthrough
  27780. case int32(_BT_VERBAR):
  27781. fallthrough
  27782. case int32(_BT_RPAR):
  27783. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27784. return int32(m_XML_TOK_CLOSE_PAREN)
  27785. }
  27786. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27787. return m_XML_TOK_INVALID
  27788. _14:
  27789. ;
  27790. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  27791. return int32(m_XML_TOK_OR)
  27792. _15:
  27793. ;
  27794. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  27795. return int32(m_XML_TOK_DECL_CLOSE)
  27796. _16:
  27797. ;
  27798. return _big2_scanPoundName(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  27799. _17:
  27800. ;
  27801. if int64(end)-int64(ptr) < int64(2) {
  27802. return -int32(2)
  27803. }
  27804. if 0 != 0 {
  27805. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27806. return m_XML_TOK_INVALID
  27807. }
  27808. if 0 != 0 {
  27809. ptr += uintptr(2)
  27810. tok = int32(m_XML_TOK_NAME)
  27811. goto _28
  27812. }
  27813. if 0 != 0 {
  27814. ptr += uintptr(2)
  27815. tok = int32(m_XML_TOK_NMTOKEN)
  27816. goto _28
  27817. }
  27818. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27819. return m_XML_TOK_INVALID
  27820. _18:
  27821. ;
  27822. if int64(end)-int64(ptr) < int64(3) {
  27823. return -int32(2)
  27824. }
  27825. if 0 != 0 {
  27826. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27827. return m_XML_TOK_INVALID
  27828. }
  27829. if 0 != 0 {
  27830. ptr += uintptr(3)
  27831. tok = int32(m_XML_TOK_NAME)
  27832. goto _28
  27833. }
  27834. if 0 != 0 {
  27835. ptr += uintptr(3)
  27836. tok = int32(m_XML_TOK_NMTOKEN)
  27837. goto _28
  27838. }
  27839. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27840. return m_XML_TOK_INVALID
  27841. _19:
  27842. ;
  27843. if int64(end)-int64(ptr) < int64(4) {
  27844. return -int32(2)
  27845. }
  27846. if 0 != 0 {
  27847. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27848. return m_XML_TOK_INVALID
  27849. }
  27850. if 0 != 0 {
  27851. ptr += uintptr(4)
  27852. tok = int32(m_XML_TOK_NAME)
  27853. goto _28
  27854. }
  27855. if 0 != 0 {
  27856. ptr += uintptr(4)
  27857. tok = int32(m_XML_TOK_NMTOKEN)
  27858. goto _28
  27859. }
  27860. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27861. return m_XML_TOK_INVALID
  27862. _21:
  27863. ;
  27864. _20:
  27865. ;
  27866. tok = int32(m_XML_TOK_NAME)
  27867. ptr += uintptr(2)
  27868. goto _28
  27869. _25:
  27870. ;
  27871. _24:
  27872. ;
  27873. _23:
  27874. ;
  27875. _22:
  27876. ;
  27877. tok = int32(m_XML_TOK_NMTOKEN)
  27878. ptr += uintptr(2)
  27879. goto _28
  27880. _26:
  27881. ;
  27882. if _namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&int32(0x1F))) != 0 {
  27883. ptr += uintptr(2)
  27884. tok = int32(m_XML_TOK_NAME)
  27885. goto _28
  27886. }
  27887. if _namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&int32(0x1F))) != 0 {
  27888. ptr += uintptr(2)
  27889. tok = int32(m_XML_TOK_NMTOKEN)
  27890. goto _28
  27891. }
  27892. /* fall through */
  27893. _27:
  27894. ;
  27895. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27896. return m_XML_TOK_INVALID
  27897. _28:
  27898. ;
  27899. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  27900. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  27901. v35 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  27902. } else {
  27903. v35 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  27904. }
  27905. switch v35 {
  27906. case int32(_BT_NONASCII):
  27907. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  27908. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27909. return m_XML_TOK_INVALID
  27910. } /* fall through */
  27911. fallthrough
  27912. case int32(_BT_NMSTRT):
  27913. fallthrough
  27914. case int32(_BT_HEX):
  27915. fallthrough
  27916. case int32(_BT_DIGIT):
  27917. fallthrough
  27918. case int32(_BT_NAME):
  27919. fallthrough
  27920. case int32(_BT_MINUS):
  27921. ptr += uintptr(2)
  27922. case int32(_BT_LEAD2):
  27923. if int64(end)-int64(ptr) < int64(2) {
  27924. return -int32(2)
  27925. }
  27926. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  27927. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27928. return m_XML_TOK_INVALID
  27929. }
  27930. ptr += uintptr(2)
  27931. case int32(_BT_LEAD3):
  27932. if int64(end)-int64(ptr) < int64(3) {
  27933. return -int32(2)
  27934. }
  27935. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  27936. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27937. return m_XML_TOK_INVALID
  27938. }
  27939. ptr += uintptr(3)
  27940. case int32(_BT_LEAD4):
  27941. if int64(end)-int64(ptr) < int64(4) {
  27942. return -int32(2)
  27943. }
  27944. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  27945. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27946. return m_XML_TOK_INVALID
  27947. }
  27948. ptr += uintptr(4)
  27949. case int32(_BT_GT):
  27950. fallthrough
  27951. case int32(_BT_RPAR):
  27952. fallthrough
  27953. case int32(_BT_COMMA):
  27954. fallthrough
  27955. case int32(_BT_VERBAR):
  27956. fallthrough
  27957. case int32(_BT_LSQB):
  27958. fallthrough
  27959. case int32(_BT_PERCNT):
  27960. fallthrough
  27961. case int32(_BT_S):
  27962. fallthrough
  27963. case int32(_BT_CR):
  27964. fallthrough
  27965. case int32(_BT_LF):
  27966. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27967. return tok
  27968. case int32(_BT_COLON):
  27969. ptr += uintptr(2)
  27970. switch tok {
  27971. case int32(m_XML_TOK_NAME):
  27972. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  27973. return -int32(1)
  27974. }
  27975. tok = int32(m_XML_TOK_PREFIXED_NAME)
  27976. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  27977. v36 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  27978. } else {
  27979. v36 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  27980. }
  27981. switch v36 {
  27982. case int32(_BT_NONASCII):
  27983. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  27984. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27985. return m_XML_TOK_INVALID
  27986. } /* fall through */
  27987. fallthrough
  27988. case int32(_BT_NMSTRT):
  27989. fallthrough
  27990. case int32(_BT_HEX):
  27991. fallthrough
  27992. case int32(_BT_DIGIT):
  27993. fallthrough
  27994. case int32(_BT_NAME):
  27995. fallthrough
  27996. case int32(_BT_MINUS):
  27997. ptr += uintptr(2)
  27998. case int32(_BT_LEAD2):
  27999. if int64(end)-int64(ptr) < int64(2) {
  28000. return -int32(2)
  28001. }
  28002. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  28003. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  28004. return m_XML_TOK_INVALID
  28005. }
  28006. ptr += uintptr(2)
  28007. case int32(_BT_LEAD3):
  28008. if int64(end)-int64(ptr) < int64(3) {
  28009. return -int32(2)
  28010. }
  28011. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  28012. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  28013. return m_XML_TOK_INVALID
  28014. }
  28015. ptr += uintptr(3)
  28016. case int32(_BT_LEAD4):
  28017. if int64(end)-int64(ptr) < int64(4) {
  28018. return -int32(2)
  28019. }
  28020. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  28021. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  28022. return m_XML_TOK_INVALID
  28023. }
  28024. ptr += uintptr(4)
  28025. default:
  28026. tok = int32(m_XML_TOK_NMTOKEN)
  28027. break
  28028. }
  28029. case int32(m_XML_TOK_PREFIXED_NAME):
  28030. tok = int32(m_XML_TOK_NMTOKEN)
  28031. break
  28032. }
  28033. case int32(_BT_PLUS):
  28034. if tok == int32(m_XML_TOK_NMTOKEN) {
  28035. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  28036. return m_XML_TOK_INVALID
  28037. }
  28038. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  28039. return int32(m_XML_TOK_NAME_PLUS)
  28040. case int32(_BT_AST):
  28041. if tok == int32(m_XML_TOK_NMTOKEN) {
  28042. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  28043. return m_XML_TOK_INVALID
  28044. }
  28045. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  28046. return int32(m_XML_TOK_NAME_ASTERISK)
  28047. case int32(_BT_QUEST):
  28048. if tok == int32(m_XML_TOK_NMTOKEN) {
  28049. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  28050. return m_XML_TOK_INVALID
  28051. }
  28052. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  28053. return int32(m_XML_TOK_NAME_QUESTION)
  28054. default:
  28055. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  28056. return m_XML_TOK_INVALID
  28057. }
  28058. }
  28059. return -tok
  28060. }
  28061. func _big2_attributeValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28062. var start uintptr
  28063. var v1, v2 int32
  28064. _, _, _ = start, v1, v2
  28065. if ptr >= end {
  28066. return -int32(4)
  28067. } else {
  28068. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  28069. /* This line cannot be executed. The incoming data has already
  28070. * been tokenized once, so incomplete characters like this have
  28071. * already been eliminated from the input. Retaining the paranoia
  28072. * check is still valuable, however.
  28073. */
  28074. return -int32(1) /* LCOV_EXCL_LINE */
  28075. }
  28076. }
  28077. start = ptr
  28078. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  28079. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  28080. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  28081. } else {
  28082. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  28083. }
  28084. switch v1 {
  28085. case int32(_BT_LEAD2):
  28086. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  28087. case int32(_BT_LEAD3):
  28088. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  28089. case int32(_BT_LEAD4):
  28090. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  28091. case int32(_BT_AMP):
  28092. if ptr == start {
  28093. return _big2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  28094. }
  28095. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  28096. return int32(m_XML_TOK_DATA_CHARS)
  28097. case int32(_BT_LT):
  28098. /* this is for inside entity references */
  28099. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  28100. return m_XML_TOK_INVALID
  28101. case int32(_BT_LF):
  28102. if ptr == start {
  28103. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  28104. return int32(m_XML_TOK_DATA_NEWLINE)
  28105. }
  28106. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  28107. return int32(m_XML_TOK_DATA_CHARS)
  28108. case int32(_BT_CR):
  28109. if ptr == start {
  28110. ptr += uintptr(2)
  28111. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  28112. return -int32(3)
  28113. }
  28114. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  28115. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  28116. } else {
  28117. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  28118. }
  28119. if v2 == int32(_BT_LF) {
  28120. ptr += uintptr(2)
  28121. }
  28122. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  28123. return int32(m_XML_TOK_DATA_NEWLINE)
  28124. }
  28125. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  28126. return int32(m_XML_TOK_DATA_CHARS)
  28127. case int32(_BT_S):
  28128. if ptr == start {
  28129. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  28130. return int32(m_XML_TOK_ATTRIBUTE_VALUE_S)
  28131. }
  28132. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  28133. return int32(m_XML_TOK_DATA_CHARS)
  28134. default:
  28135. ptr += uintptr(2)
  28136. break
  28137. }
  28138. }
  28139. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  28140. return int32(m_XML_TOK_DATA_CHARS)
  28141. }
  28142. func _big2_entityValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28143. var start uintptr
  28144. var tok, v1, v2, v3 int32
  28145. _, _, _, _, _ = start, tok, v1, v2, v3
  28146. if ptr >= end {
  28147. return -int32(4)
  28148. } else {
  28149. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  28150. /* This line cannot be executed. The incoming data has already
  28151. * been tokenized once, so incomplete characters like this have
  28152. * already been eliminated from the input. Retaining the paranoia
  28153. * check is still valuable, however.
  28154. */
  28155. return -int32(1) /* LCOV_EXCL_LINE */
  28156. }
  28157. }
  28158. start = ptr
  28159. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  28160. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  28161. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  28162. } else {
  28163. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  28164. }
  28165. switch v1 {
  28166. case int32(_BT_LEAD2):
  28167. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  28168. case int32(_BT_LEAD3):
  28169. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  28170. case int32(_BT_LEAD4):
  28171. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  28172. case int32(_BT_AMP):
  28173. if ptr == start {
  28174. return _big2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  28175. }
  28176. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  28177. return int32(m_XML_TOK_DATA_CHARS)
  28178. case int32(_BT_PERCNT):
  28179. if ptr == start {
  28180. tok = _big2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  28181. if tok == int32(m_XML_TOK_PERCENT) {
  28182. v2 = m_XML_TOK_INVALID
  28183. } else {
  28184. v2 = tok
  28185. }
  28186. return v2
  28187. }
  28188. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  28189. return int32(m_XML_TOK_DATA_CHARS)
  28190. case int32(_BT_LF):
  28191. if ptr == start {
  28192. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  28193. return int32(m_XML_TOK_DATA_NEWLINE)
  28194. }
  28195. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  28196. return int32(m_XML_TOK_DATA_CHARS)
  28197. case int32(_BT_CR):
  28198. if ptr == start {
  28199. ptr += uintptr(2)
  28200. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  28201. return -int32(3)
  28202. }
  28203. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  28204. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  28205. } else {
  28206. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  28207. }
  28208. if v3 == int32(_BT_LF) {
  28209. ptr += uintptr(2)
  28210. }
  28211. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  28212. return int32(m_XML_TOK_DATA_NEWLINE)
  28213. }
  28214. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  28215. return int32(m_XML_TOK_DATA_CHARS)
  28216. default:
  28217. ptr += uintptr(2)
  28218. break
  28219. }
  28220. }
  28221. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  28222. return int32(m_XML_TOK_DATA_CHARS)
  28223. }
  28224. func _big2_ignoreSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28225. var level, v1 int32
  28226. var n Tsize_t
  28227. _, _, _ = level, n, v1
  28228. level = 0
  28229. if int32(2) > int32(1) {
  28230. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  28231. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  28232. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  28233. end = ptr + uintptr(n)
  28234. }
  28235. }
  28236. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  28237. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  28238. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  28239. } else {
  28240. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  28241. }
  28242. switch v1 {
  28243. case int32(_BT_LEAD2):
  28244. if int64(end)-int64(ptr) < int64(2) {
  28245. return -int32(2)
  28246. }
  28247. if 0 != 0 {
  28248. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  28249. return m_XML_TOK_INVALID
  28250. }
  28251. ptr += uintptr(2)
  28252. case int32(_BT_LEAD3):
  28253. if int64(end)-int64(ptr) < int64(3) {
  28254. return -int32(2)
  28255. }
  28256. if 0 != 0 {
  28257. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  28258. return m_XML_TOK_INVALID
  28259. }
  28260. ptr += uintptr(3)
  28261. case int32(_BT_LEAD4):
  28262. if int64(end)-int64(ptr) < int64(4) {
  28263. return -int32(2)
  28264. }
  28265. if 0 != 0 {
  28266. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  28267. return m_XML_TOK_INVALID
  28268. }
  28269. ptr += uintptr(4)
  28270. case int32(_BT_NONXML):
  28271. fallthrough
  28272. case int32(_BT_MALFORM):
  28273. fallthrough
  28274. case int32(_BT_TRAIL):
  28275. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  28276. return m_XML_TOK_INVALID
  28277. case int32(_BT_LT):
  28278. ptr += uintptr(2)
  28279. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  28280. return -int32(1)
  28281. }
  28282. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_EXCL2) {
  28283. ptr += uintptr(2)
  28284. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  28285. return -int32(1)
  28286. }
  28287. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_LSQB1) {
  28288. level++
  28289. ptr += uintptr(2)
  28290. }
  28291. }
  28292. case int32(_BT_RSQB):
  28293. ptr += uintptr(2)
  28294. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  28295. return -int32(1)
  28296. }
  28297. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1) {
  28298. ptr += uintptr(2)
  28299. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  28300. return -int32(1)
  28301. }
  28302. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1) {
  28303. ptr += uintptr(2)
  28304. if level == 0 {
  28305. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  28306. return int32(m_XML_TOK_IGNORE_SECT)
  28307. }
  28308. level--
  28309. }
  28310. }
  28311. default:
  28312. ptr += uintptr(2)
  28313. break
  28314. }
  28315. }
  28316. return -int32(1)
  28317. }
  28318. func _big2_isPublicId(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr) (r int32) {
  28319. var v2, v3, v4 int32
  28320. _, _, _ = v2, v3, v4
  28321. ptr += uintptr(2)
  28322. end -= uintptr(2)
  28323. for {
  28324. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  28325. break
  28326. }
  28327. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  28328. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  28329. } else {
  28330. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  28331. }
  28332. switch v2 {
  28333. case int32(_BT_DIGIT):
  28334. fallthrough
  28335. case int32(_BT_HEX):
  28336. fallthrough
  28337. case int32(_BT_MINUS):
  28338. fallthrough
  28339. case int32(_BT_APOS):
  28340. fallthrough
  28341. case int32(_BT_LPAR):
  28342. fallthrough
  28343. case int32(_BT_RPAR):
  28344. fallthrough
  28345. case int32(_BT_PLUS):
  28346. fallthrough
  28347. case int32(_BT_COMMA):
  28348. fallthrough
  28349. case int32(_BT_SOL):
  28350. fallthrough
  28351. case int32(_BT_EQUALS):
  28352. fallthrough
  28353. case int32(_BT_QUEST):
  28354. fallthrough
  28355. case int32(_BT_CR):
  28356. fallthrough
  28357. case int32(_BT_LF):
  28358. fallthrough
  28359. case int32(_BT_SEMI):
  28360. fallthrough
  28361. case int32(_BT_EXCL):
  28362. fallthrough
  28363. case int32(_BT_AST):
  28364. fallthrough
  28365. case int32(_BT_PERCNT):
  28366. fallthrough
  28367. case int32(_BT_NUM):
  28368. fallthrough
  28369. case int32(_BT_COLON):
  28370. case int32(_BT_S):
  28371. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_TAB1) {
  28372. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  28373. return 0
  28374. }
  28375. case int32(_BT_NAME):
  28376. fallthrough
  28377. case int32(_BT_NMSTRT):
  28378. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  28379. v3 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  28380. } else {
  28381. v3 = -int32(1)
  28382. }
  28383. if !(v3 & ^libc.Int32FromInt32(0x7f) != 0) {
  28384. break
  28385. }
  28386. /* fall through */
  28387. fallthrough
  28388. default:
  28389. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  28390. v4 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  28391. } else {
  28392. v4 = -int32(1)
  28393. }
  28394. switch v4 {
  28395. case int32(0x24): /* $ */
  28396. fallthrough
  28397. case int32(0x40): /* @ */
  28398. default:
  28399. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  28400. return 0
  28401. }
  28402. break
  28403. }
  28404. goto _1
  28405. _1:
  28406. ;
  28407. ptr += uintptr(2)
  28408. }
  28409. return int32(1)
  28410. }
  28411. /* This must only be called for a well-formed start-tag or empty
  28412. element tag. Returns the number of attributes. Pointers to the
  28413. first attsMax attributes are stored in atts.
  28414. */
  28415. func _big2_getAtts(tls *libc.TLS, enc uintptr, ptr uintptr, attsMax int32, atts uintptr) (r int32) {
  28416. var nAtts, open, state, v2, v3, v5, v7 int32
  28417. var v4, v6, v8, v9 bool
  28418. _, _, _, _, _, _, _, _, _, _, _ = nAtts, open, state, v2, v3, v4, v5, v6, v7, v8, v9
  28419. state = 1
  28420. nAtts = 0
  28421. open = 0 /* defined when state == inValue;
  28422. initialization just to shut up compilers */
  28423. ptr += uintptr(2)
  28424. for {
  28425. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  28426. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  28427. } else {
  28428. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  28429. }
  28430. switch v2 {
  28431. case int32(_BT_LEAD2):
  28432. if state == 0 {
  28433. if nAtts < attsMax {
  28434. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  28435. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  28436. }
  28437. state = 1
  28438. }
  28439. ptr += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(2))
  28440. case int32(_BT_LEAD3):
  28441. if state == 0 {
  28442. if nAtts < attsMax {
  28443. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  28444. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  28445. }
  28446. state = 1
  28447. }
  28448. ptr += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(2))
  28449. case int32(_BT_LEAD4):
  28450. if state == 0 {
  28451. if nAtts < attsMax {
  28452. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  28453. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  28454. }
  28455. state = 1
  28456. }
  28457. ptr += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(2))
  28458. case int32(_BT_NONASCII):
  28459. fallthrough
  28460. case int32(_BT_NMSTRT):
  28461. fallthrough
  28462. case int32(_BT_HEX):
  28463. if state == 0 {
  28464. if nAtts < attsMax {
  28465. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  28466. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  28467. }
  28468. state = 1
  28469. }
  28470. case int32(_BT_QUOT):
  28471. if state != 2 {
  28472. if nAtts < attsMax {
  28473. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  28474. }
  28475. state = 2
  28476. open = int32(_BT_QUOT)
  28477. } else {
  28478. if open == int32(_BT_QUOT) {
  28479. state = 0
  28480. if nAtts < attsMax {
  28481. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  28482. }
  28483. nAtts++
  28484. }
  28485. }
  28486. case int32(_BT_APOS):
  28487. if state != 2 {
  28488. if nAtts < attsMax {
  28489. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  28490. }
  28491. state = 2
  28492. open = int32(_BT_APOS)
  28493. } else {
  28494. if open == int32(_BT_APOS) {
  28495. state = 0
  28496. if nAtts < attsMax {
  28497. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  28498. }
  28499. nAtts++
  28500. }
  28501. }
  28502. case int32(_BT_AMP):
  28503. if nAtts < attsMax {
  28504. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  28505. }
  28506. case int32(_BT_S):
  28507. if state == 1 {
  28508. state = 0
  28509. } else {
  28510. if v9 = state == 2 && nAtts < attsMax && (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized != 0; v9 {
  28511. if v4 = ptr == (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr; !v4 {
  28512. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  28513. v3 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  28514. } else {
  28515. v3 = -int32(1)
  28516. }
  28517. }
  28518. if v6 = v4 || v3 != int32(m_ASCII_SPACE1); !v6 {
  28519. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 {
  28520. v5 = int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))
  28521. } else {
  28522. v5 = -int32(1)
  28523. }
  28524. }
  28525. if v8 = v6 || v5 == int32(m_ASCII_SPACE1); !v8 {
  28526. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 {
  28527. v7 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))))))
  28528. } else {
  28529. v7 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))), *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))
  28530. }
  28531. }
  28532. }
  28533. if v9 && (v8 || v7 == open) {
  28534. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  28535. }
  28536. }
  28537. case int32(_BT_CR):
  28538. fallthrough
  28539. case int32(_BT_LF):
  28540. /* This case ensures that the first attribute name is counted
  28541. Apart from that we could just change state on the quote. */
  28542. if state == 1 {
  28543. state = 0
  28544. } else {
  28545. if state == 2 && nAtts < attsMax {
  28546. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  28547. }
  28548. }
  28549. case int32(_BT_GT):
  28550. fallthrough
  28551. case int32(_BT_SOL):
  28552. if state != 2 {
  28553. return nAtts
  28554. }
  28555. default:
  28556. break
  28557. }
  28558. goto _1
  28559. _1:
  28560. ;
  28561. ptr += uintptr(2)
  28562. }
  28563. /* not reached */
  28564. return r
  28565. }
  28566. func _big2_charRefNumber(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  28567. var c, c1, result, v2, v4 int32
  28568. _, _, _, _, _ = c, c1, result, v2, v4
  28569. result = 0
  28570. /* skip &# */
  28571. _ = enc
  28572. ptr += uintptr(libc.Int32FromInt32(2) * libc.Int32FromInt32(2))
  28573. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_x2) {
  28574. ptr += uintptr(2)
  28575. for {
  28576. if !!(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_SEMI1)) {
  28577. break
  28578. }
  28579. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  28580. v2 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  28581. } else {
  28582. v2 = -int32(1)
  28583. }
  28584. c = v2
  28585. switch c {
  28586. case int32(m_ASCII_02):
  28587. fallthrough
  28588. case int32(m_ASCII_12):
  28589. fallthrough
  28590. case int32(m_ASCII_22):
  28591. fallthrough
  28592. case int32(m_ASCII_32):
  28593. fallthrough
  28594. case int32(m_ASCII_41):
  28595. fallthrough
  28596. case int32(m_ASCII_51):
  28597. fallthrough
  28598. case int32(m_ASCII_61):
  28599. fallthrough
  28600. case int32(m_ASCII_71):
  28601. fallthrough
  28602. case int32(m_ASCII_82):
  28603. fallthrough
  28604. case int32(m_ASCII_92):
  28605. result <<= int32(4)
  28606. result |= c - int32(m_ASCII_02)
  28607. case int32(m_ASCII_A):
  28608. fallthrough
  28609. case int32(m_ASCII_B1):
  28610. fallthrough
  28611. case int32(m_ASCII_C):
  28612. fallthrough
  28613. case int32(m_ASCII_D):
  28614. fallthrough
  28615. case int32(m_ASCII_E):
  28616. fallthrough
  28617. case int32(m_ASCII_F):
  28618. result <<= int32(4)
  28619. result += int32(10) + (c - int32(m_ASCII_A))
  28620. case int32(m_ASCII_a2):
  28621. fallthrough
  28622. case int32(m_ASCII_b1):
  28623. fallthrough
  28624. case int32(m_ASCII_c2):
  28625. fallthrough
  28626. case int32(m_ASCII_d1):
  28627. fallthrough
  28628. case int32(m_ASCII_e2):
  28629. fallthrough
  28630. case int32(m_ASCII_f1):
  28631. result <<= int32(4)
  28632. result += int32(10) + (c - int32(m_ASCII_a2))
  28633. break
  28634. }
  28635. if result >= int32(0x110000) {
  28636. return -int32(1)
  28637. }
  28638. goto _1
  28639. _1:
  28640. ;
  28641. ptr += uintptr(2)
  28642. }
  28643. } else {
  28644. for {
  28645. if !!(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_SEMI1)) {
  28646. break
  28647. }
  28648. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  28649. v4 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  28650. } else {
  28651. v4 = -int32(1)
  28652. }
  28653. c1 = v4
  28654. result *= int32(10)
  28655. result += c1 - int32(m_ASCII_02)
  28656. if result >= int32(0x110000) {
  28657. return -int32(1)
  28658. }
  28659. goto _3
  28660. _3:
  28661. ;
  28662. ptr += uintptr(2)
  28663. }
  28664. }
  28665. return _checkCharRefNumber(tls, result)
  28666. }
  28667. func _big2_predefinedEntityName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr) (r int32) {
  28668. var v1, v2 int32
  28669. _, _ = v1, v2
  28670. _ = enc
  28671. switch (int64(end) - int64(ptr)) / libc.Int64FromInt32(2) {
  28672. case int64(2):
  28673. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == int32(m_ASCII_t2) {
  28674. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  28675. v1 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  28676. } else {
  28677. v1 = -int32(1)
  28678. }
  28679. switch v1 {
  28680. case int32(m_ASCII_l2):
  28681. return int32(m_ASCII_LT1)
  28682. case int32(m_ASCII_g2):
  28683. return int32(m_ASCII_GT1)
  28684. }
  28685. }
  28686. case int64(3):
  28687. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_a2) {
  28688. ptr += uintptr(2)
  28689. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_m2) {
  28690. ptr += uintptr(2)
  28691. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_p2) {
  28692. return int32(m_ASCII_AMP1)
  28693. }
  28694. }
  28695. }
  28696. case int64(4):
  28697. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  28698. v2 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  28699. } else {
  28700. v2 = -int32(1)
  28701. }
  28702. switch v2 {
  28703. case int32(m_ASCII_q1):
  28704. ptr += uintptr(2)
  28705. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_u1) {
  28706. ptr += uintptr(2)
  28707. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_o2) {
  28708. ptr += uintptr(2)
  28709. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_t2) {
  28710. return int32(m_ASCII_QUOT1)
  28711. }
  28712. }
  28713. }
  28714. case int32(m_ASCII_a2):
  28715. ptr += uintptr(2)
  28716. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_p2) {
  28717. ptr += uintptr(2)
  28718. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_o2) {
  28719. ptr += uintptr(2)
  28720. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_s2) {
  28721. return int32(m_ASCII_APOS1)
  28722. }
  28723. }
  28724. }
  28725. break
  28726. }
  28727. }
  28728. return 0
  28729. }
  28730. func _big2_nameMatchesAscii(tls *libc.TLS, enc uintptr, ptr1 uintptr, end1 uintptr, ptr2 uintptr) (r int32) {
  28731. _ = enc
  28732. for {
  28733. if !(*(*int8)(unsafe.Pointer(ptr2)) != 0) {
  28734. break
  28735. }
  28736. if int64(end1)-int64(ptr1) < int64(2) {
  28737. /* This line cannot be executed. The incoming data has already
  28738. * been tokenized once, so incomplete characters like this have
  28739. * already been eliminated from the input. Retaining the
  28740. * paranoia check is still valuable, however.
  28741. */
  28742. return 0 /* LCOV_EXCL_LINE */
  28743. }
  28744. if !(int32(*(*int8)(unsafe.Pointer(ptr1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr1 + 1))) == int32(*(*int8)(unsafe.Pointer(ptr2)))) {
  28745. return 0
  28746. }
  28747. goto _1
  28748. _1:
  28749. ;
  28750. ptr1 += uintptr(2)
  28751. ptr2++
  28752. }
  28753. return libc.BoolInt32(ptr1 == end1)
  28754. }
  28755. func _big2_nameLength(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  28756. var start uintptr
  28757. var v2 int32
  28758. _, _ = start, v2
  28759. start = ptr
  28760. for {
  28761. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  28762. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  28763. } else {
  28764. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  28765. }
  28766. switch v2 {
  28767. case int32(_BT_LEAD2):
  28768. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  28769. case int32(_BT_LEAD3):
  28770. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  28771. case int32(_BT_LEAD4):
  28772. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  28773. case int32(_BT_NONASCII):
  28774. fallthrough
  28775. case int32(_BT_NMSTRT):
  28776. fallthrough
  28777. case int32(_BT_COLON):
  28778. fallthrough
  28779. case int32(_BT_HEX):
  28780. fallthrough
  28781. case int32(_BT_DIGIT):
  28782. fallthrough
  28783. case int32(_BT_NAME):
  28784. fallthrough
  28785. case int32(_BT_MINUS):
  28786. ptr += uintptr(2)
  28787. default:
  28788. return int32(int64(ptr) - int64(start))
  28789. }
  28790. goto _1
  28791. _1:
  28792. }
  28793. return r
  28794. }
  28795. func _big2_skipS(tls *libc.TLS, enc uintptr, ptr uintptr) (r uintptr) {
  28796. var v2 int32
  28797. _ = v2
  28798. for {
  28799. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  28800. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  28801. } else {
  28802. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  28803. }
  28804. switch v2 {
  28805. case int32(_BT_LF):
  28806. fallthrough
  28807. case int32(_BT_CR):
  28808. fallthrough
  28809. case int32(_BT_S):
  28810. ptr += uintptr(2)
  28811. default:
  28812. return ptr
  28813. }
  28814. goto _1
  28815. _1:
  28816. }
  28817. return r
  28818. }
  28819. func _big2_updatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  28820. var v1, v2 int32
  28821. var v3 bool
  28822. _, _, _ = v1, v2, v3
  28823. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  28824. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  28825. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  28826. } else {
  28827. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  28828. }
  28829. switch v1 {
  28830. case int32(_BT_LEAD2):
  28831. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  28832. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  28833. case int32(_BT_LEAD3):
  28834. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  28835. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  28836. case int32(_BT_LEAD4):
  28837. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  28838. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  28839. case int32(_BT_LF):
  28840. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  28841. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  28842. ptr += uintptr(2)
  28843. case int32(_BT_CR):
  28844. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  28845. ptr += uintptr(2)
  28846. if v3 = int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)); v3 {
  28847. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  28848. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  28849. } else {
  28850. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  28851. }
  28852. }
  28853. if v3 && v2 == int32(_BT_LF) {
  28854. ptr += uintptr(2)
  28855. }
  28856. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  28857. default:
  28858. ptr += uintptr(2)
  28859. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  28860. break
  28861. }
  28862. }
  28863. }
  28864. var _big2_encoding_ns = Tnormal_encoding{
  28865. Fenc: TENCODING{
  28866. Fscanners: [4]TSCANNER{},
  28867. FliteralScanners: [2]TSCANNER{},
  28868. FminBytesPerChar: int32(2),
  28869. },
  28870. Ftype1: [256]uint8{
  28871. 9: uint8(_BT_S),
  28872. 10: uint8(_BT_LF),
  28873. 13: uint8(_BT_CR),
  28874. 32: uint8(_BT_S),
  28875. 33: uint8(_BT_EXCL),
  28876. 34: uint8(_BT_QUOT),
  28877. 35: uint8(_BT_NUM),
  28878. 36: uint8(_BT_OTHER),
  28879. 37: uint8(_BT_PERCNT),
  28880. 38: uint8(_BT_AMP),
  28881. 39: uint8(_BT_APOS),
  28882. 40: uint8(_BT_LPAR),
  28883. 41: uint8(_BT_RPAR),
  28884. 42: uint8(_BT_AST),
  28885. 43: uint8(_BT_PLUS),
  28886. 44: uint8(_BT_COMMA),
  28887. 45: uint8(_BT_MINUS),
  28888. 46: uint8(_BT_NAME),
  28889. 47: uint8(_BT_SOL),
  28890. 48: uint8(_BT_DIGIT),
  28891. 49: uint8(_BT_DIGIT),
  28892. 50: uint8(_BT_DIGIT),
  28893. 51: uint8(_BT_DIGIT),
  28894. 52: uint8(_BT_DIGIT),
  28895. 53: uint8(_BT_DIGIT),
  28896. 54: uint8(_BT_DIGIT),
  28897. 55: uint8(_BT_DIGIT),
  28898. 56: uint8(_BT_DIGIT),
  28899. 57: uint8(_BT_DIGIT),
  28900. 58: uint8(_BT_COLON),
  28901. 59: uint8(_BT_SEMI),
  28902. 60: uint8(_BT_LT),
  28903. 61: uint8(_BT_EQUALS),
  28904. 62: uint8(_BT_GT),
  28905. 63: uint8(_BT_QUEST),
  28906. 64: uint8(_BT_OTHER),
  28907. 65: uint8(_BT_HEX),
  28908. 66: uint8(_BT_HEX),
  28909. 67: uint8(_BT_HEX),
  28910. 68: uint8(_BT_HEX),
  28911. 69: uint8(_BT_HEX),
  28912. 70: uint8(_BT_HEX),
  28913. 71: uint8(_BT_NMSTRT),
  28914. 72: uint8(_BT_NMSTRT),
  28915. 73: uint8(_BT_NMSTRT),
  28916. 74: uint8(_BT_NMSTRT),
  28917. 75: uint8(_BT_NMSTRT),
  28918. 76: uint8(_BT_NMSTRT),
  28919. 77: uint8(_BT_NMSTRT),
  28920. 78: uint8(_BT_NMSTRT),
  28921. 79: uint8(_BT_NMSTRT),
  28922. 80: uint8(_BT_NMSTRT),
  28923. 81: uint8(_BT_NMSTRT),
  28924. 82: uint8(_BT_NMSTRT),
  28925. 83: uint8(_BT_NMSTRT),
  28926. 84: uint8(_BT_NMSTRT),
  28927. 85: uint8(_BT_NMSTRT),
  28928. 86: uint8(_BT_NMSTRT),
  28929. 87: uint8(_BT_NMSTRT),
  28930. 88: uint8(_BT_NMSTRT),
  28931. 89: uint8(_BT_NMSTRT),
  28932. 90: uint8(_BT_NMSTRT),
  28933. 91: uint8(_BT_LSQB),
  28934. 92: uint8(_BT_OTHER),
  28935. 93: uint8(_BT_RSQB),
  28936. 94: uint8(_BT_OTHER),
  28937. 95: uint8(_BT_NMSTRT),
  28938. 96: uint8(_BT_OTHER),
  28939. 97: uint8(_BT_HEX),
  28940. 98: uint8(_BT_HEX),
  28941. 99: uint8(_BT_HEX),
  28942. 100: uint8(_BT_HEX),
  28943. 101: uint8(_BT_HEX),
  28944. 102: uint8(_BT_HEX),
  28945. 103: uint8(_BT_NMSTRT),
  28946. 104: uint8(_BT_NMSTRT),
  28947. 105: uint8(_BT_NMSTRT),
  28948. 106: uint8(_BT_NMSTRT),
  28949. 107: uint8(_BT_NMSTRT),
  28950. 108: uint8(_BT_NMSTRT),
  28951. 109: uint8(_BT_NMSTRT),
  28952. 110: uint8(_BT_NMSTRT),
  28953. 111: uint8(_BT_NMSTRT),
  28954. 112: uint8(_BT_NMSTRT),
  28955. 113: uint8(_BT_NMSTRT),
  28956. 114: uint8(_BT_NMSTRT),
  28957. 115: uint8(_BT_NMSTRT),
  28958. 116: uint8(_BT_NMSTRT),
  28959. 117: uint8(_BT_NMSTRT),
  28960. 118: uint8(_BT_NMSTRT),
  28961. 119: uint8(_BT_NMSTRT),
  28962. 120: uint8(_BT_NMSTRT),
  28963. 121: uint8(_BT_NMSTRT),
  28964. 122: uint8(_BT_NMSTRT),
  28965. 123: uint8(_BT_OTHER),
  28966. 124: uint8(_BT_VERBAR),
  28967. 125: uint8(_BT_OTHER),
  28968. 126: uint8(_BT_OTHER),
  28969. 127: uint8(_BT_OTHER),
  28970. 128: uint8(_BT_OTHER),
  28971. 129: uint8(_BT_OTHER),
  28972. 130: uint8(_BT_OTHER),
  28973. 131: uint8(_BT_OTHER),
  28974. 132: uint8(_BT_OTHER),
  28975. 133: uint8(_BT_OTHER),
  28976. 134: uint8(_BT_OTHER),
  28977. 135: uint8(_BT_OTHER),
  28978. 136: uint8(_BT_OTHER),
  28979. 137: uint8(_BT_OTHER),
  28980. 138: uint8(_BT_OTHER),
  28981. 139: uint8(_BT_OTHER),
  28982. 140: uint8(_BT_OTHER),
  28983. 141: uint8(_BT_OTHER),
  28984. 142: uint8(_BT_OTHER),
  28985. 143: uint8(_BT_OTHER),
  28986. 144: uint8(_BT_OTHER),
  28987. 145: uint8(_BT_OTHER),
  28988. 146: uint8(_BT_OTHER),
  28989. 147: uint8(_BT_OTHER),
  28990. 148: uint8(_BT_OTHER),
  28991. 149: uint8(_BT_OTHER),
  28992. 150: uint8(_BT_OTHER),
  28993. 151: uint8(_BT_OTHER),
  28994. 152: uint8(_BT_OTHER),
  28995. 153: uint8(_BT_OTHER),
  28996. 154: uint8(_BT_OTHER),
  28997. 155: uint8(_BT_OTHER),
  28998. 156: uint8(_BT_OTHER),
  28999. 157: uint8(_BT_OTHER),
  29000. 158: uint8(_BT_OTHER),
  29001. 159: uint8(_BT_OTHER),
  29002. 160: uint8(_BT_OTHER),
  29003. 161: uint8(_BT_OTHER),
  29004. 162: uint8(_BT_OTHER),
  29005. 163: uint8(_BT_OTHER),
  29006. 164: uint8(_BT_OTHER),
  29007. 165: uint8(_BT_OTHER),
  29008. 166: uint8(_BT_OTHER),
  29009. 167: uint8(_BT_OTHER),
  29010. 168: uint8(_BT_OTHER),
  29011. 169: uint8(_BT_OTHER),
  29012. 170: uint8(_BT_NMSTRT),
  29013. 171: uint8(_BT_OTHER),
  29014. 172: uint8(_BT_OTHER),
  29015. 173: uint8(_BT_OTHER),
  29016. 174: uint8(_BT_OTHER),
  29017. 175: uint8(_BT_OTHER),
  29018. 176: uint8(_BT_OTHER),
  29019. 177: uint8(_BT_OTHER),
  29020. 178: uint8(_BT_OTHER),
  29021. 179: uint8(_BT_OTHER),
  29022. 180: uint8(_BT_OTHER),
  29023. 181: uint8(_BT_NMSTRT),
  29024. 182: uint8(_BT_OTHER),
  29025. 183: uint8(_BT_NAME),
  29026. 184: uint8(_BT_OTHER),
  29027. 185: uint8(_BT_OTHER),
  29028. 186: uint8(_BT_NMSTRT),
  29029. 187: uint8(_BT_OTHER),
  29030. 188: uint8(_BT_OTHER),
  29031. 189: uint8(_BT_OTHER),
  29032. 190: uint8(_BT_OTHER),
  29033. 191: uint8(_BT_OTHER),
  29034. 192: uint8(_BT_NMSTRT),
  29035. 193: uint8(_BT_NMSTRT),
  29036. 194: uint8(_BT_NMSTRT),
  29037. 195: uint8(_BT_NMSTRT),
  29038. 196: uint8(_BT_NMSTRT),
  29039. 197: uint8(_BT_NMSTRT),
  29040. 198: uint8(_BT_NMSTRT),
  29041. 199: uint8(_BT_NMSTRT),
  29042. 200: uint8(_BT_NMSTRT),
  29043. 201: uint8(_BT_NMSTRT),
  29044. 202: uint8(_BT_NMSTRT),
  29045. 203: uint8(_BT_NMSTRT),
  29046. 204: uint8(_BT_NMSTRT),
  29047. 205: uint8(_BT_NMSTRT),
  29048. 206: uint8(_BT_NMSTRT),
  29049. 207: uint8(_BT_NMSTRT),
  29050. 208: uint8(_BT_NMSTRT),
  29051. 209: uint8(_BT_NMSTRT),
  29052. 210: uint8(_BT_NMSTRT),
  29053. 211: uint8(_BT_NMSTRT),
  29054. 212: uint8(_BT_NMSTRT),
  29055. 213: uint8(_BT_NMSTRT),
  29056. 214: uint8(_BT_NMSTRT),
  29057. 215: uint8(_BT_OTHER),
  29058. 216: uint8(_BT_NMSTRT),
  29059. 217: uint8(_BT_NMSTRT),
  29060. 218: uint8(_BT_NMSTRT),
  29061. 219: uint8(_BT_NMSTRT),
  29062. 220: uint8(_BT_NMSTRT),
  29063. 221: uint8(_BT_NMSTRT),
  29064. 222: uint8(_BT_NMSTRT),
  29065. 223: uint8(_BT_NMSTRT),
  29066. 224: uint8(_BT_NMSTRT),
  29067. 225: uint8(_BT_NMSTRT),
  29068. 226: uint8(_BT_NMSTRT),
  29069. 227: uint8(_BT_NMSTRT),
  29070. 228: uint8(_BT_NMSTRT),
  29071. 229: uint8(_BT_NMSTRT),
  29072. 230: uint8(_BT_NMSTRT),
  29073. 231: uint8(_BT_NMSTRT),
  29074. 232: uint8(_BT_NMSTRT),
  29075. 233: uint8(_BT_NMSTRT),
  29076. 234: uint8(_BT_NMSTRT),
  29077. 235: uint8(_BT_NMSTRT),
  29078. 236: uint8(_BT_NMSTRT),
  29079. 237: uint8(_BT_NMSTRT),
  29080. 238: uint8(_BT_NMSTRT),
  29081. 239: uint8(_BT_NMSTRT),
  29082. 240: uint8(_BT_NMSTRT),
  29083. 241: uint8(_BT_NMSTRT),
  29084. 242: uint8(_BT_NMSTRT),
  29085. 243: uint8(_BT_NMSTRT),
  29086. 244: uint8(_BT_NMSTRT),
  29087. 245: uint8(_BT_NMSTRT),
  29088. 246: uint8(_BT_NMSTRT),
  29089. 247: uint8(_BT_OTHER),
  29090. 248: uint8(_BT_NMSTRT),
  29091. 249: uint8(_BT_NMSTRT),
  29092. 250: uint8(_BT_NMSTRT),
  29093. 251: uint8(_BT_NMSTRT),
  29094. 252: uint8(_BT_NMSTRT),
  29095. 253: uint8(_BT_NMSTRT),
  29096. 254: uint8(_BT_NMSTRT),
  29097. 255: uint8(_BT_NMSTRT),
  29098. },
  29099. }
  29100. func init() {
  29101. p := unsafe.Pointer(&_big2_encoding_ns)
  29102. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_big2_prologTok)
  29103. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_big2_contentTok)
  29104. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_big2_cdataSectionTok)
  29105. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_big2_ignoreSectionTok)
  29106. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_big2_attributeValueTok)
  29107. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_big2_entityValueTok)
  29108. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_big2_nameMatchesAscii)
  29109. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_big2_nameLength)
  29110. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_big2_skipS)
  29111. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_big2_getAtts)
  29112. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_big2_charRefNumber)
  29113. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_big2_predefinedEntityName)
  29114. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_big2_updatePosition)
  29115. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_big2_isPublicId)
  29116. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_big2_toUtf8)
  29117. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_big2_toUtf16)
  29118. }
  29119. var _big2_encoding = Tnormal_encoding{
  29120. Fenc: TENCODING{
  29121. Fscanners: [4]TSCANNER{},
  29122. FliteralScanners: [2]TSCANNER{},
  29123. FminBytesPerChar: int32(2),
  29124. },
  29125. Ftype1: [256]uint8{
  29126. 9: uint8(_BT_S),
  29127. 10: uint8(_BT_LF),
  29128. 13: uint8(_BT_CR),
  29129. 32: uint8(_BT_S),
  29130. 33: uint8(_BT_EXCL),
  29131. 34: uint8(_BT_QUOT),
  29132. 35: uint8(_BT_NUM),
  29133. 36: uint8(_BT_OTHER),
  29134. 37: uint8(_BT_PERCNT),
  29135. 38: uint8(_BT_AMP),
  29136. 39: uint8(_BT_APOS),
  29137. 40: uint8(_BT_LPAR),
  29138. 41: uint8(_BT_RPAR),
  29139. 42: uint8(_BT_AST),
  29140. 43: uint8(_BT_PLUS),
  29141. 44: uint8(_BT_COMMA),
  29142. 45: uint8(_BT_MINUS),
  29143. 46: uint8(_BT_NAME),
  29144. 47: uint8(_BT_SOL),
  29145. 48: uint8(_BT_DIGIT),
  29146. 49: uint8(_BT_DIGIT),
  29147. 50: uint8(_BT_DIGIT),
  29148. 51: uint8(_BT_DIGIT),
  29149. 52: uint8(_BT_DIGIT),
  29150. 53: uint8(_BT_DIGIT),
  29151. 54: uint8(_BT_DIGIT),
  29152. 55: uint8(_BT_DIGIT),
  29153. 56: uint8(_BT_DIGIT),
  29154. 57: uint8(_BT_DIGIT),
  29155. 58: uint8(_BT_NMSTRT),
  29156. 59: uint8(_BT_SEMI),
  29157. 60: uint8(_BT_LT),
  29158. 61: uint8(_BT_EQUALS),
  29159. 62: uint8(_BT_GT),
  29160. 63: uint8(_BT_QUEST),
  29161. 64: uint8(_BT_OTHER),
  29162. 65: uint8(_BT_HEX),
  29163. 66: uint8(_BT_HEX),
  29164. 67: uint8(_BT_HEX),
  29165. 68: uint8(_BT_HEX),
  29166. 69: uint8(_BT_HEX),
  29167. 70: uint8(_BT_HEX),
  29168. 71: uint8(_BT_NMSTRT),
  29169. 72: uint8(_BT_NMSTRT),
  29170. 73: uint8(_BT_NMSTRT),
  29171. 74: uint8(_BT_NMSTRT),
  29172. 75: uint8(_BT_NMSTRT),
  29173. 76: uint8(_BT_NMSTRT),
  29174. 77: uint8(_BT_NMSTRT),
  29175. 78: uint8(_BT_NMSTRT),
  29176. 79: uint8(_BT_NMSTRT),
  29177. 80: uint8(_BT_NMSTRT),
  29178. 81: uint8(_BT_NMSTRT),
  29179. 82: uint8(_BT_NMSTRT),
  29180. 83: uint8(_BT_NMSTRT),
  29181. 84: uint8(_BT_NMSTRT),
  29182. 85: uint8(_BT_NMSTRT),
  29183. 86: uint8(_BT_NMSTRT),
  29184. 87: uint8(_BT_NMSTRT),
  29185. 88: uint8(_BT_NMSTRT),
  29186. 89: uint8(_BT_NMSTRT),
  29187. 90: uint8(_BT_NMSTRT),
  29188. 91: uint8(_BT_LSQB),
  29189. 92: uint8(_BT_OTHER),
  29190. 93: uint8(_BT_RSQB),
  29191. 94: uint8(_BT_OTHER),
  29192. 95: uint8(_BT_NMSTRT),
  29193. 96: uint8(_BT_OTHER),
  29194. 97: uint8(_BT_HEX),
  29195. 98: uint8(_BT_HEX),
  29196. 99: uint8(_BT_HEX),
  29197. 100: uint8(_BT_HEX),
  29198. 101: uint8(_BT_HEX),
  29199. 102: uint8(_BT_HEX),
  29200. 103: uint8(_BT_NMSTRT),
  29201. 104: uint8(_BT_NMSTRT),
  29202. 105: uint8(_BT_NMSTRT),
  29203. 106: uint8(_BT_NMSTRT),
  29204. 107: uint8(_BT_NMSTRT),
  29205. 108: uint8(_BT_NMSTRT),
  29206. 109: uint8(_BT_NMSTRT),
  29207. 110: uint8(_BT_NMSTRT),
  29208. 111: uint8(_BT_NMSTRT),
  29209. 112: uint8(_BT_NMSTRT),
  29210. 113: uint8(_BT_NMSTRT),
  29211. 114: uint8(_BT_NMSTRT),
  29212. 115: uint8(_BT_NMSTRT),
  29213. 116: uint8(_BT_NMSTRT),
  29214. 117: uint8(_BT_NMSTRT),
  29215. 118: uint8(_BT_NMSTRT),
  29216. 119: uint8(_BT_NMSTRT),
  29217. 120: uint8(_BT_NMSTRT),
  29218. 121: uint8(_BT_NMSTRT),
  29219. 122: uint8(_BT_NMSTRT),
  29220. 123: uint8(_BT_OTHER),
  29221. 124: uint8(_BT_VERBAR),
  29222. 125: uint8(_BT_OTHER),
  29223. 126: uint8(_BT_OTHER),
  29224. 127: uint8(_BT_OTHER),
  29225. 128: uint8(_BT_OTHER),
  29226. 129: uint8(_BT_OTHER),
  29227. 130: uint8(_BT_OTHER),
  29228. 131: uint8(_BT_OTHER),
  29229. 132: uint8(_BT_OTHER),
  29230. 133: uint8(_BT_OTHER),
  29231. 134: uint8(_BT_OTHER),
  29232. 135: uint8(_BT_OTHER),
  29233. 136: uint8(_BT_OTHER),
  29234. 137: uint8(_BT_OTHER),
  29235. 138: uint8(_BT_OTHER),
  29236. 139: uint8(_BT_OTHER),
  29237. 140: uint8(_BT_OTHER),
  29238. 141: uint8(_BT_OTHER),
  29239. 142: uint8(_BT_OTHER),
  29240. 143: uint8(_BT_OTHER),
  29241. 144: uint8(_BT_OTHER),
  29242. 145: uint8(_BT_OTHER),
  29243. 146: uint8(_BT_OTHER),
  29244. 147: uint8(_BT_OTHER),
  29245. 148: uint8(_BT_OTHER),
  29246. 149: uint8(_BT_OTHER),
  29247. 150: uint8(_BT_OTHER),
  29248. 151: uint8(_BT_OTHER),
  29249. 152: uint8(_BT_OTHER),
  29250. 153: uint8(_BT_OTHER),
  29251. 154: uint8(_BT_OTHER),
  29252. 155: uint8(_BT_OTHER),
  29253. 156: uint8(_BT_OTHER),
  29254. 157: uint8(_BT_OTHER),
  29255. 158: uint8(_BT_OTHER),
  29256. 159: uint8(_BT_OTHER),
  29257. 160: uint8(_BT_OTHER),
  29258. 161: uint8(_BT_OTHER),
  29259. 162: uint8(_BT_OTHER),
  29260. 163: uint8(_BT_OTHER),
  29261. 164: uint8(_BT_OTHER),
  29262. 165: uint8(_BT_OTHER),
  29263. 166: uint8(_BT_OTHER),
  29264. 167: uint8(_BT_OTHER),
  29265. 168: uint8(_BT_OTHER),
  29266. 169: uint8(_BT_OTHER),
  29267. 170: uint8(_BT_NMSTRT),
  29268. 171: uint8(_BT_OTHER),
  29269. 172: uint8(_BT_OTHER),
  29270. 173: uint8(_BT_OTHER),
  29271. 174: uint8(_BT_OTHER),
  29272. 175: uint8(_BT_OTHER),
  29273. 176: uint8(_BT_OTHER),
  29274. 177: uint8(_BT_OTHER),
  29275. 178: uint8(_BT_OTHER),
  29276. 179: uint8(_BT_OTHER),
  29277. 180: uint8(_BT_OTHER),
  29278. 181: uint8(_BT_NMSTRT),
  29279. 182: uint8(_BT_OTHER),
  29280. 183: uint8(_BT_NAME),
  29281. 184: uint8(_BT_OTHER),
  29282. 185: uint8(_BT_OTHER),
  29283. 186: uint8(_BT_NMSTRT),
  29284. 187: uint8(_BT_OTHER),
  29285. 188: uint8(_BT_OTHER),
  29286. 189: uint8(_BT_OTHER),
  29287. 190: uint8(_BT_OTHER),
  29288. 191: uint8(_BT_OTHER),
  29289. 192: uint8(_BT_NMSTRT),
  29290. 193: uint8(_BT_NMSTRT),
  29291. 194: uint8(_BT_NMSTRT),
  29292. 195: uint8(_BT_NMSTRT),
  29293. 196: uint8(_BT_NMSTRT),
  29294. 197: uint8(_BT_NMSTRT),
  29295. 198: uint8(_BT_NMSTRT),
  29296. 199: uint8(_BT_NMSTRT),
  29297. 200: uint8(_BT_NMSTRT),
  29298. 201: uint8(_BT_NMSTRT),
  29299. 202: uint8(_BT_NMSTRT),
  29300. 203: uint8(_BT_NMSTRT),
  29301. 204: uint8(_BT_NMSTRT),
  29302. 205: uint8(_BT_NMSTRT),
  29303. 206: uint8(_BT_NMSTRT),
  29304. 207: uint8(_BT_NMSTRT),
  29305. 208: uint8(_BT_NMSTRT),
  29306. 209: uint8(_BT_NMSTRT),
  29307. 210: uint8(_BT_NMSTRT),
  29308. 211: uint8(_BT_NMSTRT),
  29309. 212: uint8(_BT_NMSTRT),
  29310. 213: uint8(_BT_NMSTRT),
  29311. 214: uint8(_BT_NMSTRT),
  29312. 215: uint8(_BT_OTHER),
  29313. 216: uint8(_BT_NMSTRT),
  29314. 217: uint8(_BT_NMSTRT),
  29315. 218: uint8(_BT_NMSTRT),
  29316. 219: uint8(_BT_NMSTRT),
  29317. 220: uint8(_BT_NMSTRT),
  29318. 221: uint8(_BT_NMSTRT),
  29319. 222: uint8(_BT_NMSTRT),
  29320. 223: uint8(_BT_NMSTRT),
  29321. 224: uint8(_BT_NMSTRT),
  29322. 225: uint8(_BT_NMSTRT),
  29323. 226: uint8(_BT_NMSTRT),
  29324. 227: uint8(_BT_NMSTRT),
  29325. 228: uint8(_BT_NMSTRT),
  29326. 229: uint8(_BT_NMSTRT),
  29327. 230: uint8(_BT_NMSTRT),
  29328. 231: uint8(_BT_NMSTRT),
  29329. 232: uint8(_BT_NMSTRT),
  29330. 233: uint8(_BT_NMSTRT),
  29331. 234: uint8(_BT_NMSTRT),
  29332. 235: uint8(_BT_NMSTRT),
  29333. 236: uint8(_BT_NMSTRT),
  29334. 237: uint8(_BT_NMSTRT),
  29335. 238: uint8(_BT_NMSTRT),
  29336. 239: uint8(_BT_NMSTRT),
  29337. 240: uint8(_BT_NMSTRT),
  29338. 241: uint8(_BT_NMSTRT),
  29339. 242: uint8(_BT_NMSTRT),
  29340. 243: uint8(_BT_NMSTRT),
  29341. 244: uint8(_BT_NMSTRT),
  29342. 245: uint8(_BT_NMSTRT),
  29343. 246: uint8(_BT_NMSTRT),
  29344. 247: uint8(_BT_OTHER),
  29345. 248: uint8(_BT_NMSTRT),
  29346. 249: uint8(_BT_NMSTRT),
  29347. 250: uint8(_BT_NMSTRT),
  29348. 251: uint8(_BT_NMSTRT),
  29349. 252: uint8(_BT_NMSTRT),
  29350. 253: uint8(_BT_NMSTRT),
  29351. 254: uint8(_BT_NMSTRT),
  29352. 255: uint8(_BT_NMSTRT),
  29353. },
  29354. }
  29355. func init() {
  29356. p := unsafe.Pointer(&_big2_encoding)
  29357. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_big2_prologTok)
  29358. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_big2_contentTok)
  29359. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_big2_cdataSectionTok)
  29360. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_big2_ignoreSectionTok)
  29361. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_big2_attributeValueTok)
  29362. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_big2_entityValueTok)
  29363. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_big2_nameMatchesAscii)
  29364. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_big2_nameLength)
  29365. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_big2_skipS)
  29366. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_big2_getAtts)
  29367. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_big2_charRefNumber)
  29368. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_big2_predefinedEntityName)
  29369. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_big2_updatePosition)
  29370. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_big2_isPublicId)
  29371. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_big2_toUtf8)
  29372. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_big2_toUtf16)
  29373. }
  29374. func _streqci(tls *libc.TLS, s1 uintptr, s2 uintptr) (r int32) {
  29375. var c1, c2 int8
  29376. var v2, v3 uintptr
  29377. _, _, _, _ = c1, c2, v2, v3
  29378. for {
  29379. v2 = s1
  29380. s1++
  29381. c1 = *(*int8)(unsafe.Pointer(v2))
  29382. v3 = s2
  29383. s2++
  29384. c2 = *(*int8)(unsafe.Pointer(v3))
  29385. if int32(m_ASCII_a2) <= int32(c1) && int32(c1) <= int32(m_ASCII_z1) {
  29386. c1 = int8(int32(c1) + (libc.Int32FromInt32(m_ASCII_A) - libc.Int32FromInt32(m_ASCII_a2)))
  29387. }
  29388. if int32(m_ASCII_a2) <= int32(c2) && int32(c2) <= int32(m_ASCII_z1) {
  29389. /* The following line will never get executed. streqci() is
  29390. * only called from two places, both of which guarantee to put
  29391. * upper-case strings into s2.
  29392. */
  29393. c2 = int8(int32(c2) + (libc.Int32FromInt32(m_ASCII_A) - libc.Int32FromInt32(m_ASCII_a2)))
  29394. } /* LCOV_EXCL_LINE */
  29395. if int32(c1) != int32(c2) {
  29396. return 0
  29397. }
  29398. if !(c1 != 0) {
  29399. break
  29400. }
  29401. goto _1
  29402. _1:
  29403. }
  29404. return int32(1)
  29405. }
  29406. func _initUpdatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  29407. _ = enc
  29408. _normal_updatePosition(tls, uintptr(unsafe.Pointer(&_utf8_encoding)), ptr, end, pos)
  29409. }
  29410. func _toAscii(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr) (r int32) {
  29411. bp := tls.Alloc(32)
  29412. defer tls.Free(32)
  29413. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  29414. var _ /* buf at bp+8 */ [1]int8
  29415. var _ /* p at bp+16 */ uintptr
  29416. *(*uintptr)(unsafe.Pointer(bp + 16)) = bp + 8
  29417. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, end, bp+16, *(*uintptr)(unsafe.Pointer(bp + 16))+uintptr(1))
  29418. if *(*uintptr)(unsafe.Pointer(bp + 16)) == bp+8 {
  29419. return -int32(1)
  29420. } else {
  29421. return int32((*(*[1]int8)(unsafe.Pointer(bp + 8)))[0])
  29422. }
  29423. return r
  29424. }
  29425. func _isSpace(tls *libc.TLS, c int32) (r int32) {
  29426. switch c {
  29427. case int32(0x20):
  29428. fallthrough
  29429. case int32(0xD):
  29430. fallthrough
  29431. case int32(0xA):
  29432. fallthrough
  29433. case int32(0x9):
  29434. return int32(1)
  29435. }
  29436. return 0
  29437. }
  29438. // C documentation
  29439. //
  29440. // /* Return 1 if there's just optional white space or there's an S
  29441. // followed by name=val.
  29442. // */
  29443. func _parsePseudoAttribute(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, namePtr uintptr, nameEndPtr uintptr, valPtr uintptr, nextTokPtr uintptr) (r int32) {
  29444. var c, v2 int32
  29445. var open int8
  29446. _, _, _ = c, open, v2
  29447. if ptr == end {
  29448. *(*uintptr)(unsafe.Pointer(namePtr)) = libc.UintptrFromInt32(0)
  29449. return int32(1)
  29450. }
  29451. if !(_isSpace(tls, _toAscii(tls, enc, ptr, end)) != 0) {
  29452. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  29453. return 0
  29454. }
  29455. for cond := true; cond; cond = _isSpace(tls, _toAscii(tls, enc, ptr, end)) != 0 {
  29456. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  29457. }
  29458. if ptr == end {
  29459. *(*uintptr)(unsafe.Pointer(namePtr)) = libc.UintptrFromInt32(0)
  29460. return int32(1)
  29461. }
  29462. *(*uintptr)(unsafe.Pointer(namePtr)) = ptr
  29463. for {
  29464. c = _toAscii(tls, enc, ptr, end)
  29465. if c == -int32(1) {
  29466. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  29467. return 0
  29468. }
  29469. if c == int32(m_ASCII_EQUALS2) {
  29470. *(*uintptr)(unsafe.Pointer(nameEndPtr)) = ptr
  29471. break
  29472. }
  29473. if _isSpace(tls, c) != 0 {
  29474. *(*uintptr)(unsafe.Pointer(nameEndPtr)) = ptr
  29475. for {
  29476. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  29477. goto _3
  29478. _3:
  29479. ;
  29480. v2 = _toAscii(tls, enc, ptr, end)
  29481. c = v2
  29482. if !(_isSpace(tls, v2) != 0) {
  29483. break
  29484. }
  29485. }
  29486. if c != int32(m_ASCII_EQUALS2) {
  29487. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  29488. return 0
  29489. }
  29490. break
  29491. }
  29492. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  29493. goto _1
  29494. _1:
  29495. }
  29496. if ptr == *(*uintptr)(unsafe.Pointer(namePtr)) {
  29497. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  29498. return 0
  29499. }
  29500. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  29501. c = _toAscii(tls, enc, ptr, end)
  29502. for _isSpace(tls, c) != 0 {
  29503. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  29504. c = _toAscii(tls, enc, ptr, end)
  29505. }
  29506. if c != int32(m_ASCII_QUOT1) && c != int32(m_ASCII_APOS1) {
  29507. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  29508. return 0
  29509. }
  29510. open = int8(c)
  29511. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  29512. *(*uintptr)(unsafe.Pointer(valPtr)) = ptr
  29513. for {
  29514. c = _toAscii(tls, enc, ptr, end)
  29515. if c == int32(open) {
  29516. break
  29517. }
  29518. 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) {
  29519. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  29520. return 0
  29521. }
  29522. goto _4
  29523. _4:
  29524. ;
  29525. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  29526. }
  29527. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  29528. return int32(1)
  29529. }
  29530. var _KW_version = [8]int8{
  29531. 0: int8(m_ASCII_v1),
  29532. 1: int8(m_ASCII_e2),
  29533. 2: int8(m_ASCII_r2),
  29534. 3: int8(m_ASCII_s2),
  29535. 4: int8(m_ASCII_i1),
  29536. 5: int8(m_ASCII_o2),
  29537. 6: int8(m_ASCII_n2),
  29538. }
  29539. var _KW_encoding = [9]int8{
  29540. 0: int8(m_ASCII_e2),
  29541. 1: int8(m_ASCII_n2),
  29542. 2: int8(m_ASCII_c2),
  29543. 3: int8(m_ASCII_o2),
  29544. 4: int8(m_ASCII_d1),
  29545. 5: int8(m_ASCII_i1),
  29546. 6: int8(m_ASCII_n2),
  29547. 7: int8(m_ASCII_g2),
  29548. }
  29549. var _KW_standalone = [11]int8{
  29550. 0: int8(m_ASCII_s2),
  29551. 1: int8(m_ASCII_t2),
  29552. 2: int8(m_ASCII_a2),
  29553. 3: int8(m_ASCII_n2),
  29554. 4: int8(m_ASCII_d1),
  29555. 5: int8(m_ASCII_a2),
  29556. 6: int8(m_ASCII_l2),
  29557. 7: int8(m_ASCII_o2),
  29558. 8: int8(m_ASCII_n2),
  29559. 9: int8(m_ASCII_e2),
  29560. }
  29561. var _KW_yes = [4]int8{
  29562. 0: int8(m_ASCII_y1),
  29563. 1: int8(m_ASCII_e2),
  29564. 2: int8(m_ASCII_s2),
  29565. }
  29566. var _KW_no = [3]int8{
  29567. 0: int8(m_ASCII_n2),
  29568. 1: int8(m_ASCII_o2),
  29569. }
  29570. 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) {
  29571. bp := tls.Alloc(32)
  29572. defer tls.Free(32)
  29573. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  29574. var c int32
  29575. var _ /* name at bp+16 */ uintptr
  29576. var _ /* nameEnd at bp+24 */ uintptr
  29577. var _ /* val at bp+8 */ uintptr
  29578. _ = c
  29579. *(*uintptr)(unsafe.Pointer(bp + 8)) = libc.UintptrFromInt32(0)
  29580. *(*uintptr)(unsafe.Pointer(bp + 16)) = libc.UintptrFromInt32(0)
  29581. *(*uintptr)(unsafe.Pointer(bp + 24)) = libc.UintptrFromInt32(0)
  29582. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(int32(5) * (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  29583. end -= uintptr(int32(2) * (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  29584. if !(_parsePseudoAttribute(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+16, bp+24, bp+8, bp) != 0) || !(*(*uintptr)(unsafe.Pointer(bp + 16)) != 0) {
  29585. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  29586. return 0
  29587. }
  29588. if !((*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 16)), *(*uintptr)(unsafe.Pointer(bp + 24)), uintptr(unsafe.Pointer(&_KW_version))) != 0) {
  29589. if !(isGeneralTextEntity != 0) {
  29590. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 16))
  29591. return 0
  29592. }
  29593. } else {
  29594. if versionPtr != 0 {
  29595. *(*uintptr)(unsafe.Pointer(versionPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  29596. }
  29597. if versionEndPtr != 0 {
  29598. *(*uintptr)(unsafe.Pointer(versionEndPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  29599. }
  29600. if !(_parsePseudoAttribute(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+16, bp+24, bp+8, bp) != 0) {
  29601. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  29602. return 0
  29603. }
  29604. if !(*(*uintptr)(unsafe.Pointer(bp + 16)) != 0) {
  29605. if isGeneralTextEntity != 0 {
  29606. /* a TextDecl must have an EncodingDecl */
  29607. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  29608. return 0
  29609. }
  29610. return int32(1)
  29611. }
  29612. }
  29613. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 16)), *(*uintptr)(unsafe.Pointer(bp + 24)), uintptr(unsafe.Pointer(&_KW_encoding))) != 0 {
  29614. c = _toAscii(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 8)), end)
  29615. if !(int32(m_ASCII_a2) <= c && c <= int32(m_ASCII_z1)) && !(int32(m_ASCII_A) <= c && c <= int32(m_ASCII_Z1)) {
  29616. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  29617. return 0
  29618. }
  29619. if encodingName != 0 {
  29620. *(*uintptr)(unsafe.Pointer(encodingName)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  29621. }
  29622. if encoding != 0 {
  29623. *(*uintptr)(unsafe.Pointer(encoding)) = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{encodingFinder})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 8)), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  29624. }
  29625. if !(_parsePseudoAttribute(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+16, bp+24, bp+8, bp) != 0) {
  29626. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  29627. return 0
  29628. }
  29629. if !(*(*uintptr)(unsafe.Pointer(bp + 16)) != 0) {
  29630. return int32(1)
  29631. }
  29632. }
  29633. if !((*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 16)), *(*uintptr)(unsafe.Pointer(bp + 24)), uintptr(unsafe.Pointer(&_KW_standalone))) != 0) || isGeneralTextEntity != 0 {
  29634. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 16))
  29635. return 0
  29636. }
  29637. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 8)), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), uintptr(unsafe.Pointer(&_KW_yes))) != 0 {
  29638. if standalone != 0 {
  29639. *(*int32)(unsafe.Pointer(standalone)) = int32(1)
  29640. }
  29641. } else {
  29642. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 8)), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), uintptr(unsafe.Pointer(&_KW_no))) != 0 {
  29643. if standalone != 0 {
  29644. *(*int32)(unsafe.Pointer(standalone)) = 0
  29645. }
  29646. } else {
  29647. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  29648. return 0
  29649. }
  29650. }
  29651. for _isSpace(tls, _toAscii(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end)) != 0 {
  29652. *(*uintptr)(unsafe.Pointer(bp)) += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  29653. }
  29654. if *(*uintptr)(unsafe.Pointer(bp)) != end {
  29655. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  29656. return 0
  29657. }
  29658. return int32(1)
  29659. }
  29660. func _checkCharRefNumber(tls *libc.TLS, result int32) (r int32) {
  29661. switch result >> libc.Int32FromInt32(8) {
  29662. case int32(0xD8):
  29663. fallthrough
  29664. case int32(0xD9):
  29665. fallthrough
  29666. case int32(0xDA):
  29667. fallthrough
  29668. case int32(0xDB):
  29669. fallthrough
  29670. case int32(0xDC):
  29671. fallthrough
  29672. case int32(0xDD):
  29673. fallthrough
  29674. case int32(0xDE):
  29675. fallthrough
  29676. case int32(0xDF):
  29677. return -int32(1)
  29678. case 0:
  29679. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(result)))) == int32(_BT_NONXML) {
  29680. return -int32(1)
  29681. }
  29682. case int32(0xFF):
  29683. if result == int32(0xFFFE) || result == int32(0xFFFF) {
  29684. return -int32(1)
  29685. }
  29686. break
  29687. }
  29688. return result
  29689. }
  29690. func XXmlUtf8Encode(tls *libc.TLS, c int32, buf uintptr) (r int32) {
  29691. if c < 0 {
  29692. return 0
  29693. } /* LCOV_EXCL_LINE: this case is always eliminated beforehand */
  29694. if c < 128 {
  29695. *(*int8)(unsafe.Pointer(buf)) = int8(c | int32(_UTF8_cval1))
  29696. return int32(1)
  29697. }
  29698. if c < 2048 {
  29699. *(*int8)(unsafe.Pointer(buf)) = int8(c>>libc.Int32FromInt32(6) | int32(_UTF8_cval2))
  29700. *(*int8)(unsafe.Pointer(buf + 1)) = int8(c&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  29701. return int32(2)
  29702. }
  29703. if c < 65536 {
  29704. *(*int8)(unsafe.Pointer(buf)) = int8(c>>libc.Int32FromInt32(12) | int32(_UTF8_cval3))
  29705. *(*int8)(unsafe.Pointer(buf + 1)) = int8(c>>libc.Int32FromInt32(6)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  29706. *(*int8)(unsafe.Pointer(buf + 2)) = int8(c&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  29707. return int32(3)
  29708. }
  29709. if c < int32(0x110000) {
  29710. *(*int8)(unsafe.Pointer(buf)) = int8(c>>libc.Int32FromInt32(18) | int32(_UTF8_cval4))
  29711. *(*int8)(unsafe.Pointer(buf + 1)) = int8(c>>libc.Int32FromInt32(12)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  29712. *(*int8)(unsafe.Pointer(buf + 2)) = int8(c>>libc.Int32FromInt32(6)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  29713. *(*int8)(unsafe.Pointer(buf + 3)) = int8(c&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  29714. return int32(4)
  29715. }
  29716. return 0 /* LCOV_EXCL_LINE: this case too is eliminated before calling */
  29717. }
  29718. func XXmlUtf16Encode(tls *libc.TLS, charNum int32, buf uintptr) (r int32) {
  29719. if charNum < 0 {
  29720. return 0
  29721. }
  29722. if charNum < int32(0x10000) {
  29723. *(*uint16)(unsafe.Pointer(buf)) = libc.Uint16FromInt32(charNum)
  29724. return int32(1)
  29725. }
  29726. if charNum < int32(0x110000) {
  29727. charNum -= int32(0x10000)
  29728. *(*uint16)(unsafe.Pointer(buf)) = libc.Uint16FromInt32(charNum>>libc.Int32FromInt32(10) + libc.Int32FromInt32(0xD800))
  29729. *(*uint16)(unsafe.Pointer(buf + 1*2)) = libc.Uint16FromInt32(charNum&libc.Int32FromInt32(0x3FF) + libc.Int32FromInt32(0xDC00))
  29730. return int32(2)
  29731. }
  29732. return 0
  29733. }
  29734. type Tunknown_encoding = struct {
  29735. Fnormal Tnormal_encoding
  29736. Fconvert TCONVERTER
  29737. FuserData uintptr
  29738. Futf16 [256]uint16
  29739. Futf8 [256][4]int8
  29740. }
  29741. func XXmlSizeOfUnknownEncoding(tls *libc.TLS) (r int32) {
  29742. return int32(2016)
  29743. }
  29744. func _unknown_isName(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  29745. var c int32
  29746. var uenc uintptr
  29747. _, _ = c, uenc
  29748. uenc = enc
  29749. 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)
  29750. if c & ^libc.Int32FromInt32(0xFFFF) != 0 {
  29751. return 0
  29752. }
  29753. 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))))
  29754. }
  29755. func _unknown_isNmstrt(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  29756. var c int32
  29757. var uenc uintptr
  29758. _, _ = c, uenc
  29759. uenc = enc
  29760. 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)
  29761. if c & ^libc.Int32FromInt32(0xFFFF) != 0 {
  29762. return 0
  29763. }
  29764. 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))))
  29765. }
  29766. func _unknown_isInvalid(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  29767. var c int32
  29768. var uenc uintptr
  29769. _, _ = c, uenc
  29770. uenc = enc
  29771. 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)
  29772. return libc.BoolInt32(c & ^libc.Int32FromInt32(0xFFFF) != 0 || _checkCharRefNumber(tls, c) < 0)
  29773. }
  29774. func _unknown_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  29775. bp := tls.Alloc(16)
  29776. defer tls.Free(16)
  29777. var c, n int32
  29778. var uenc, utf8, v2 uintptr
  29779. var _ /* buf at bp+0 */ [4]int8
  29780. _, _, _, _, _ = c, n, uenc, utf8, v2
  29781. uenc = enc
  29782. for {
  29783. if *(*uintptr)(unsafe.Pointer(fromP)) == fromLim {
  29784. return int32(_XML_CONVERT_COMPLETED)
  29785. }
  29786. utf8 = uenc + 992 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP))))))*4
  29787. v2 = utf8
  29788. utf8++
  29789. n = int32(*(*int8)(unsafe.Pointer(v2)))
  29790. if n == 0 {
  29791. 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)))
  29792. n = XXmlUtf8Encode(tls, c, bp)
  29793. if int64(n) > int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) {
  29794. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  29795. }
  29796. utf8 = bp
  29797. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP))))))))) - (int32(_BT_LEAD2) - libc.Int32FromInt32(2)))
  29798. } else {
  29799. if int64(n) > int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) {
  29800. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  29801. }
  29802. *(*uintptr)(unsafe.Pointer(fromP))++
  29803. }
  29804. libc.X__builtin___memcpy_chk(tls, *(*uintptr)(unsafe.Pointer(toP)), utf8, libc.Uint64FromInt32(n), ^t__predefined_size_t(0))
  29805. *(*uintptr)(unsafe.Pointer(toP)) += uintptr(n)
  29806. goto _1
  29807. _1:
  29808. }
  29809. return r
  29810. }
  29811. func _unknown_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  29812. var c uint16
  29813. var uenc, v1, v2 uintptr
  29814. _, _, _, _ = c, uenc, v1, v2
  29815. uenc = enc
  29816. for *(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim {
  29817. c = *(*uint16)(unsafe.Pointer(uenc + 480 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP))))))*2))
  29818. if libc.Int32FromUint16(c) == 0 {
  29819. 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))))
  29820. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP))))))))) - (int32(_BT_LEAD2) - libc.Int32FromInt32(2)))
  29821. } else {
  29822. *(*uintptr)(unsafe.Pointer(fromP))++
  29823. }
  29824. v2 = toP
  29825. v1 = *(*uintptr)(unsafe.Pointer(v2))
  29826. *(*uintptr)(unsafe.Pointer(v2)) += 2
  29827. *(*uint16)(unsafe.Pointer(v1)) = c
  29828. }
  29829. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  29830. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  29831. } else {
  29832. return int32(_XML_CONVERT_COMPLETED)
  29833. }
  29834. return r
  29835. }
  29836. func XXmlInitUnknownEncoding(tls *libc.TLS, mem uintptr, table uintptr, convert TCONVERTER, userData uintptr) (r uintptr) {
  29837. var c, i, v3 int32
  29838. var e uintptr
  29839. _, _, _, _ = c, e, i, v3
  29840. e = mem
  29841. libc.X__builtin___memcpy_chk(tls, mem, uintptr(unsafe.Pointer(&_latin1_encoding)), uint64(464), ^t__predefined_size_t(0))
  29842. i = 0
  29843. for {
  29844. if !(i < int32(128)) {
  29845. break
  29846. }
  29847. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(i)))) != int32(_BT_OTHER) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(i)))) != int32(_BT_NONXML) && *(*int32)(unsafe.Pointer(table + uintptr(i)*4)) != i {
  29848. return uintptr(0)
  29849. }
  29850. goto _1
  29851. _1:
  29852. ;
  29853. i++
  29854. }
  29855. i = 0
  29856. for {
  29857. if !(i < int32(256)) {
  29858. break
  29859. }
  29860. c = *(*int32)(unsafe.Pointer(table + uintptr(i)*4))
  29861. if c == -int32(1) {
  29862. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_MALFORM)
  29863. /* This shouldn't really get used. */
  29864. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = uint16(0xFFFF)
  29865. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = int8(1)
  29866. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4 + 1)) = 0
  29867. } else {
  29868. if c < 0 {
  29869. if c < -int32(4) {
  29870. return uintptr(0)
  29871. }
  29872. /* Multi-byte sequences need a converter function */
  29873. if !(convert != 0) {
  29874. return uintptr(0)
  29875. }
  29876. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = libc.Uint8FromInt32(int32(_BT_LEAD2) - (c + libc.Int32FromInt32(2)))
  29877. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = 0
  29878. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = uint16(0)
  29879. } else {
  29880. if c < int32(0x80) {
  29881. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(c)))) != int32(_BT_OTHER) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(c)))) != int32(_BT_NONXML) && c != i {
  29882. return uintptr(0)
  29883. }
  29884. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = *(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(c)))
  29885. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = int8(1)
  29886. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4 + 1)) = int8(c)
  29887. if c == 0 {
  29888. v3 = int32(0xFFFF)
  29889. } else {
  29890. v3 = c
  29891. }
  29892. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = libc.Uint16FromInt32(v3)
  29893. } else {
  29894. if _checkCharRefNumber(tls, c) < 0 {
  29895. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_NONXML)
  29896. /* This shouldn't really get used. */
  29897. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = uint16(0xFFFF)
  29898. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = int8(1)
  29899. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4 + 1)) = 0
  29900. } else {
  29901. if c > int32(0xFFFF) {
  29902. return uintptr(0)
  29903. }
  29904. if _namingBitmap[libc.Int32FromUint8(_nmstrtPages[c>>int32(8)])<<int32(3)+c&int32(0xff)>>int32(5)]&(uint32(1)<<(c&int32(0xff)&int32(0x1F))) != 0 {
  29905. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_NMSTRT)
  29906. } else {
  29907. if _namingBitmap[libc.Int32FromUint8(_namePages[c>>int32(8)])<<int32(3)+c&int32(0xff)>>int32(5)]&(uint32(1)<<(c&int32(0xff)&int32(0x1F))) != 0 {
  29908. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_NAME)
  29909. } else {
  29910. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_OTHER)
  29911. }
  29912. }
  29913. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = int8(XXmlUtf8Encode(tls, c, e+992+uintptr(i)*4+uintptr(1)))
  29914. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = libc.Uint16FromInt32(c)
  29915. }
  29916. }
  29917. }
  29918. }
  29919. goto _2
  29920. _2:
  29921. ;
  29922. i++
  29923. }
  29924. (*Tunknown_encoding)(unsafe.Pointer(e)).FuserData = userData
  29925. (*Tunknown_encoding)(unsafe.Pointer(e)).Fconvert = convert
  29926. if convert != 0 {
  29927. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisName2 = __ccgo_fp(_unknown_isName)
  29928. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisName3 = __ccgo_fp(_unknown_isName)
  29929. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisName4 = __ccgo_fp(_unknown_isName)
  29930. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisNmstrt2 = __ccgo_fp(_unknown_isNmstrt)
  29931. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisNmstrt3 = __ccgo_fp(_unknown_isNmstrt)
  29932. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisNmstrt4 = __ccgo_fp(_unknown_isNmstrt)
  29933. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisInvalid2 = __ccgo_fp(_unknown_isInvalid)
  29934. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisInvalid3 = __ccgo_fp(_unknown_isInvalid)
  29935. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisInvalid4 = __ccgo_fp(_unknown_isInvalid)
  29936. }
  29937. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.Fenc.Futf8Convert = __ccgo_fp(_unknown_toUtf8)
  29938. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.Fenc.Futf16Convert = __ccgo_fp(_unknown_toUtf16)
  29939. return e
  29940. }
  29941. const _UNKNOWN_ENC = -1
  29942. const _ISO_8859_1_ENC = 0
  29943. const _US_ASCII_ENC = 1
  29944. const _UTF_8_ENC = 2
  29945. const _UTF_16_ENC = 3
  29946. const _UTF_16BE_ENC = 4
  29947. const _UTF_16LE_ENC = 5
  29948. const
  29949. /* must match encodingNames up to here */
  29950. _NO_ENC = 6
  29951. var _KW_ISO_8859_1 = [11]int8{
  29952. 0: int8(m_ASCII_I),
  29953. 1: int8(m_ASCII_S),
  29954. 2: int8(m_ASCII_O),
  29955. 3: int8(m_ASCII_MINUS1),
  29956. 4: int8(m_ASCII_82),
  29957. 5: int8(m_ASCII_82),
  29958. 6: int8(m_ASCII_51),
  29959. 7: int8(m_ASCII_92),
  29960. 8: int8(m_ASCII_MINUS1),
  29961. 9: int8(m_ASCII_12),
  29962. }
  29963. var _KW_US_ASCII = [9]int8{
  29964. 0: int8(m_ASCII_U1),
  29965. 1: int8(m_ASCII_S),
  29966. 2: int8(m_ASCII_MINUS1),
  29967. 3: int8(m_ASCII_A),
  29968. 4: int8(m_ASCII_S),
  29969. 5: int8(m_ASCII_C),
  29970. 6: int8(m_ASCII_I),
  29971. 7: int8(m_ASCII_I),
  29972. }
  29973. var _KW_UTF_8 = [6]int8{
  29974. 0: int8(m_ASCII_U1),
  29975. 1: int8(m_ASCII_T),
  29976. 2: int8(m_ASCII_F),
  29977. 3: int8(m_ASCII_MINUS1),
  29978. 4: int8(m_ASCII_82),
  29979. }
  29980. var _KW_UTF_16 = [7]int8{
  29981. 0: int8(m_ASCII_U1),
  29982. 1: int8(m_ASCII_T),
  29983. 2: int8(m_ASCII_F),
  29984. 3: int8(m_ASCII_MINUS1),
  29985. 4: int8(m_ASCII_12),
  29986. 5: int8(m_ASCII_61),
  29987. }
  29988. var _KW_UTF_16BE = [9]int8{
  29989. 0: int8(m_ASCII_U1),
  29990. 1: int8(m_ASCII_T),
  29991. 2: int8(m_ASCII_F),
  29992. 3: int8(m_ASCII_MINUS1),
  29993. 4: int8(m_ASCII_12),
  29994. 5: int8(m_ASCII_61),
  29995. 6: int8(m_ASCII_B1),
  29996. 7: int8(m_ASCII_E),
  29997. }
  29998. var _KW_UTF_16LE = [9]int8{
  29999. 0: int8(m_ASCII_U1),
  30000. 1: int8(m_ASCII_T),
  30001. 2: int8(m_ASCII_F),
  30002. 3: int8(m_ASCII_MINUS1),
  30003. 4: int8(m_ASCII_12),
  30004. 5: int8(m_ASCII_61),
  30005. 6: int8(m_ASCII_L),
  30006. 7: int8(m_ASCII_E),
  30007. }
  30008. func _getEncodingIndex(tls *libc.TLS, name uintptr) (r int32) {
  30009. var i int32
  30010. _ = i
  30011. if name == libc.UintptrFromInt32(0) {
  30012. return int32(_NO_ENC)
  30013. }
  30014. i = 0
  30015. for {
  30016. if !(i < libc.Int32FromUint64(libc.Uint64FromInt64(48)/libc.Uint64FromInt64(8))) {
  30017. break
  30018. }
  30019. if _streqci(tls, name, _encodingNames[i]) != 0 {
  30020. return i
  30021. }
  30022. goto _1
  30023. _1:
  30024. ;
  30025. i++
  30026. }
  30027. return int32(_UNKNOWN_ENC)
  30028. }
  30029. var _encodingNames = [6]uintptr{
  30030. 0: uintptr(unsafe.Pointer(&_KW_ISO_8859_1)),
  30031. 1: uintptr(unsafe.Pointer(&_KW_US_ASCII)),
  30032. 2: uintptr(unsafe.Pointer(&_KW_UTF_8)),
  30033. 3: uintptr(unsafe.Pointer(&_KW_UTF_16)),
  30034. 4: uintptr(unsafe.Pointer(&_KW_UTF_16BE)),
  30035. 5: uintptr(unsafe.Pointer(&_KW_UTF_16LE)),
  30036. }
  30037. /* For binary compatibility, we store the index of the encoding
  30038. specified at initialization in the isUtf16 member.
  30039. */
  30040. /* This is what detects the encoding. encodingTable maps from
  30041. encoding indices to encodings; INIT_ENC_INDEX(enc) is the index of
  30042. the external (protocol) specified encoding; state is
  30043. XML_CONTENT_STATE if we're parsing an external text entity, and
  30044. XML_PROLOG_STATE otherwise.
  30045. */
  30046. func _initScan(tls *libc.TLS, encodingTable uintptr, enc uintptr, state int32, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  30047. var e int32
  30048. var encPtr uintptr
  30049. _, _ = e, encPtr
  30050. if ptr >= end {
  30051. return -int32(4)
  30052. }
  30053. encPtr = (*TINIT_ENCODING)(unsafe.Pointer(enc)).FencPtr
  30054. if ptr+uintptr(1) == end {
  30055. /* only a single byte available for auto-detection */
  30056. /* so we're parsing an external text entity... */
  30057. /* if UTF-16 was externally specified, then we need at least 2 bytes */
  30058. switch int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) {
  30059. case int32(_UTF_16_ENC):
  30060. fallthrough
  30061. case int32(_UTF_16LE_ENC):
  30062. fallthrough
  30063. case int32(_UTF_16BE_ENC):
  30064. return -int32(1)
  30065. }
  30066. switch libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))) {
  30067. case int32(0xFE):
  30068. fallthrough
  30069. case int32(0xFF):
  30070. fallthrough
  30071. case int32(0xEF): /* possibly first byte of UTF-8 BOM */
  30072. if int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_ISO_8859_1_ENC) && state == int32(m_XML_CONTENT_STATE) {
  30073. break
  30074. }
  30075. /* fall through */
  30076. fallthrough
  30077. case 0x00:
  30078. fallthrough
  30079. case int32(0x3C):
  30080. return -int32(1)
  30081. }
  30082. } else {
  30083. switch libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))<<libc.Int32FromInt32(8) | libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))) {
  30084. case int32(0xFEFF):
  30085. if int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_ISO_8859_1_ENC) && state == int32(m_XML_CONTENT_STATE) {
  30086. break
  30087. }
  30088. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  30089. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16BE_ENC)*8))
  30090. return int32(m_XML_TOK_BOM)
  30091. /* 00 3C is handled in the default case */
  30092. fallthrough
  30093. case int32(0x3C00):
  30094. if (int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_UTF_16BE_ENC) || int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_UTF_16_ENC)) && state == int32(m_XML_CONTENT_STATE) {
  30095. break
  30096. }
  30097. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16LE_ENC)*8))
  30098. return (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(encPtr)) + uintptr(state)*8))})))(tls, *(*uintptr)(unsafe.Pointer(encPtr)), ptr, end, nextTokPtr)
  30099. case int32(0xFFFE):
  30100. if int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_ISO_8859_1_ENC) && state == int32(m_XML_CONTENT_STATE) {
  30101. break
  30102. }
  30103. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  30104. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16LE_ENC)*8))
  30105. return int32(m_XML_TOK_BOM)
  30106. case int32(0xEFBB):
  30107. /* Maybe a UTF-8 BOM (EF BB BF) */
  30108. /* If there's an explicitly specified (external) encoding
  30109. of ISO-8859-1 or some flavour of UTF-16
  30110. and this is an external text entity,
  30111. don't look for the BOM,
  30112. because it might be a legal data.
  30113. */
  30114. if state == int32(m_XML_CONTENT_STATE) {
  30115. e = int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16)
  30116. if e == int32(_ISO_8859_1_ENC) || e == int32(_UTF_16BE_ENC) || e == int32(_UTF_16LE_ENC) || e == int32(_UTF_16_ENC) {
  30117. break
  30118. }
  30119. }
  30120. if ptr+uintptr(2) == end {
  30121. return -int32(1)
  30122. }
  30123. if libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 2)))) == int32(0xBF) {
  30124. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(3)
  30125. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_8_ENC)*8))
  30126. return int32(m_XML_TOK_BOM)
  30127. }
  30128. default:
  30129. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32('\000') {
  30130. /* 0 isn't a legal data character. Furthermore a document
  30131. entity can only start with ASCII characters. So the only
  30132. way this can fail to be big-endian UTF-16 if it it's an
  30133. external parsed general entity that's labelled as
  30134. UTF-16LE.
  30135. */
  30136. if state == int32(m_XML_CONTENT_STATE) && int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_UTF_16LE_ENC) {
  30137. break
  30138. }
  30139. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16BE_ENC)*8))
  30140. return (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(encPtr)) + uintptr(state)*8))})))(tls, *(*uintptr)(unsafe.Pointer(encPtr)), ptr, end, nextTokPtr)
  30141. } else {
  30142. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32('\000') {
  30143. /* We could recover here in the case:
  30144. - parsing an external entity
  30145. - second byte is 0
  30146. - no externally specified encoding
  30147. - no encoding declaration
  30148. by assuming UTF-16LE. But we don't, because this would mean when
  30149. presented just with a single byte, we couldn't reliably determine
  30150. whether we needed further bytes.
  30151. */
  30152. if state == int32(m_XML_CONTENT_STATE) {
  30153. break
  30154. }
  30155. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16LE_ENC)*8))
  30156. return (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(encPtr)) + uintptr(state)*8))})))(tls, *(*uintptr)(unsafe.Pointer(encPtr)), ptr, end, nextTokPtr)
  30157. }
  30158. }
  30159. break
  30160. }
  30161. }
  30162. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16))*8))
  30163. return (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(encPtr)) + uintptr(state)*8))})))(tls, *(*uintptr)(unsafe.Pointer(encPtr)), ptr, end, nextTokPtr)
  30164. }
  30165. /* This file is included!
  30166. __ __ _
  30167. ___\ \/ /_ __ __ _| |_
  30168. / _ \\ /| '_ \ / _` | __|
  30169. | __// \| |_) | (_| | |_
  30170. \___/_/\_\ .__/ \__,_|\__|
  30171. |_| XML parser
  30172. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  30173. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  30174. Copyright (c) 2002 Greg Stein <gstein@users.sourceforge.net>
  30175. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  30176. Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
  30177. Copyright (c) 2017-2021 Sebastian Pipping <sebastian@pipping.org>
  30178. Licensed under the MIT license:
  30179. Permission is hereby granted, free of charge, to any person obtaining
  30180. a copy of this software and associated documentation files (the
  30181. "Software"), to deal in the Software without restriction, including
  30182. without limitation the rights to use, copy, modify, merge, publish,
  30183. distribute, sublicense, and/or sell copies of the Software, and to permit
  30184. persons to whom the Software is furnished to do so, subject to the
  30185. following conditions:
  30186. The above copyright notice and this permission notice shall be included
  30187. in all copies or substantial portions of the Software.
  30188. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  30189. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  30190. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  30191. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  30192. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  30193. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  30194. USE OR OTHER DEALINGS IN THE SOFTWARE.
  30195. */
  30196. func XXmlGetUtf8InternalEncoding(tls *libc.TLS) (r uintptr) {
  30197. return uintptr(unsafe.Pointer(&_internal_utf8_encoding))
  30198. }
  30199. func XXmlGetUtf16InternalEncoding(tls *libc.TLS) (r uintptr) {
  30200. return uintptr(unsafe.Pointer(&_internal_little2_encoding))
  30201. }
  30202. var _encodings = [7]uintptr{
  30203. 0: uintptr(unsafe.Pointer(&_latin1_encoding)),
  30204. 1: uintptr(unsafe.Pointer(&_ascii_encoding)),
  30205. 2: uintptr(unsafe.Pointer(&_utf8_encoding)),
  30206. 3: uintptr(unsafe.Pointer(&_big2_encoding)),
  30207. 4: uintptr(unsafe.Pointer(&_big2_encoding)),
  30208. 5: uintptr(unsafe.Pointer(&_little2_encoding)),
  30209. 6: uintptr(unsafe.Pointer(&_utf8_encoding)),
  30210. }
  30211. func _initScanProlog(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  30212. return _initScan(tls, uintptr(unsafe.Pointer(&_encodings)), enc, m_XML_PROLOG_STATE, ptr, end, nextTokPtr)
  30213. }
  30214. func _initScanContent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  30215. return _initScan(tls, uintptr(unsafe.Pointer(&_encodings)), enc, int32(m_XML_CONTENT_STATE), ptr, end, nextTokPtr)
  30216. }
  30217. func XXmlInitEncoding(tls *libc.TLS, p uintptr, encPtr uintptr, name uintptr) (r int32) {
  30218. var i int32
  30219. _ = i
  30220. i = _getEncodingIndex(tls, name)
  30221. if i == int32(_UNKNOWN_ENC) {
  30222. return 0
  30223. }
  30224. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FisUtf16 = int8(i)
  30225. *(*TSCANNER)(unsafe.Pointer(p)) = __ccgo_fp(_initScanProlog)
  30226. *(*TSCANNER)(unsafe.Pointer(p + 1*8)) = __ccgo_fp(_initScanContent)
  30227. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FupdatePosition = __ccgo_fp(_initUpdatePosition)
  30228. (*TINIT_ENCODING)(unsafe.Pointer(p)).FencPtr = encPtr
  30229. *(*uintptr)(unsafe.Pointer(encPtr)) = p
  30230. return int32(1)
  30231. }
  30232. func _findEncoding(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr) (r uintptr) {
  30233. bp := tls.Alloc(144)
  30234. defer tls.Free(144)
  30235. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  30236. var i int32
  30237. var _ /* buf at bp+8 */ [128]int8
  30238. var _ /* p at bp+136 */ uintptr
  30239. _ = i
  30240. *(*[128]int8)(unsafe.Pointer(bp + 8)) = [128]int8{}
  30241. *(*uintptr)(unsafe.Pointer(bp + 136)) = bp + 8
  30242. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, end, bp+136, *(*uintptr)(unsafe.Pointer(bp + 136))+uintptr(m_ENCODING_MAX)-uintptr(1))
  30243. if *(*uintptr)(unsafe.Pointer(bp)) != end {
  30244. return uintptr(0)
  30245. }
  30246. *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 136)))) = 0
  30247. if _streqci(tls, bp+8, uintptr(unsafe.Pointer(&_KW_UTF_16))) != 0 && (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar == int32(2) {
  30248. return enc
  30249. }
  30250. i = _getEncodingIndex(tls, bp+8)
  30251. if i == int32(_UNKNOWN_ENC) {
  30252. return uintptr(0)
  30253. }
  30254. return _encodings[i]
  30255. }
  30256. 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) {
  30257. return _doParseXmlDecl(tls, __ccgo_fp(_findEncoding), isGeneralTextEntity, enc, ptr, end, badPtr, versionPtr, versionEndPtr, encodingName, encoding, standalone)
  30258. }
  30259. /* This file is included!
  30260. __ __ _
  30261. ___\ \/ /_ __ __ _| |_
  30262. / _ \\ /| '_ \ / _` | __|
  30263. | __// \| |_) | (_| | |_
  30264. \___/_/\_\ .__/ \__,_|\__|
  30265. |_| XML parser
  30266. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  30267. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  30268. Copyright (c) 2002 Greg Stein <gstein@users.sourceforge.net>
  30269. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  30270. Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
  30271. Copyright (c) 2017-2021 Sebastian Pipping <sebastian@pipping.org>
  30272. Licensed under the MIT license:
  30273. Permission is hereby granted, free of charge, to any person obtaining
  30274. a copy of this software and associated documentation files (the
  30275. "Software"), to deal in the Software without restriction, including
  30276. without limitation the rights to use, copy, modify, merge, publish,
  30277. distribute, sublicense, and/or sell copies of the Software, and to permit
  30278. persons to whom the Software is furnished to do so, subject to the
  30279. following conditions:
  30280. The above copyright notice and this permission notice shall be included
  30281. in all copies or substantial portions of the Software.
  30282. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  30283. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  30284. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  30285. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  30286. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  30287. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  30288. USE OR OTHER DEALINGS IN THE SOFTWARE.
  30289. */
  30290. func XXmlGetUtf8InternalEncodingNS(tls *libc.TLS) (r uintptr) {
  30291. return uintptr(unsafe.Pointer(&_internal_utf8_encoding_ns))
  30292. }
  30293. func XXmlGetUtf16InternalEncodingNS(tls *libc.TLS) (r uintptr) {
  30294. return uintptr(unsafe.Pointer(&_internal_little2_encoding_ns))
  30295. }
  30296. var _encodingsNS = [7]uintptr{
  30297. 0: uintptr(unsafe.Pointer(&_latin1_encoding_ns)),
  30298. 1: uintptr(unsafe.Pointer(&_ascii_encoding_ns)),
  30299. 2: uintptr(unsafe.Pointer(&_utf8_encoding_ns)),
  30300. 3: uintptr(unsafe.Pointer(&_big2_encoding_ns)),
  30301. 4: uintptr(unsafe.Pointer(&_big2_encoding_ns)),
  30302. 5: uintptr(unsafe.Pointer(&_little2_encoding_ns)),
  30303. 6: uintptr(unsafe.Pointer(&_utf8_encoding_ns)),
  30304. }
  30305. func _initScanPrologNS(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  30306. return _initScan(tls, uintptr(unsafe.Pointer(&_encodingsNS)), enc, m_XML_PROLOG_STATE, ptr, end, nextTokPtr)
  30307. }
  30308. func _initScanContentNS(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  30309. return _initScan(tls, uintptr(unsafe.Pointer(&_encodingsNS)), enc, int32(m_XML_CONTENT_STATE), ptr, end, nextTokPtr)
  30310. }
  30311. func XXmlInitEncodingNS(tls *libc.TLS, p uintptr, encPtr uintptr, name uintptr) (r int32) {
  30312. var i int32
  30313. _ = i
  30314. i = _getEncodingIndex(tls, name)
  30315. if i == int32(_UNKNOWN_ENC) {
  30316. return 0
  30317. }
  30318. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FisUtf16 = int8(i)
  30319. *(*TSCANNER)(unsafe.Pointer(p)) = __ccgo_fp(_initScanPrologNS)
  30320. *(*TSCANNER)(unsafe.Pointer(p + 1*8)) = __ccgo_fp(_initScanContentNS)
  30321. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FupdatePosition = __ccgo_fp(_initUpdatePosition)
  30322. (*TINIT_ENCODING)(unsafe.Pointer(p)).FencPtr = encPtr
  30323. *(*uintptr)(unsafe.Pointer(encPtr)) = p
  30324. return int32(1)
  30325. }
  30326. func _findEncodingNS(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr) (r uintptr) {
  30327. bp := tls.Alloc(144)
  30328. defer tls.Free(144)
  30329. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  30330. var i int32
  30331. var _ /* buf at bp+8 */ [128]int8
  30332. var _ /* p at bp+136 */ uintptr
  30333. _ = i
  30334. *(*[128]int8)(unsafe.Pointer(bp + 8)) = [128]int8{}
  30335. *(*uintptr)(unsafe.Pointer(bp + 136)) = bp + 8
  30336. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, end, bp+136, *(*uintptr)(unsafe.Pointer(bp + 136))+uintptr(m_ENCODING_MAX)-uintptr(1))
  30337. if *(*uintptr)(unsafe.Pointer(bp)) != end {
  30338. return uintptr(0)
  30339. }
  30340. *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 136)))) = 0
  30341. if _streqci(tls, bp+8, uintptr(unsafe.Pointer(&_KW_UTF_16))) != 0 && (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar == int32(2) {
  30342. return enc
  30343. }
  30344. i = _getEncodingIndex(tls, bp+8)
  30345. if i == int32(_UNKNOWN_ENC) {
  30346. return uintptr(0)
  30347. }
  30348. return _encodingsNS[i]
  30349. }
  30350. 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) {
  30351. return _doParseXmlDecl(tls, __ccgo_fp(_findEncodingNS), isGeneralTextEntity, enc, ptr, end, badPtr, versionPtr, versionEndPtr, encodingName, encoding, standalone)
  30352. }
  30353. func XXmlInitUnknownEncodingNS(tls *libc.TLS, mem uintptr, table uintptr, convert TCONVERTER, userData uintptr) (r uintptr) {
  30354. var enc uintptr
  30355. _ = enc
  30356. enc = XXmlInitUnknownEncoding(tls, mem, table, convert, userData)
  30357. if enc != 0 {
  30358. *(*uint8)(unsafe.Pointer(enc + 136 + 58)) = uint8(_BT_COLON)
  30359. }
  30360. return enc
  30361. }
  30362. func __ccgo_fp(f interface{}) uintptr {
  30363. type iface [2]uintptr
  30364. return (*iface)(unsafe.Pointer(&f))[1]
  30365. }
  30366. var __ccgo_ts = (*reflect.StringHeader)(unsafe.Pointer(&__ccgo_ts1)).Data
  30367. var __ccgo_ts1 = "\x00\x01\x02\x03\x04\x05\x06\a\b\t\n\v\f\r\x0e\x0f\x00EXPAT_ENTROPY_DEBUG\x00expat: Entropy: %s --> 0x%0*lx (%lu bytes)\n\x00arc4random_buf\x00EXPAT_ACCOUNTING_DEBUG\x00EXPAT_ENTITY_DEBUG\x00out of memory\x00syntax error\x00no element found\x00not well-formed (invalid token)\x00unclosed token\x00partial character\x00mismatched tag\x00duplicate attribute\x00junk after document element\x00illegal parameter entity reference\x00undefined entity\x00recursive entity reference\x00asynchronous entity\x00reference to invalid character number\x00reference to binary entity\x00reference to external entity in attribute\x00XML or text declaration not at start of entity\x00unknown encoding\x00encoding specified in XML declaration is incorrect\x00unclosed CDATA section\x00error in processing external entity reference\x00document is not standalone\x00unexpected parser state - please send a bug report\x00entity declared in parameter entity\x00requested feature requires XML_DTD support in Expat\x00cannot change setting once parsing has begun\x00unbound prefix\x00must not undeclare prefix\x00incomplete markup in parameter entity\x00XML declaration not well-formed\x00text declaration not well-formed\x00illegal character(s) in public id\x00parser suspended\x00parser not suspended\x00parsing aborted\x00parsing finished\x00cannot suspend in external parameter entity\x00reserved prefix (xml) must not be undeclared or bound to another namespace name\x00reserved prefix (xmlns) must not be declared or undeclared\x00prefix must not be bound to one of the reserved namespace names\x00invalid argument\x00a successful prior call to function XML_GetBuffer is required\x00limit on input amplification factor (from DTD and entities) breached\x00expat_2.5.0\x00sizeof(XML_Char)\x00sizeof(XML_LChar)\x00XML_DTD\x00XML_CONTEXT_BYTES\x00XML_NS\x00XML_BLAP_MAX_AMP\x00XML_BLAP_ACT_THRES\x00expat: Accounting(%p): Direct %10llu, indirect %10llu, amplification %8.2f%s\x00 ABORTING\n\x00DIR\x00EXP\x00 (+%6ld bytes %s|%d, xmlparse.c:%d) %*s\"\x00\x00%s\x00\"\n\x00%\x00&\x00expat: Entities(%p): Count %9d, depth %2d/%2d %*s%s%s; %s length %d (xmlparse.c:%d)\n\x00OPEN \x00CLOSE\x00\\0\x00\\x1\x00\\x2\x00\\x3\x00\\x4\x00\\x5\x00\\x6\x00\\x7\x00\\x8\x00\\t\x00\\n\x00\\xB\x00\\xC\x00\\r\x00\\xE\x00\\xF\x00\\x10\x00\\x11\x00\\x12\x00\\x13\x00\\x14\x00\\x15\x00\\x16\x00\\x17\x00\\x18\x00\\x19\x00\\x1A\x00\\x1B\x00\\x1C\x00\\x1D\x00\\x1E\x00\\x1F\x00 \x00!\x00\\\"\x00#\x00$\x00'\x00(\x00)\x00*\x00+\x00,\x00-\x00.\x00/\x000\x001\x002\x003\x004\x005\x006\x007\x008\x009\x00:\x00;\x00<\x00=\x00>\x00?\x00@\x00A\x00B\x00C\x00D\x00E\x00F\x00G\x00H\x00I\x00J\x00K\x00L\x00M\x00N\x00O\x00P\x00Q\x00R\x00S\x00T\x00U\x00V\x00W\x00X\x00Y\x00Z\x00[\x00\\\\\x00]\x00^\x00_\x00`\x00a\x00b\x00c\x00d\x00e\x00f\x00g\x00h\x00i\x00j\x00k\x00l\x00m\x00n\x00o\x00p\x00q\x00r\x00s\x00t\x00u\x00v\x00w\x00x\x00y\x00z\x00{\x00|\x00}\x00~\x00\\x7F\x00\\x80\x00\\x81\x00\\x82\x00\\x83\x00\\x84\x00\\x85\x00\\x86\x00\\x87\x00\\x88\x00\\x89\x00\\x8A\x00\\x8B\x00\\x8C\x00\\x8D\x00\\x8E\x00\\x8F\x00\\x90\x00\\x91\x00\\x92\x00\\x93\x00\\x94\x00\\x95\x00\\x96\x00\\x97\x00\\x98\x00\\x99\x00\\x9A\x00\\x9B\x00\\x9C\x00\\x9D\x00\\x9E\x00\\x9F\x00\\xA0\x00\\xA1\x00\\xA2\x00\\xA3\x00\\xA4\x00\\xA5\x00\\xA6\x00\\xA7\x00\\xA8\x00\\xA9\x00\\xAA\x00\\xAB\x00\\xAC\x00\\xAD\x00\\xAE\x00\\xAF\x00\\xB0\x00\\xB1\x00\\xB2\x00\\xB3\x00\\xB4\x00\\xB5\x00\\xB6\x00\\xB7\x00\\xB8\x00\\xB9\x00\\xBA\x00\\xBB\x00\\xBC\x00\\xBD\x00\\xBE\x00\\xBF\x00\\xC0\x00\\xC1\x00\\xC2\x00\\xC3\x00\\xC4\x00\\xC5\x00\\xC6\x00\\xC7\x00\\xC8\x00\\xC9\x00\\xCA\x00\\xCB\x00\\xCC\x00\\xCD\x00\\xCE\x00\\xCF\x00\\xD0\x00\\xD1\x00\\xD2\x00\\xD3\x00\\xD4\x00\\xD5\x00\\xD6\x00\\xD7\x00\\xD8\x00\\xD9\x00\\xDA\x00\\xDB\x00\\xDC\x00\\xDD\x00\\xDE\x00\\xDF\x00\\xE0\x00\\xE1\x00\\xE2\x00\\xE3\x00\\xE4\x00\\xE5\x00\\xE6\x00\\xE7\x00\\xE8\x00\\xE9\x00\\xEA\x00\\xEB\x00\\xEC\x00\\xED\x00\\xEE\x00\\xEF\x00\\xF0\x00\\xF1\x00\\xF2\x00\\xF3\x00\\xF4\x00\\xF5\x00\\xF6\x00\\xF7\x00\\xF8\x00\\xF9\x00\\xFA\x00\\xFB\x00\\xFC\x00\\xFD\x00\\xFE\x00\\xFF\x00dead code\x00"